-
-
Save bhalothia/af5632247ac476e8a199 to your computer and use it in GitHub Desktop.
This file contains 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
#!/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