PHPに重大な脆弱性(PHP4.4.0以下、PHP5.0.5以下)

Security 11月 2, 2005
(Last Updated On: 2018年8月3日)

このページ情報は不正確です。このページを参照された方は

まとめ
http://blog.ohgaki.net/index.php/yohgaki/2005/11/09/phpa_rc_fei_a_oa_oa_fa_sa_le_acsa_oe_afp_2

を参照して頂けるようお願いいたいたします。

PHPの脆弱性リスト


PHPに深刻な脆弱性がある事が発表されました。今まで見つかったPHPの脆弱性の中でも「最悪」の脆弱性です。全てのPHPユーザは今すぐ対処を行う必要があります。

http://www.hardened-php.net/advisory_202005.79.html
http://www.hardened-php.net/advisory_192005.78.html
http://www.hardened-php.net/globals-problem

PHP4とPHP5で多少影響範囲が異なります。詳しくはオリジナルのアドバイザリと脆弱性の説明を読んでください。この脆弱性は非常に危険です。特にオープンソースのPHPアプリケーションを使用している場合、速やかに対処される事をお勧めします。

PEARを利用していない場合PEARファイルを削除するなどの対処も、一時的には、有効な対策になると思います。
# この対策は脆弱性をほんの少し隠すくらいの意味しかありません。
## ワームなどに利用される可能性が高いPEAR.phpにアクセスさせない為
# PHP本体をアップグレードしないと根本的な対策となりません。

PHP4はPHP4.4.1にアップグレードすれば大丈夫です。PHP4.4.xはソースの埋め込み定数参照の仕様が変更されているためプログラムが動作しなくなることがあります。(念のため)

WikiにPHP 4.3.11、PHP 5.0.4用とPHP 5.0.5用のパッチを載せました。

http://wiki.ohgaki.net/index.php?PHP%2Fpatch%2F%24GLOBAL%CA%DD%B8%EE%A5%D1%A5%C3%A5%C1

PHP5.0.5はPHP4.4.0と同様に埋め込み定数参照の仕様が変更されています。PHP 4.3 -> PHP 4.4と同じ互換性問題がPHP 5.0.4 -> PHP 5.0.5で発生します。この為PHP 5.0.4とPHP 5.0.5の両方を用意しました。

パッチを見れば判りますがPHP 5.0.6となるCVSのPHP_5_0ブランチにはこの変更は組み込まれています。

脆弱性の説明から

Impact of GLOBALS overwrite

The impact of this kind of vulnerabilities is very high, because the problematic code seems to be secure unless you know about this behaviour of PHP and therefore very many applications are vulnerable to this problem. Additionally it is problematic, that the heart of PEAR (PEAR.php) also suffers from this vulnerability in PHP, although their code is written in a way that should be safe onder normal circumstances.

According to PHP usage statistics 71.03% of all servers, that announce a PHP4 version within their HTTP headers, are still using PHP <= 4.3.10. This actually means that most of the servers out there are running with old versions of PEAR where a application gets automatically vulnerable if it includes PEAR.php and is running with register_globals turned on. And this also means, that any PHP application that suffers from a local file include vulnerability can be easily turned into a remote code execution vulnerability by simply including the local copy of PEAR.php, that is usually in standard (or easyly guessable) paths. Additionally the PEAR directory is often trusted and therefore added as safe_mode_include_dir or to the open_basedir, so that it is even possible to include PEAR.php if SAFE_MODE or open_basedir is used to secure the system.

In the end it is simply unknown how many PHP applications suffer from these problems, because the problem is often overseen, widespread and unknown to a lot of security auditors. And with PEAR.php and vBulletin there are already two very big names on the list of affected applications.

要約すると

– この脆弱性は非常に危険
– さらに悪いことにはPEAR.phpもこの脆弱性の影響を受ける
– 世の中にはPHP 4.3.10以下のサーバが多くある
(注:4.3.10以下はさらに危険。4.3.11で$_GET/$_POST/$_COOKIEの脆弱性が対処されている)
– PEAR.phpのインクルードパスは信頼されている場合が多く、safe_mode, open_basedirによる保護が効かない
– 影響を付けるシステム、アプリケーションは数え切れないほど多い

PHP4ユーザは少なくとも今すぐPHP 4.3.11にアップグレードし、さらに$_FILESの脆弱性を埋めるパッチを適用するべきです。

PHP5ユーザはPHP 5.0.4またはPHP 5.0.5にアップグレードし脆弱性に対するパッチを適用するべきです。

投稿者: yohgaki