Created
September 24, 2014 16:58
-
-
Save krallin/b96925ce5b70216b28d8 to your computer and use it in GitHub Desktop.
Scalr Provided Script -- Resolve CVE-2014-6271 on managed instances
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 | |
has_yum=$(which yum) | |
has_apt=$(which apt-get) | |
function is_vulnerable { | |
env x='() { :;}; echo vulnerable' bash -c "echo this is a test" | grep "vulnerable" | |
return $? | |
} | |
if [ -n "${has_yum}" ]; then | |
# Run Yum | |
echo "Updating with Yum" | |
yum --assumeyes update bash | |
elif [ -n "${has_apt}" ]; then | |
# Run Apt | |
echo "Updating with APT" | |
apt-get update | |
apt-get install --only-upgrade --yes bash | |
else | |
echo "No package manager found!" | |
exit 1 | |
fi | |
if is_vulnerable; then | |
echo "KO" | |
exit 1 | |
else | |
echo "OK" | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment