Created
September 25, 2014 14:32
-
-
Save siwells/ffb8885cc62c8a7572d6 to your computer and use it in GitHub Desktop.
Shellshock fix for Bash & sh on OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System Binaries | |
OS X 10.9.5 (the latest stable release at the moment) ships with Bash v3.2.51: | |
$ bash --version | |
GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13) | |
Copyright (C) 2007 Free Software Foundation, Inc. | |
You can obtain and recompile Bash as follows, providing that you have Xcode installed: | |
$ mkdir bash-fix | |
$ cd bash-fix | |
$ curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf - | |
$ cd bash-92/bash-3.2 | |
$ curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0 | |
$ cd .. | |
$ xcodebuild | |
$ sudo cp /bin/bash /bin/bash.old | |
$ sudo cp /bin/sh /bin/sh.old | |
$ build/Release/bash --version # GNU bash, version 3.2.52(1)-release | |
$ build/Release/sh --version # GNU bash, version 3.2.52(1)-release | |
$ sudo cp build/Release/bash /bin | |
$ sudo cp build/Release/sh /bin | |
After this, the Bash version should be v3.2.52: | |
$ bash --version | |
GNU bash, version 3.2.52(1)-release (x86_64-apple-darwin13) | |
Copyright (C) 2007 Free Software Foundation, Inc. | |
For security, and after testing, I recommend that you chmod -x the old versions to ensure they aren't re-used, or move them to a backup site. | |
$ sudo chmod a-x /bin/bash.old /bin/sh.old |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment