Par Franck,
mardi 30 septembre 2014.
Vous avez surement entendu parler de cette faille qui a été dévoilée à propos de bash, ou alors vous pouvez passer à autre chose vu que ça ne doit pas trop vous concerner. Pour les autres, il existe depuis ce matin des mises à jour disponibles pour Mac OS X 10.7, 10.8 et 10.9, mais rien pour les versions précédentes et il se trouve que j’ai encore quelques machines qui tournent avec OS X 10.5.8 au boulot.
Seule solution : patcher ou plutôt recompiler une version à jour de bash et sh.
J’ai récupéré ici un script qui permet de lancer toutes les commandes idoines, sur 10.6 et 10.5 — il a fallu que je le modifie un peu pour ce dernier —, qui télécharge les sources et les patches idoines (bash et sh version 3.2.54), les compile et les installe.
#!/bin/bash
# In all good conscience, I can not guarantee anything in this script.
# I've tested it to the best of my ability, but please use at your own risk
if [ "$EUID" -eq 0 ]; then
echo "DO NOT RUN AS SUDO! Running as sudo will break the world and will make your computer very unhappy."
echo "There are commands later that are appropriately sudo'd."
exit 1
fi
xcode-select --version
if [[ $? != 0 ]] ; then
echo "You need to install the xcode stuff that makes magic. Let's try that together"
xcode-select --install || echo "Something broke. Try running "xcode-select --install" manually" && exit 1
fi
cd ~/
test=$( env x='() { :;}; echo vulnerable' bash -c 'echo hello' | wc -l )
if [[ ${test} -lt 2 ]]; then
echo "Your version of bash is up to date"
else
mkdir -p bash-fix
cd bash-fix
curl -k https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf -
cd bash-92/bash-3.2
# buggy on 10.5 ####
# for i in $(seq -f "%03g" 52 54); do
# curl -k https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-$i | patch -p0
# done
curl -k https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0
curl -k https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-053 | patch -p0
curl -k https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-054 | patch -p0
cd ..
xcodebuild
sudo cp /bin/bash /bin/bash.old
sudo cp /bin/sh /bin/sh.old
echo
echo
echo "Current version of bash is $(build/Release/bash --version | head -1 | awk -F "version " '{ print $2 }')"
echo "Current version of sh is $(build/Release/sh --version | head -1 | awk -F "version " '{ print $2 }' )"
if [[ $(build/Release/bash --version) =~ "3.2.54(1)-release" && $(build/Release/sh --version) =~ "3.2.54(1)-release" ]]; then
echo "So far so good. Let's do some more checks, because we like dilligence"
else
echo "The bash and shell versions are not showing up as being the most recent. Something is afoot!"
exit 1
fi
if [[ "${test}" < 2 ]]; then
echo "Your version of bash is up to date"
exit 0
else
echo "Something went horribly wrong!"
exit 1
fi
echo "Awesome. All checks have passed. Cleaning up, and removing executable privileges from the old bash and sh, just in case"
sudo cp build/Release/bash /bin
sudo cp build/Release/sh /bin
sudo chmod a-x /bin/bash.old /bin/sh.old
fi
Le script est disponible en pièce jointe si vous en avez l’utilité.
Une fois appliqué, les petits malins pourront toujours essayer de pousser cette porte, ils la trouveront correctement verrouillée.