Skip to content

Instantly share code, notes, and snippets.

@umrysh
Created September 25, 2014 19:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umrysh/796d525327f2b1c12abe to your computer and use it in GitHub Desktop.
Save umrysh/796d525327f2b1c12abe to your computer and use it in GitHub Desktop.
Patch the bash CVE-2014-6271 vulnerability (shellshock) on old versions of Debian (5 - Lenny, 6 - Squeeze) and OpenMediaVault
#!/bin/bash
#
# Put this in /usr/local/src/, make it executable and run it.
# Script From [https://dmsimard.com/2014/09/25/the-bash-cve-2014-6271-shellshock-vulnerability/]
#
# dependencies
apt-get update; apt-get install build-essential gettext bison
# get bash 3.2 source
wget http://ftp.gnu.org/gnu/bash/bash-3.2.tar.gz
tar zxvf bash-3.2.tar.gz
cd bash-3.2
# download and apply all patches, including the latest one that patches CVE-2014-6271
for i in $(seq -f "%03g" 1 52); do
wget -nv http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-$i
patch -p0 < bash32-$i
done
# compile and install to /usr/local/bin/bash
./configure && make
make install
# point /bin/bash to the new binary
mv /bin/bash /bin/bash.old
ln -s /usr/local/bin/bash /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment