LoginSignup
17
16

More than 5 years have passed since last update.

Bashをv4.3.25最新版へアップグレードする

Last updated at Posted at 2014-09-25

環境

Ubuntu 14.04LTS
MacOSX Mavericks 10.9.5

脆弱性のチェック(CVE-2014-6271)

$ env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
  • 以下のように表示されると脆弱性があるらしい
vulnerable
this is a test

Bashのインストール(Ubuntu)

  • bashのインストール
$ mkdir src
$ cd src
$ wget http://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz
$ #download all patches
$ for i in $(seq -f "%03g" 0 25); do wget     http://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-$i; done
tar zxvf bash-4.3.tar.gz 
$ cd bash-4.3
$ #apply all patches
$ for i in $(seq -f "%03g" 0 25);do patch -p0 < ../bash43-$i; done
$ #build and install
$ ./configure && make
$ sudo make install
$ cd .. 
$ cd ..
$ sudo rm -r src
$ bash --version
GNU bash, バージョン 4.3.25(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
ライセンス GPLv3+: GNU GPL バージョン 3 またはそれ以降 <http://gnu.org/licenses/gpl.html>

Bashのインストール(MacOSX)

  • 既存のbashの退避
$ which bash
/usr/local/bin/bash
$ sudo mv /usr/local/bin/bash /usr/local/bin/bash.old
  • Bashのインストール
$ brew update
$ brew install bash
$ brew upgrade bash
$ bash --version
GNU bash, バージョン 4.3.25(1)-release (x86_64-apple-darwin13.4.0)
Copyright (C) 2013 Free Software Foundation, Inc.
ライセンス GPLv3+: GNU GPL バージョン 3 またはそれ以降 <http://gnu.org/licenses/gpl.html>

脆弱性の確認

  • 以下のコマンドを実行する。
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
  • 以下のように表示されれば該当の脆弱性はなくなっているらしい
bash: 警告: x: ignoring function definition attempt
bash: `x' の関数定義をインポート中にエラーが発生しました
this is a test

参考URL

17
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
16