安全研究

安全漏洞
PHP ext/phar/stream.c和ext/phar/dirstream.c文件多个格式串漏洞

发布日期:2010-05-14
更新日期:2010-05-17

受影响系统:
PHP PHP <= 5.3.2
描述:
BUGTRAQ  ID: 40173
CVE ID: CVE-2010-2094,CVE-2010-2950

PHP是广泛使用的通用目的脚本语言,特别适合于Web开发,可嵌入到HTML中。

PHP的ext/phar/stream.c文件中内部所使用的phar_stream_flush()、phar_wrapper_unlink()、phar_parse_url()、phar_wrapper_open_url()函数以及ext/phar/dirstream.c文件中内部所使用的phar_wrapper_open_dir()函数在处理出错情况时存在格式串漏洞。在出现错误的情况下会将error变量用作格式串来调用php_stream_wrapper_log_error()函数。由于出错消息中可以包含有用户输入,这允许攻击者执行各种格式串攻击,如通过%08x的信息泄露或通过%n的内存破坏。

<*来源:Stefan Esser (s.esser@ematters.de
  
  链接:http://php-security.org/2010/05/14/mops-2010-028-php-phar_wrapper_open_url-format-string-vulnerabilities/index.html
        http://php-security.org/2010/05/14/mops-2010-027-php-phar_parse_url-format-string-vulnerabilities/index.html
        http://php-security.org/2010/05/14/mops-2010-026-php-phar_wrapper_unlink-format-string-vulnerability/index.html
        http://php-security.org/2010/05/14/mops-2010-025-php-phar_wrapper_open_dir-format-string-vulnerability/index.html
        http://php-security.org/2010/05/14/mops-2010-024-php-phar_stream_flush-format-string-vulnerability/index.html
        https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=598537
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

$ php -r "fopen('phar:///usr/bin/phar.phar/*%08x-%08x-%08x-%08x-%08x-%08x-%08x

建议:
厂商补丁:

PHP
---
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

http://svn.php.net/viewvc?view=revision&revision=298667

浏览次数:2649
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障