Compile
- mkdir bash
- cd bash/
- wget http://opensource.apple.com/tarballs/bash/bash-92.tar.gz
- tar zxvf bash-92.tar.gz
- cd bash-92
- cd bash-3.2/
- curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0
- curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-053 | patch -p0
- curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-054 | patch -p0
- cd ..
- xcodebuild
Verify
- /bin/bash --version
- ~/bash/bash-92/build/Release/bash --version
Install
sudo mv /bin/bash /bin/bash.vulnerablesudo cp /bin/bash /bin/bash.vulnerablesudo mv /bin/sh /bin/sh.vulnerablesudo cp /bin/sh /bin/sh.vulnerable- sudo chmod 0000 /bin/bash.vulnerable
- sudo chmod 0000 /bin/sh.vulnerable
- sudo cp ~/bash/bash-92/build/Release/bash /bin/
- sudo cp ~/bash/bash-92/build/Release/sh /bin/
- /bin/bash --version
- https://www.us-cert.gov/ncas/current-activity/2014/09/24/Bourne-Again-Shell-Bash-Remote-Code-Execution-Vulnerability
- http://www.theregister.co.uk/2014/09/24/bash_shell_vuln/
- https://securityblog.redhat.com/2014/09/24/bash-specially-crafted-environment-variables-code-injection-attack/
- https://access.redhat.com/articles/1200223
- http://alblue.bandlem.com/2014/09/bash-remote-vulnerability.html
- http://support.apple.com/kb/HT1222
- http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00085.html
- http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00228.html
- http://lists.gnu.org/archive/html/bug-bash/2014-09/msg00282.html
I just tried your steps above on 10.9.5 and the resulting bash is still vulnerable...
ReplyDeleteHi glazou,
ReplyDeleteDid you follow the install step and then close your terminal and restart it? All new shell should use the patched version.
Sincerely
Kush
Very important step must do this.
Deleteyes, yes, and yes.
ReplyDeleteJust did it again. Same result. See http://glazman.org/tmp/busted.png
ReplyDeleteCan you try forking bash, by typing bash and then run your test pls? i.e.
DeleteHi glazou,
ReplyDeleteSorry, don't know why its not working for you. I've tested on 10.7.5 and 10.9.5 and both seemed to patch ok.
How are you testing if the shell is vulnerable?
Sincerely
Kush
thank you a lot
ReplyDeleteCVE-2014-7169 : env X='() { (a)=>\' sh -c "echo date"; cat echo
ReplyDeleteenv X="() { :;} ; echo shellshock" `which bash` -c "echo completed"
ReplyDeleteremove/replace sh with bash (ln -s the patched bash to /bin/sh)
ReplyDeleteOk, I understood. The steps above are ok to fix __the original__ shellshock bug. But there is a second one (CVE-2014-7169), fix is pending.
ReplyDeleteOriginal vulnerability, you should NOT see world vulnerable printed on console:
env x='() { :;}; echo vulnerable' bash -c 'echo hello'
Second vulnerability, you should NOT see a date printed on console :
env X='() { (a)=>\' sh -c "echo date"; cat echo
1: course the vulnerability test can be done before the installing steps..
ReplyDelete2: the bash copied to /bin should get the right owner and permissions (chown and chmod)
3: weird fact: a simple ls -l /bin/bash /bin/sh shows that the two executables differ in size, so they are not identical
There is a bash32-053 patch pending. It is available on the oss-security list. Applying it after the bash32-052 patch and going through the directions above should close the latter CVE (unless they find another problem with it).
ReplyDeletehttp://www.openwall.com/lists/oss-security/2014/09/26/1
Chet Ramey mentions pushing it out later today. I have not yet had the opportunity to test this.
That's great blog,such a very innovative concept here.good job by blogger,Thank you so much for sharing this one, keep it up. - Apple Watch App Developers
ReplyDelete