Skip to content

Instantly share code, notes, and snippets.

@rcg4u
Last active August 29, 2015 14:06
Show Gist options
  • Save rcg4u/13d08acbcf89d536a9a9 to your computer and use it in GitHub Desktop.
Save rcg4u/13d08acbcf89d536a9a9 to your computer and use it in GitHub Desktop.
echo ""
echo "Apple OS X ShellShock BASH Fix Script"
echo "---------------------------------------------------------"
echo "Version : 20140926-2"
echo "Maintainer : T.Veluwenkamp <contact@timveluwenkamp.eu>"
echo "Copyright : Copyright (C) 2014 T.Veluwenkamp"
echo "---------------------------------------------------------"
echo ""
echo "Making TEMP dir to recompile BASH in..."
mkdir bash-fix
echo ""
echo "Entering bash-fix folder and downloading apple original bash"
cd bash-fix
curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf -
echo ""
echo "Entering offical apple bash folder"
cd bash-92/bash-3.2
echo ""
echo "Download Shellshock patches"
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0
curl http://alblue.bandlem.com/bash32-053.patch | patch -p0
cd ..
echo ""
echo "Recompiling bash with shellshock fixes"
xcodebuild
echo ""
echo "renaming old bash and replacing it with the patched bash"
sudo cp /bin/bash /bin/bash.old
sudo cp /bin/sh /bin/sh.old
sudo cp build/Release/bash /bin
sudo cp build/Release/sh /bin
sudo chmod a-x /bin/bash.old /bin/sh.old
echo ""
bash --version
echo ""
read -p "is your bash version 3.2.53(1)-release or higher? then press [enter] else press ctrl-c and try a other fix!"
echo ""
echo "cleaning temp files"
sudo rm -rf ~/bash-fix
echo ""
echo "cleaning DONE! Reboot your mac now..."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment