Appleのbashに CVE-2014-6271 と CVE-2014-7169 の対応パッチあてた。
Appleのリリースしていた Bash 3.2 にパッチをあてる方法が、How do I recompile Bash to avoid Shellshock (the remote exploit CVE-2014-6271 and CVE-2014-7169)?にのっていたのでそのまま実行した。
要 Xcode。
この方法では該当するパッチしかあてないので他のパッチをあてる場合は調べる必要がある。
# If you want to disable auto-imported functions, uncomment the following # Auto-Imported機能を無効にしたい場合、この下の行をコメントアウトすること # export ADD_IMPORT_FUNCTIONS_PATCH=YES mkdir bash-fix cd bash-fix curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf - cd bash-92/bash-3.2 curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0 curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-053 | patch -p0 # See note above about ADD_IMPORT_FUNCTIONS_PATCH [ "$ADD_IMPORT_FUNCTIONS_PATCH" == "YES" ] && curl http://alblue.bandlem.com/import_functions.patch | patch -p0 cd .. # Note: DO NOT ADD SUDO TO XCODEBUILD HERE xcodebuild build/Release/bash --version # GNU bash, version 3.2.53(1)-release build/Release/sh --version # GNU bash, version 3.2.53(1)-release sudo cp /bin/bash /bin/bash.old sudo cp /bin/sh /bin/sh.old sudo cp build/Release/bash /bin sudo cp build/Release/sh /bin
curl でダウンロードする時に 認証できなかった場合 curl -k をオプションをためすといいだろう。
もっとも macports や homebrow で bash を インストールしてから システムのものに置きかえた方がいいと思いますけれども。