[セキュリティメモ]GNU Bashに深刻な脆弱性が出ているようです。サーバー管理者は今すぐチェックして対策を推奨。

WS2014-10-02_15_28_30

ちょっと気づくのが遅くなったんですが、今日wordpressの管理画面を見ているとcount per dayのリファラに謎のリファラが大量に残っているのに気が付きました。

http://example.com/wp-admin/%28%29%20%7B%20:;%7D;echo%20content-type:text/plain;echo;echo%20QwaAqdKyMkdAiaZBos;echo;exit

上のようなリファラが大量に残っていました。その数700位。

20QwaAqdKyMkdAiaZBos

リファラ中に合った上の文字列キーにして検索して見たところ、スラッシュドットの記事が引っかかりました。どうやらGNU Bashに重大なセキュリティホールが見つかったらしく、そこを突いて攻撃してくるボットまで現れている模様です。

参考:bashのShellshock脆弱性を利用するボットネットが出現 | スラッシュドット・ジャパン Linux

参考:GNU Bashに重大な脆弱性、環境変数を渡して呼ぶことで任意コード実行が可能に | スラッシュドット・ジャパン セキュリティ

何かされたかどうかはまだわかりませんが、管理しているサーバ数台のbashをすぐに対策済みの物にアップデートしました。

対策済みかどうかのチェック方法には、スラド内で何方かがスレにかかれたシェルスクリプトを利用しました。

私のVPSの環境はCentOS release 6.5 (Final)です。

export HTTP_USER_AGENT='() { :;}; echo dangerous injection’; bash -c "echo safe code"

bashで上のコマンドを入力して実行します。

[root@hoge ~]# export HTTP_USER_AGENT='() { :;}; echo dangerous injection’; bash -c "echo safe code"
dangerous injection
safe code

結果「dangerous injection」と表示された場合は、未対策なbashです。すぐに対策済みの物に更新してください。


[root@hoge ~]# rpm -qa|grep bash
bash-4.1.2-15.el6_4.x86_64

更新前のバージョン


[root@hoge ~]# rpm -qa|grep bash
bash-4.1.2-15.el6_5.2.x86_64

更新後のバージョン


[root@hoge ~]# yum info bash
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: centos.mirrors.hoobly.com
* extras: centos.mirrors.hoobly.com
* updates: mirror.hmc.edu
base                                                                                                          | 3.7 kB     00:00
extras                                                                                                        | 3.3 kB     00:00
extras/primary_db                                                                                             |  19 kB     00:00
nginx                                                                                                         | 2.9 kB     00:00
nginx/primary_db                                                                                              |  32 kB     00:00
updates                                                                                                       | 3.4 kB     00:00
updates/primary_db                                                                                            | 5.4 MB     00:00
Installed Packages
Name        : bash
Arch        : x86_64
Version     : 4.1.2
Release     : 15.el6_4
Size        : 3.0 M
Repo        : installed
Summary     : The GNU Bourne Again shell
URL         : http://www.gnu.org/software/bash
License     : GPLv3+
Description : The GNU Bourne Again shell (Bash) is a shell or command language
            : interpreter that is compatible with the Bourne shell (sh). Bash
            : incorporates useful features from the Korn shell (ksh) and the C shell
            : (csh). Most sh scripts can be run by bash without modification.

Available Packages
Name        : bash
Arch        : x86_64
Version     : 4.1.2
Release     : 15.el6_5.2
Size        : 905 k
Repo        : updates
Summary     : The GNU Bourne Again shell
URL         : http://www.gnu.org/software/bash
License     : GPLv3+
Description : The GNU Bourne Again shell (Bash) is a shell or command language
            : interpreter that is compatible with the Bourne shell (sh). Bash
            : incorporates useful features from the Korn shell (ksh) and the C shell
            : (csh). Most sh scripts can be run by bash without modification.

[root@hoge ~]# yum update bash
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.mirrors.hoobly.com
* extras: centos.mirrors.hoobly.com
* updates: mirror.hmc.edu
base                                                                                                          | 3.7 kB     00:00
extras                                                                                                        | 3.3 kB     00:00
nginx                                                                                                         | 2.9 kB     00:00
updates                                                                                                       | 3.4 kB     00:00
Setting up Update Process
Resolving Dependencies
–> Running transaction check
—> Package bash.x86_64 0:4.1.2-15.el6_4 will be updated
—> Package bash.x86_64 0:4.1.2-15.el6_5.2 will be an update
–> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================
Package                    Arch                         Version                                 Repository                     Size
=====================================================================================================================================
Updating:
bash                       x86_64                       4.1.2-15.el6_5.2                        updates                       905 k

Transaction Summary
=====================================================================================================================================
Upgrade       1 Package(s)

Total download size: 905 k
Is this ok [y/N]: y
Downloading Packages:
bash-4.1.2-15.el6_5.2.x86_64.rpm                                                                              | 905 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : bash-4.1.2-15.el6_5.2.x86_64                                                                                      1/2
  Cleanup    : bash-4.1.2-15.el6_4.x86_64                                                                                        2/2
  Verifying  : bash-4.1.2-15.el6_5.2.x86_64                                                                                      1/2
  Verifying  : bash-4.1.2-15.el6_4.x86_64                                                                                        2/2

Updated:
  bash.x86_64 0:4.1.2-15.el6_5.2

Complete!
[root@hoge ~]#

yumで最新版にアップデートしました。

yum update bash

と入力します。

[root@hoge ~]# export HTTP_USER_AGENT='() { :;}; echo dangerous injection’; bash -c "echo safe code"
safe code
[root@hoge ~]#

再度スクリプトを実行して、「safe code」のみ表示されればOKです。

※最近はサーバーを全く管理できない人が、共用レンタルサーバ並に安価なVPSを借りて設定だけプロにしてもらって使っているケースが結構あるので、結構ヤバイことになりそうな気がします。

(Visited 63 times, 1 visits today)

タグ : , ,