Skip to content

Instantly share code, notes, and snippets.

@SaltwaterC
Created September 29, 2014 07:58
Show Gist options
  • Save SaltwaterC/f5c421ff6b262ef610e7 to your computer and use it in GitHub Desktop.
Save SaltwaterC/f5c421ff6b262ef610e7 to your computer and use it in GitHub Desktop.
OS X patch for Shellshock
#!/bin/bash
rm -rf bash-92
curl -s https://opensource.apple.com/tarballs/bash/bash-92.tar.gz -o bash-92.tar.gz
curl -s https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 -o bash32-052
curl -s https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-053 -o bash32-053
curl -s https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-054 -o bash32-054
tar -xvf bash-92.tar.gz
cd bash-92/bash-3.2
patch -p0 < ../../bash32-052
patch -p0 < ../../bash32-053
patch -p0 < ../../bash32-054
cd ..
xcodebuild
cd build/Release
sudo install -o root -g wheel -m 0555 bash /bin/bash
sudo install -o root -g wheel -m 0555 sh /bin/sh
echo "Checking the installed versions. Should output: 3.2.54(1)-release"
echo
/bin/bash --version
/bin/sh --version
# cleanup ...
cd ..
cd ..
cd ..
rm -rf bash-92
rm bash-92.tar.gz
rm bash32-052
rm bash32-053
rm bash32-054
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment