Skip to content

Instantly share code, notes, and snippets.

@krallin
Created September 24, 2014 16:58
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 krallin/b96925ce5b70216b28d8 to your computer and use it in GitHub Desktop.
Save krallin/b96925ce5b70216b28d8 to your computer and use it in GitHub Desktop.
Scalr Provided Script -- Resolve CVE-2014-6271 on managed instances
#!/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