the Month of PHP Security
結構、前になりますが、2010/05/01 から 1ヶ月間、http://php-security.org/ で the Month of PHP Security として、PHP とその周辺のセキュリティ問題が報告がされていました。
そのほとんどの問題について、実証コードも掲載されています。その中で、PHP 自体のセキュリティ問題について簡単にまとめてみました。
先日、PHP 5.3.3RC1 および、PHP 5.2.14RC1 が http://qa.php.net/ でテスト用に公開されました。このため、近日中に公開される PHP 5.3.3 と PHP 5.2.14 でほとんどの問題は修正されるはずです。
MOPS-2010-001: PHP hash_update_file() Already Freed Resource Access Vulnerability
2年前の the Month of PHP Bugs で報告されていましたが、まだ修正されていない問題です。
hash_update_file() の第2引数にユーザが定義した不正なエラーハンドラや不正なストリームハンドラを渡すと、PHP 内部のハッシュポインタテーブルを書き換えが可能です。最悪の場合、任意のコードが実行されてしまう可能性があります。
MOPS-2010-003: PHP dechunk Filter Signed Comparison Vulnerability
PHP 5.3.0 で追加されたフィルタの dechunk を使用して不正な文字列をデコードすると、PHP がクラッシュする問題です。dechunk フィルタはチャンク形式でエンコードされた文字列をデコードするフィルタです。コンテンツ長に負の値を指定すると、メモリ破壊が発生します。この問題が悪用されると、DoS 攻撃などが可能になります。
最新のスナップショットでは、既に修正されています。
MOPS-2010-009: PHP shm_put_var() Already Freed Resource Access Vulnerability
shm_put_var() の第3引数に __sleep() が定義されたオブジェクトを渡すと、shm_put_var() の内部で __sleep() が使用されるため、共有メモリを開放することが可能です。その後も、開放したメモリにアクセスすることが可能なため、任意のメモリアドレスに書き込みを許してしまう可能性があります。
最新のスナップショットでは、既に修正されています。
MOPS-2010-012: PHP sqlite_single_query() Uninitialized Memory Usage Vulnerability
MOPS-2010-013: PHP sqlite_array_query() Uninitialized Memory Usage Vulnerability
sqlite_single_query() または、sqlite_array_query() に空の SQL を渡すと、初期化されていないメモリを参照します。このため、任意のコードが実行される可能性があります。
最新のスナップショットでは、既に修正されています。
- 参考サイト
- http://php-security.org/2010/05/07/mops-2010-012-php-sqlite_single_query-uninitialized-memory-usage-vulnerability/
- http://php-security.org/2010/05/07/mops-2010-013-php-sqlite_array_query-uninitialized-memory-usage-vulnerability/
- http://php-security.org/2010/05/07/mops-submission-03-sqlite_single_query-sqlite_array_query-uninitialized-memory-usage/
- http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-1868
- http://news.php.net/php.cvs/62453
MOPS-2010-014: PHP ZEND_BW_XOR Opcode Interruption Address Information Leak Vulnerability
MOPS-2010-015: PHP ZEND_SL Opcode Interruption Address Information Leak Vulnerability
MOPS-2010-016: PHP ZEND_SR Opcode Interruption Address Information Leak Vulnerability
ビット演算子 の '^'(排他的論理和)、'>>'(右シフト)、'<<'(左シフト) の処理において、エラー発生時にユーザのエラーハンドラを割り込ませると、メモリアドレス情報を返してしまう問題があります。
最新のスナップショットでは、既に修正されています。
- 参考サイト
- http://php-security.org/2010/05/08/mops-2010-014-php-zend_bw_xor-opcode-interruption-address-information-leak-vulnerability/
- http://php-security.org/2010/05/08/mops-2010-015-php-zend_sl-opcode-interruption-address-information-leak-vulnerability/
- http://php-security.org/2010/05/08/mops-2010-016-php-zend_sr-opcode-interruption-address-information-leak-vulnerability/
- http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-1914
- http://svn.php.net/viewvc?view=revision&revision=299280
MOPS-2010-021: PHP fnmatch() Stack Exhaustion Vulnerability
fnmatch() の第1引数に、長い文字列を入力すると、スタックを使い果たして PHP がクラッシュします。この問題が悪用されると、DoS 攻撃などが可能になります。
最新のスナップショットでは、既に修正されています。
MOPS-2010-022: PHP Stream Context Use After Free on Request Shutdown Vulnerability
PHP がリクエスト終了時に、既に開放されたストリームコンテキスト構造にアクセスすることにより、PHP がクラッシュする問題です。この問題は、任意のコード実行が可能かどうかは不明とのことですが、DoS 攻撃には使用される可能性があるそうです。
最新のスナップショットでは、既に修正されています。
MOPS-2010-024: PHP phar_stream_flush Format String Vulnerability
MOPS-2010-025: PHP phar_wrapper_open_dir Format String Vulnerability
MOPS-2010-026: PHP phar_wrapper_unlink Format String Vulnerability
MOPS-2010-027: PHP phar_parse_url Format String Vulnerabilities
MOPS-2010-028: PHP phar_wrapper_open_url Format String Vulnerabilities
phar 拡張モジュールのいくつかの関数において、エラー処理でフォーマット文字列脆弱性があります。このため、phar:// で細工した文字列を渡すと、メモリの取得や任意のコードを実行される可能性があります。
最新のスナップショットでは、既に修正されています。
- 参考サイト
- http://php-security.org/2010/05/14/mops-2010-024-php-phar_stream_flush-format-string-vulnerability/
- http://php-security.org/2010/05/14/mops-2010-025-php-phar_wrapper_open_dir-format-string-vulnerability/
- http://php-security.org/2010/05/14/mops-2010-026-php-phar_wrapper_unlink-format-string-vulnerability/
- http://php-security.org/2010/05/14/mops-2010-027-php-phar_parse_url-format-string-vulnerabilities/
- http://php-security.org/2010/05/14/mops-2010-028-php-phar_wrapper_open_url-format-string-vulnerabilities/
- http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-2094
- http://svn.php.net/viewvc?view=revision&revision=298667
MOPS-2010-049: PHP parse_str() Interruption Memory Corruption Vulnerability
parse_str() が処理する文字列に巨大なネスト配列となる文字列を与えると、メモリ破壊が発生します。最悪の場合は、任意のコードが実行される可能性があります。
最新のスナップショットでは、既に修正されています。
MOPS-2010-056: PHP php_mysqlnd_ok_read() Information Leak Vulnerability
MOPS-2010-057: PHP php_mysqlnd_rset_header_read() Buffer Overflow Vulnerability
MOPS-2010-058: PHP php_mysqlnd_read_error_from_line() Buffer Overflow Vulnerability
MOPS-2010-059: PHP php_mysqlnd_auth_write() Stack Buffer Overflow Vulnerability
PHP 5.3.0 から導入された Mysqln (MySQL Native Driver) に、情報リークおよび、Buffer Overflow が発生する問題があるそうです。実証コードは公開されていません。
最新のスナップショットでは、既に修正されています。
- 参考サイト
- http://php-security.org/2010/05/31/mops-2010-056-php-php_mysqlnd_ok_read-information-leak-vulnerability/
- http://php-security.org/2010/05/31/mops-2010-057-php-php_mysqlnd_rset_header_read-buffer-overflow-vulnerability/
- http://php-security.org/2010/05/31/mops-2010-058-php-php_mysqlnd_read_error_from_line-buffer-overflow-vulnerability/
- http://php-security.org/2010/05/31/mops-2010-059-php-php_mysqlnd_auth_write-stack-buffer-overflow-vulnerability/
- http://svn.php.net/viewvc?view=revision&revision=298703
MOPS-2010-060: PHP Session Serializer Session Data Injection Vulnerability
PHP 標準のセッションデータのシリアライズ処理に不備があるため、条件によっては、外部から任意のセッションデータを挿入できるという問題です。セッションのキーおよび、値ユーザからの入力を使用している場合や、$_SESSION を array_merge() で上書きしている場合は危険です。
最新のスナップショットでは、既に修正されています。
Information Leak Vulnerability
多くの関数で Call time pass by reference 機能(関数の呼び出し元で変数を参照渡しする機能)を使用すると、特定の条件でメモリ情報をリークしてしまう脆弱性が報告されています。
最新のスナップショットでは、既に修正さています。
- MOPS-2010-006: PHP addcslashes() Interruption Information Leak Vulnerability
- MOPS-2010-008: PHP chunk_split() Interruption Information Leak Vulnerability
- MOPS-2010-010: PHP html_entity_decode() Interruption Information Leak Vulnerability
- MOPS-2010-017: PHP preg_quote() Interruption Information Leak Vulnerability
- MOPS-2010-032: PHP iconv_mime_decode() Interruption Information Leak Vulnerability
- MOPS-2010-033: PHP iconv_substr() Interruption Information Leak Vulnerability
- MOPS-2010-034: PHP iconv_mime_encode() Interruption Information Leak Vulnerability
- MOPS-2010-036: PHP htmlentities() and htmlspecialchars() Interruption Information Leak Vulnerability
- MOPS-2010-037: PHP str_getcsv() Interruption Information Leak Vulnerability
- MOPS-2010-038: PHP http_build_query() Interruption Information Leak Vulnerability
- MOPS-2010-039: PHP strpbrk() Interruption Information Leak Vulnerability
- MOPS-2010-040: PHP strtr() Interruption Information Leak Vulnerability
- MOPS-2010-041: PHP strip_tags() Interruption Information Leak Vulnerability
- MOPS-2010-042: PHP setcookie() Interruption Information Leak Vulnerability
- MOPS-2010-043: PHP strtok() Interruption Information Leak Vulnerability
- MOPS-2010-044: PHP wordwrap() Interruption Information Leak Vulnerability
- MOPS-2010-045: PHP str_word_count() Interruption Information Leak Vulnerability
- MOPS-2010-046: PHP str_pad() Interruption Information Leak Vulnerability
- MOPS-2010-047: MOPS-2010-047: PHP trim()/ltrim()/rtrim() Interruption Information Leak Vulnerability
- MOPS-2010-048: PHP substr_replace() Interruption Information Leak Vulnerability
- MOPS-2010-050: PHP preg_match() Interruption Information Leak Vulnerability
- MOPS-2010-051: PHP unpack() Interruption Information Leak Vulnerability
- MOPS-2010-052: PHP pack() Interruption Information Leak Vulnerability
- MOPS-2010-053: PHP ZEND_FETCH_RW Opcode Interruption Information Leak Vulnerability
- MOPS-2010-054: PHP ZEND_CONCAT/ZEND_ASSIGN_CONCAT Opcode Interruption Information Leak and Memory Corruption Vulnerability
- MOPS-2010-055: PHP ArrayObject::uasort() Interruption Memory Corruption Vulnerability