SlideShare una empresa de Scribd logo
1 de 14
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!

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Similar a Unix shell story

Similar a 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
 

Último

Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 

Último (20)

Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 

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!