Skip to content

Instantly share code, notes, and snippets.

@bhalothia
Forked from martinseener/shellshock_patcher_sh
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhalothia/af5632247ac476e8a199 to your computer and use it in GitHub Desktop.
Save bhalothia/af5632247ac476e8a199 to your computer and use it in GitHub Desktop.
#!/bin/bash
env x='() { :;}; echo vulnerable' bash -c "echo this is a test" | grep vulnerable > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "Not vulnerable. Machine is safe."
exit 0
else
echo -n "Vulnerable. Version: "
/bin/bash --version
echo "Installing patch."
sudo apt-get update && sudo apt-get install bash
if [ $? -eq 0 ]; then
echo -n "Patching complete: "
/bin/bash --version
exit 0
else
echo "Error updating bash binary. Please check it manually!!"
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment