Homebrew是Mac的包管理系統。很多人用它來管理mysql,python和(正如你可能猜到的)bash。 Homebrew所做的只是安裝這些軟件包,並將它們提供給用戶。雖然有些人做使用它作爲bash,與自制軟件更新bash不保護他們的整個系統免受shellshock(我的團隊今天測試和確定)。
我建議你做的是爲你的OS X版本下載XCode,下載xcode命令行實用程序(通過轉到首選項 - >下載 - >命令行實用程序),然後運行我編寫的腳本。要清楚,這個腳本只是簡單地跟在the same steps outlined here之後,我只是讓開發團隊更容易更新。
您可以將此代碼複製到一個可執行bash腳本,並使用./bash-fixer.sh
#!/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 https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf -
cd bash-92/bash-3.2
for i in $(seq -f "%03g" 52 54); do
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-$i | patch -p0
done
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 privaleges 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
讓我知道你是怎麼做出來運行它,祝你好運!
,或者甚至更好,蘋果剛剛發佈了補丁,可以在這裏找到:http://support.apple.com/kb/DL1769?viewlocale=en_US&locale=en_US – paranoid 2014-09-30 01:21:33
類似的步驟本文所示:HTTP:/ /www.macissues.com/2014/09/25/how-to-unofficially-fix-the-shell-shock-bash-vulnerability-in-os-x/在Mac OS 10.6.8中,它對我來說工作得很好。進行漏洞測試以確認更改是否有效。 – 2014-10-01 17:19:57
bash-3.2現在有幾個補丁:052到057.因此,將「52 54」更改爲「52 57」以獲取所有補丁。這些補丁是純文本文件,你可以自己親自檢查每一個通過查看每個URL,例如https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-057 – 2014-11-02 04:33:55