Skip to content

Instantly share code, notes, and snippets.

@powerumc
Created September 26, 2014 02:11
Show Gist options
  • Save powerumc/d748558953645afd0c87 to your computer and use it in GitHub Desktop.
Save powerumc/d748558953645afd0c87 to your computer and use it in GitHub Desktop.
Patch security vulnerability bash shell.
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
TEMP_PATH="_______TEMP_________"
rm -rf ${TEMP_PATH}
if [ ! -d "${TEMP_PATH}" ]; then
mkdir ${TEMP_PATH}
fi
cd ${TEMP_PATH}
if [ -d "bash-4.3" ]; then
rmdir -rf "bash-4.3"
fi
wget http://ftp.gnu.org/pub/gnu/bash/bash-4.3.tar.gz
tar zxvf bash-4.3.tar.gz
cd bash-4.3
for PATCH_VERSION in $(seq -f "bash43-%03g" 1 25)
do
wget "http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/${PATCH_VERSION}"
patch -p0 < ${PATCH_VERSION}
done
./configure
make
sudo cp -f ./bash /bin/
cd ../..
rm -rf ${TEMP_PATH}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment