2014年9月30日火曜日

bash の脆弱性  SehllShock (CVE-2014-6721)

対応
yumつかってるなら
yum update bashで9月26日にだされた修正パッチをあてればよい


実際どのような箇所が問題なのか詳しく説明してくれているサイト様、すごいよくわかる・・!
http://moro-archive.hatenablog.com/entry/2014/09/27/200553



root@xxxxxx]# env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
vulnerable  ←コイツがでるとアウト
this is a test

上記のようになると脆弱性ありありなので
yum update bashを実行
その後

[root@xxxxxx]# env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
this is a test

デナクナッター


----  仕事にて古いredhatの対応もせねばならなくなりそうなので色々まとめ     ------

■redhat or centosなら下記コマンドを実行してOSversionを確認する
cat /etc/redhat-release


■通常のredhat4は既にサポート切れ(2012/02/29)だが、延長契約をしてれば2015/02/29までredhatのレポジトリから
bashのアップデートで対応が可能。延長契約しているのかどうかをユーザ様に確認

#RHEL4 ELSは、2005年に出荷開始された「Red Hat Enterprise Linux 4」の7年間の標準サポートに加え、3年間の延長サポートを提供するもの。これにより、2012年2月29日までの標準サポートを最大2015年2月末まで延長が可能となる。

■現状脆弱性確認
[root@xxxxxx]# env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
vulnerable   ←下記のthis is a test以外が表示された場合脆弱性あり
this is a test ←この文字列のみ表示された場合脆弱性なし

■バッシュ対応確認チェックスクリプト
https://github.com/hannob/bashcheck

[root@dti-vps-srv741 ~]# sh bashcheck
Testing /bin/bash ...
Bash version 4.1.2(1)-release

Variable function parser pre/suffixed [(), redhat], bugs not exploitable
Not vulnerable to CVE-2014-6271 (original shellshock)
Not vulnerable to CVE-2014-7169 (taviso bug)
Not vulnerable to CVE-2014-7186 (redir_stack bug)
Test for CVE-2014-7187 not reliable without address sanitizer
Found non-exploitable CVE-2014-6277 (lcamtuf bug #1)
Not vulnerable to CVE-2014-6278 (lcamtuf bug #2)

上記のように表示されていれば対応完了済
対応できていないwarningやらerrorなどの文字列が含まれた結果が表示されるかと

■update対応
☆redhat 5~などなら
yum update bash-*
のみで対応できる。

☆redhat 4は延長サポートをうけていれば
 up2date -u bash-*
 で対応可能

☆redhat 4は延長サポートをうけていない場合
1・オラクルからでてる修正パッチをwgetで入手
wget https://oss.oracle.com/el4/SRPMS-updates/bash-3.0-27.0.2.el4.src.rpm
2・リビルド
rpmbuild -rebuild bash-3.0-27.0.2.el4.src.rpm
(rpmbuildコマンドが使えない場合使えるようインストールしておくこと)
3・インストール
rpm -Uvh bash-3.0-27.0.3.i386.rpm

■現状脆弱性確認
[root@xxxxxx]# env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
this is a test

上記結果となっていればインストール対応完了


バッシュversion確認
rpm -qa | egrep '^bash'

0 件のコメント:

コメントを投稿