Last active
August 29, 2015 14:06
-
-
Save cjs/3e11f044516fef7b0c8e to your computer and use it in GitHub Desktop.
Build bash from source for Debian etch distributions
This file contains hidden or 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
# I didn't write this, I just adapted it from the lenny version: https://gist.github.com/href/54859127c183f67f947f | |
# inspired by http://askubuntu.com/a/528171 | |
# prerequisites | |
sudo apt-get install bison | |
# get bash 3.1 source | |
mkdir src && cd src | |
wget http://ftp.gnu.org/gnu/bash/bash-3.1.tar.gz | |
tar zxvf bash-3.1.tar.gz | |
cd bash-3.1 | |
# get the gpg keyring for verification | |
wget -nv ftp://ftp.gnu.org/gnu/gnu-keyring.gpg | |
# download and apply all patches, including the latest one that patches CVE-2014-6271 | |
for i in $(seq -f "%03g" 1 23); do | |
wget -nv https://ftp.gnu.org/gnu/bash/bash-3.1-patches/bash31-$i | |
wget -nv https://ftp.gnu.org/gnu/bash/bash-3.1-patches/bash31-$i.sig | |
# removed sig verification because it didn't work | |
patch -p0 < bash31-$i | |
done | |
# compile and install to /usr/local/bin/bash | |
./configure && make | |
sudo make install | |
# point /bin/bash to the new binary | |
sudo mv /bin/bash /bin/bash.old | |
sudo ln -s /usr/local/bin/bash /bin/bash | |
# test by comparing the output of the following | |
env x='() { :;}; echo vulnerable' /bin/bash.old -c echo | |
env x='() { :;}; echo vulnerable' bash -c echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment