SlideShare une entreprise Scribd logo
1  sur  14
Télécharger pour lire hors ligne
Quyen Le Van
23rd July 2015
Hanoi, Vietnam
Unix Shell Story
Broadlinux | Linux of Things
Agenda
 History of Shell
 About Bourne-Again Shell
 BASH Issues
2
Broadlinux | Linux of Things
HISTORY OF SHELL
3
The world before Shell
Broadlinux | Linux of Things
The Origin of the Shell
 “After having written dozens of commands for CTSS, I reached the stage
where I felt that commands should be usable as building blocks for writing
more commands, just like subroutine libraries”.
 Louis Pouzin created for CTSS (The Compatible Time-Sharing System) a
command called RUNCOM, which executed a list of commands contained
in a file.
 The idea of using commands somehow like a programming language,
makes him write a paper explaining how the Multics command language
could be designed with this objective. And he coined the word "shell" to
name it.
4
1964
|
RUNCOM
1963
|
Start
Multics
1965
|
Multics
shell
1977
|
Bourne shell
by Stephen Bourne
1971
|
V6 shell
1st UNIX Shell
by Ken Thompson
1969
|
Start
UNIX
1960s
|
CTSS
1991
|
LINUX
by Linus
Torvalds
Broadlinux | Linux of Things
ABOUT BOURNE-AGAIN SHELL
5
Go deeply inside BASH Shell
Broadlinux | Linux of Things
BASH Shell Architecture
 Bash processing is much like a shell pipeline: after being read from the
terminal or a script, data is passed through a number of stages, transformed
at each step, until the shell finally executes a command and collects its
return status.
6
Broadlinux | Linux of Things
Shell Built-in Commands
 These builtin commands are part of the shell, and are implemented as part
of the shell's source code to maintain or modify the shell's internal state.
 The shell recognizes that the command that it was asked to execute was
one of its builtins, and it performs that action on its own, without calling out
to a separate executable.
 Different shells have different builtins, though there will be a whole lot of
overlap in the basic set.
7
<>
$ echo $SHELL
/bin/bash
$ which printf
/usr/bin/printf
$ printf
printf: usage: printf [-v var] format [arguments]
$ /usr/bin/printf
/usr/bin/printf: missing operand
Try `/usr/bin/printf --help' for more information.
Broadlinux | Linux of Things
Simple Command Execution
 Simple commands are the ones most commonly encountered.
 When presented a command name that is not the name of a shell function
or builtin, bash searches the filesystem for an executable file with that name
 The value of the PATH variable is used as a colon-separated list of directories in
which to search.
 Command names containing slashes (or other directory separators) are not
looked up, but are executed directly.
 If bash finds a file to execute, it forks and creates a new execution
environment, and executes the program in this new environment.
8
Shell
environment
Subshell
environment
I/O redirection
Spawns/fork
/sbin/chmod 777 foo
chmod(“foo”, 777)
Broadlinux | Linux of Things
BASH ISSUES
9
Weakness of BASH Shell
Broadlinux | Linux of Things
Shellshock (AKA Bashdoor)
 A family of security bugs in the widely used Unix Bash shell (< 4.3.028), the
first of which was disclosed on 24 September 2014.
 Vulnerability in Bash executes trailing string after environment variable
definition
 To exploit simply insert malicious commands as part of a string that will be
put in an environment variable given to Bash
 Current exploits in the wild downloads rootkits, command and control
servers, DoS and download malware
 Attack Vectors: HTTP, DHCP, SIP, FTP, SMTP, SSHD, OpenVPN, Reverse
DNS
10
Broadlinux | Linux of Things
BASH Injection via HTTP
 Injection is an entire class of attacks that rely on injecting data into a web
application in order to facilitate the execution or interpretation of malicious
data in an unexpected manner.
11
abc
http://
<div>
<value>abc; cat /ect/passwd;</value>
</div>
system(“echo %s > /some_file”, value);
echo abc; cat /etc/passwd; > /some_file
1
2
3
lighthttpd
Copyright© 2014 DASAN Networks, Inc.
”It became possible to go home in the evening while
leaving behind long runcoms executing overnight.”
LOUIS POUZIN
1931, France
Broadlinux | Linux of Things
Reference
 Introduction to the Unix shell history,
http://www.softpanorama.org/People/Shell_giants/introduction.shtml
 The origin of the Shell, http://www.multicians.org/shell.html
 Evolution of shells in Linux http://www.ibm.com/developerworks/library/l-linux-shells/
 The Bourne-Again Shell, http://www.aosabook.org/en/bash.html
 Explain Shell website, http://explainshell.com/
 Unix, https://en.wikipedia.org/wiki/Unix
 The IBM 7094 and CTSS, http://www.multicians.org/thvv/7094.html
 What are built-in commands in linux,
http://stackoverflow.com/questions/3192373/what-are-shell-built-in-commands-in-
linux
 Some nifty shell tricks, http://www.ibm.com/developerworks/aix/tutorials/au-unixtips4/
 Shellshock Explained, http://learning.criticalwatch.com/shellshock/
 Inside Shellshock, https://blog.cloudflare.com/inside-shellshock/
13
Broadlinux | Linux of Things 14
Thank you!

Contenu connexe

Tendances

Linux Getting Started
Linux Getting StartedLinux Getting Started
Linux Getting StartedAngus Li
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals  Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals Sadia Bashir
 
Unix operating system architecture with file structure
Unix operating system architecture with file structure Unix operating system architecture with file structure
Unix operating system architecture with file structure amol_chavan
 
50 most frequently used unix linux commands (with examples)
50 most frequently used unix   linux commands (with examples)50 most frequently used unix   linux commands (with examples)
50 most frequently used unix linux commands (with examples)Rodrigo Maia
 
computer notes - Unix primer
computer notes - Unix primercomputer notes - Unix primer
computer notes - Unix primerecomputernotes
 
Linux cmd
Linux cmdLinux cmd
Linux cmdReka
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Wave Digitech
 
Useful Linux and Unix commands handbook
Useful Linux and Unix commands handbookUseful Linux and Unix commands handbook
Useful Linux and Unix commands handbookWave Digitech
 
1_Introduction_To_Unix_and_Basic_Unix_Commands
1_Introduction_To_Unix_and_Basic_Unix_Commands1_Introduction_To_Unix_and_Basic_Unix_Commands
1_Introduction_To_Unix_and_Basic_Unix_CommandsGautam Raja
 
Browsing The Source Code of Linux Packages
Browsing The Source Code of Linux PackagesBrowsing The Source Code of Linux Packages
Browsing The Source Code of Linux PackagesMotaz Saad
 
Lesson 3 Working with Files in Linux
Lesson 3 Working with Files in LinuxLesson 3 Working with Files in Linux
Lesson 3 Working with Files in LinuxSadia Bashir
 

Tendances (20)

Linux Getting Started
Linux Getting StartedLinux Getting Started
Linux Getting Started
 
Suman bhatt
Suman bhattSuman bhatt
Suman bhatt
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commands
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals  Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
 
Unix operating system architecture with file structure
Unix operating system architecture with file structure Unix operating system architecture with file structure
Unix operating system architecture with file structure
 
Linux commands
Linux commandsLinux commands
Linux commands
 
50 most frequently used unix linux commands (with examples)
50 most frequently used unix   linux commands (with examples)50 most frequently used unix   linux commands (with examples)
50 most frequently used unix linux commands (with examples)
 
computer notes - Unix primer
computer notes - Unix primercomputer notes - Unix primer
computer notes - Unix primer
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 
Linux cmd
Linux cmdLinux cmd
Linux cmd
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
Useful Linux and Unix commands handbook
Useful Linux and Unix commands handbookUseful Linux and Unix commands handbook
Useful Linux and Unix commands handbook
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 
Itc333 week 3
Itc333   week 3Itc333   week 3
Itc333 week 3
 
1_Introduction_To_Unix_and_Basic_Unix_Commands
1_Introduction_To_Unix_and_Basic_Unix_Commands1_Introduction_To_Unix_and_Basic_Unix_Commands
1_Introduction_To_Unix_and_Basic_Unix_Commands
 
Browsing The Source Code of Linux Packages
Browsing The Source Code of Linux PackagesBrowsing The Source Code of Linux Packages
Browsing The Source Code of Linux Packages
 
Lesson 3 Working with Files in Linux
Lesson 3 Working with Files in LinuxLesson 3 Working with Files in Linux
Lesson 3 Working with Files in Linux
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
 

Similaire à Unix shell story

Similaire à Unix shell story (20)

Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02Unixshellscript 100406085942-phpapp02
Unixshellscript 100406085942-phpapp02
 
Licão 02 shell basics bash intro
Licão 02 shell basics bash introLicão 02 shell basics bash intro
Licão 02 shell basics bash intro
 
1 using linux_tools
1 using linux_tools1 using linux_tools
1 using linux_tools
 
Introduction to linux day1
Introduction to linux day1Introduction to linux day1
Introduction to linux day1
 
UnixShells.ppt
UnixShells.pptUnixShells.ppt
UnixShells.ppt
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
Introduction 2 linux
Introduction 2 linuxIntroduction 2 linux
Introduction 2 linux
 
Unix environment [autosaved]
Unix environment [autosaved]Unix environment [autosaved]
Unix environment [autosaved]
 
Unix environment [autosaved]
Unix environment [autosaved]Unix environment [autosaved]
Unix environment [autosaved]
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
Shell intro
Shell introShell intro
Shell intro
 
Shell intro
Shell introShell intro
Shell intro
 
Shell intro
Shell introShell intro
Shell intro
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
Linux notes
Linux notesLinux notes
Linux notes
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentals
 
Ch1 linux basics
Ch1 linux basicsCh1 linux basics
Ch1 linux basics
 
Introduction to unix
Introduction to unixIntroduction to unix
Introduction to unix
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools
 
Lesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File SystemLesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File System
 

Dernier

VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxAS Design & AST.
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdfSteve Caron
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxSasikiranMarri
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 

Dernier (20)

VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptx
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 

Unix shell story

  • 1. Quyen Le Van 23rd July 2015 Hanoi, Vietnam Unix Shell Story
  • 2. Broadlinux | Linux of Things Agenda  History of Shell  About Bourne-Again Shell  BASH Issues 2
  • 3. Broadlinux | Linux of Things HISTORY OF SHELL 3 The world before Shell
  • 4. Broadlinux | Linux of Things The Origin of the Shell  “After having written dozens of commands for CTSS, I reached the stage where I felt that commands should be usable as building blocks for writing more commands, just like subroutine libraries”.  Louis Pouzin created for CTSS (The Compatible Time-Sharing System) a command called RUNCOM, which executed a list of commands contained in a file.  The idea of using commands somehow like a programming language, makes him write a paper explaining how the Multics command language could be designed with this objective. And he coined the word "shell" to name it. 4 1964 | RUNCOM 1963 | Start Multics 1965 | Multics shell 1977 | Bourne shell by Stephen Bourne 1971 | V6 shell 1st UNIX Shell by Ken Thompson 1969 | Start UNIX 1960s | CTSS 1991 | LINUX by Linus Torvalds
  • 5. Broadlinux | Linux of Things ABOUT BOURNE-AGAIN SHELL 5 Go deeply inside BASH Shell
  • 6. Broadlinux | Linux of Things BASH Shell Architecture  Bash processing is much like a shell pipeline: after being read from the terminal or a script, data is passed through a number of stages, transformed at each step, until the shell finally executes a command and collects its return status. 6
  • 7. Broadlinux | Linux of Things Shell Built-in Commands  These builtin commands are part of the shell, and are implemented as part of the shell's source code to maintain or modify the shell's internal state.  The shell recognizes that the command that it was asked to execute was one of its builtins, and it performs that action on its own, without calling out to a separate executable.  Different shells have different builtins, though there will be a whole lot of overlap in the basic set. 7 <> $ echo $SHELL /bin/bash $ which printf /usr/bin/printf $ printf printf: usage: printf [-v var] format [arguments] $ /usr/bin/printf /usr/bin/printf: missing operand Try `/usr/bin/printf --help' for more information.
  • 8. Broadlinux | Linux of Things Simple Command Execution  Simple commands are the ones most commonly encountered.  When presented a command name that is not the name of a shell function or builtin, bash searches the filesystem for an executable file with that name  The value of the PATH variable is used as a colon-separated list of directories in which to search.  Command names containing slashes (or other directory separators) are not looked up, but are executed directly.  If bash finds a file to execute, it forks and creates a new execution environment, and executes the program in this new environment. 8 Shell environment Subshell environment I/O redirection Spawns/fork /sbin/chmod 777 foo chmod(“foo”, 777)
  • 9. Broadlinux | Linux of Things BASH ISSUES 9 Weakness of BASH Shell
  • 10. Broadlinux | Linux of Things Shellshock (AKA Bashdoor)  A family of security bugs in the widely used Unix Bash shell (< 4.3.028), the first of which was disclosed on 24 September 2014.  Vulnerability in Bash executes trailing string after environment variable definition  To exploit simply insert malicious commands as part of a string that will be put in an environment variable given to Bash  Current exploits in the wild downloads rootkits, command and control servers, DoS and download malware  Attack Vectors: HTTP, DHCP, SIP, FTP, SMTP, SSHD, OpenVPN, Reverse DNS 10
  • 11. Broadlinux | Linux of Things BASH Injection via HTTP  Injection is an entire class of attacks that rely on injecting data into a web application in order to facilitate the execution or interpretation of malicious data in an unexpected manner. 11 abc http:// <div> <value>abc; cat /ect/passwd;</value> </div> system(“echo %s > /some_file”, value); echo abc; cat /etc/passwd; > /some_file 1 2 3 lighthttpd
  • 12. Copyright© 2014 DASAN Networks, Inc. ”It became possible to go home in the evening while leaving behind long runcoms executing overnight.” LOUIS POUZIN 1931, France
  • 13. Broadlinux | Linux of Things Reference  Introduction to the Unix shell history, http://www.softpanorama.org/People/Shell_giants/introduction.shtml  The origin of the Shell, http://www.multicians.org/shell.html  Evolution of shells in Linux http://www.ibm.com/developerworks/library/l-linux-shells/  The Bourne-Again Shell, http://www.aosabook.org/en/bash.html  Explain Shell website, http://explainshell.com/  Unix, https://en.wikipedia.org/wiki/Unix  The IBM 7094 and CTSS, http://www.multicians.org/thvv/7094.html  What are built-in commands in linux, http://stackoverflow.com/questions/3192373/what-are-shell-built-in-commands-in- linux  Some nifty shell tricks, http://www.ibm.com/developerworks/aix/tutorials/au-unixtips4/  Shellshock Explained, http://learning.criticalwatch.com/shellshock/  Inside Shellshock, https://blog.cloudflare.com/inside-shellshock/ 13
  • 14. Broadlinux | Linux of Things 14 Thank you!