Lucene search

K
seebugRootSSV:1600
HistoryApr 03, 2007 - 12:00 a.m.

PHP 5 PHP_Stream_Filter_Create()函数缓冲区溢出漏洞

2007-04-0300:00:00
Root
www.seebug.org
31

PHP是一款广泛使用的WEB开发脚本语言。

PHP php_stream_filter_create()存在缓冲区溢出,远程攻击者可利用此漏洞以应用程序进程权限执行任意指令。

当一个过滤器通过php_stream_filter_create()函数建立时,会首先在HASH表中通过名字搜索过滤器,如果不成功会检查是否有通用过滤器支持请求的过滤器,这通过如下代码执行:

if (SUCCESS == zend_hash_find(filter_hash, (char*)filtername, n, (void**)&factory)) {
    filter = factory->create_filter(filtername, filterparams, persistent TSRMLS_CC);
} else if ((period = strrchr(filtername, '.'))) {
    /* try a wildcard */
    char *wildname;

    wildname = estrdup(filtername);
    period = wildname + (period - filtername);
    while (period && !filter) {
        *period = '\0';
        strcat(wildname, ".*");
        if (SUCCESS == zend_hash_find(filter_hash, wildname, strlen(wildname), (void**)&factory)) {
            filter = factory->create_filter(filtername, filterparams, persistent TSRMLS_CC);
        }

        *period = '\0';
        period = strrchr(wildname, '.');
    }
    efree(wildname);
}

很显然这个函数假定字符串结尾不会包含点,因为没有为此保留额外的内存字节,因此尝试建立过滤器以点结尾的名字,可导致单字节溢出。

PHP PHP 5.1.6
PHP PHP 5.1.5
PHP PHP 5.1.4
PHP PHP 5.1.3
PHP PHP 5.1.3
PHP PHP 5.1.2
PHP PHP 5.1.1
PHP PHP 5.1
PHP PHP 5.0.5
PHP PHP 5.0.4
PHP PHP 5.0.3

  • Trustix Secure Linux 2.2
    PHP PHP 5.0.2
    PHP PHP 5.0.1
    PHP PHP 5.0 candidate 3
    PHP PHP 5.0 candidate 2
    PHP PHP 5.0 candidate 1
    PHP PHP 5.0 .0
    PHP PHP 4.4.4
    PHP PHP 4.4.3
    PHP PHP 4.4.2
    PHP PHP 4.4.1
    PHP PHP 4.4 .0
    PHP PHP 4.3.11
    PHP PHP 4.3.10
  • Gentoo Linux
  • RedHat Fedora Core3
  • Trustix Secure Enterprise Linux 2.0
  • Trustix Secure Linux 2.2
  • Trustix Secure Linux 2.1
  • Trustix Secure Linux 2.0
  • Trustix Secure Linux 1.5
    PHP PHP 4.3.9
    PHP PHP 4.3.8
  • MandrakeSoft Linux Mandrake 10.1 x86_64
  • MandrakeSoft Linux Mandrake 10.1
  • S.u.S.E. Linux Personal 9.2
  • Turbolinux Turbolinux Server 10.0
  • Ubuntu Ubuntu Linux 4.1 ppc
  • Ubuntu Ubuntu Linux 4.1 ia64
  • Ubuntu Ubuntu Linux 4.1 ia32
    PHP PHP 4.3.7
    PHP PHP 4.3.6
    PHP PHP 4.3.5
    PHP PHP 4.3.4
  • MandrakeSoft Corporate Server 3.0 x86_64
  • MandrakeSoft Corporate Server 3.0
  • MandrakeSoft Linux Mandrake 10.0 AMD64
  • MandrakeSoft Linux Mandrake 10.0
  • S.u.S.E. Linux Personal 9.1
    PHP PHP 4.3.3
  • S.u.S.E. Linux Personal 9.0 x86_64
  • S.u.S.E. Linux Personal 9.0
  • Turbolinux Home
  • Turbolinux Turbolinux 10 F…
  • Turbolinux Turbolinux Desktop 10.0
    PHP PHP 4.3.2
    PHP PHP 4.3.1
  • MandrakeSoft Linux Mandrake 9.1 ppc
  • MandrakeSoft Linux Mandrake 9.1
  • OpenPKG OpenPKG Current
  • S.u.S.E. Linux Personal 8.2
    PHP PHP 4.3
    PHP PHP 4.2.3
  • EnGarde Secure Linux 1.0.1
  • MandrakeSoft Corporate Server 2.1 x86_64
  • MandrakeSoft Corporate Server 2.1
  • MandrakeSoft Linux Mandrake 9.0
  • Turbolinux Turbolinux Server 8.0
  • Turbolinux Turbolinux Server 7.0
  • Turbolinux Turbolinux Workstation 8.0
  • Turbolinux Turbolinux Workstation 7.0
    PHP PHP 4.2.2
  • Gentoo Linux 1.4 _rc1
  • Gentoo Linux 1.2
  • OpenPKG OpenPKG 1.1
  • RedHat Linux 8.0 i386
  • RedHat Linux 8.0
  • S.u.S.E. Linux 8.1
    PHP PHP 4.2.1
  • FreeBSD FreeBSD 4.6
  • FreeBSD FreeBSD 4.5
  • FreeBSD FreeBSD 4.4
  • FreeBSD FreeBSD 4.3
  • Slackware Linux 8.1
    PHP PHP 4.2 .0
    PHP PHP 4.2 -dev
    PHP PHP 4.1.2
  • Apple Mac OS X 10.1.5
  • Apple Mac OS X 10.1.4
  • Apple Mac OS X 10.1.3
  • Apple Mac OS X 10.1.2
  • Apple Mac OS X 10.1.1
  • Apple Mac OS X 10.1
  • Apple Mac OS X 10.1
  • Apple Mac OS X 10.0.4
  • Apple Mac OS X 10.0.3
  • Apple Mac OS X 10.0.2
  • Apple Mac OS X 10.0.1
  • Apple Mac OS X 10.0
  • Debian Linux 3.0 sparc
  • Debian Linux 3.0 s/390
  • Debian Linux 3.0 ppc
  • Debian Linux 3.0 mipsel
  • Debian Linux 3.0 mips
  • Debian Linux 3.0 m68k
  • Debian Linux 3.0 ia-64
  • Debian Linux 3.0 ia-32
  • Debian Linux 3.0 hppa
  • Debian Linux 3.0 arm
  • Debian Linux 3.0 alpha
  • MandrakeSoft Linux Mandrake 8.2 ppc
  • MandrakeSoft Linux Mandrake 8.2
  • MandrakeSoft Multi Network Firewall 2.0
  • MandrakeSoft Single Network Firewall 7.2
    PHP PHP 4.1.1
  • Conectiva Linux 7.0
    PHP PHP 4.1 .0
  • S.u.S.E. Linux 8.0 i386
  • S.u.S.E. Linux 8.0
    PHP PHP 4.0.7 RC3
    PHP PHP 4.0.7 RC2
    PHP PHP 4.0.7 RC1
    PHP PHP 4.0.7
    PHP PHP 4.0.6
  • Caldera OpenLinux Server 3.1.1
  • Caldera OpenLinux Server 3.1
  • Caldera OpenLinux Workstation 3.1.1
  • Caldera OpenLinux Workstation 3.1
  • HP Secure OS software for Linux 1.0
  • IBM AIX 4.3.3
  • IBM AIX 4.3.2
  • IBM AIX 4.3.1
  • IBM AIX 4.3
  • IBM AIX 5.1
  • MandrakeSoft Corporate Server 1.0.1
  • MandrakeSoft Linux Mandrake 8.1 ia64
  • MandrakeSoft Linux Mandrake 8.1
  • MandrakeSoft Linux Mandrake 8.0 ppc
  • MandrakeSoft Linux Mandrake 8.0
  • MandrakeSoft Linux Mandrake 7.2
  • MandrakeSoft Linux Mandrake 7.1
  • RedHat Linux 7.2 ia64
  • RedHat Linux 7.2 i386
  • RedHat Linux 7.2
  • RedHat Linux 7.1 ia64
  • RedHat Linux 7.1 i386
  • RedHat Linux 7.1 alpha
  • RedHat Linux 7.1
  • RedHat Linux 7.0 i386
  • RedHat Linux 7.0 alpha
  • RedHat Linux 7.0
  • S.u.S.E. Linux 7.3 sparc
  • S.u.S.E. Linux 7.3 ppc
  • S.u.S.E. Linux 7.3 i386
  • S.u.S.E. Linux 7.3
  • S.u.S.E. Linux 7.2 i386
  • S.u.S.E. Linux 7.2
  • Sun Cobalt RaQ 550
  • Sun LX50
  • Trustix Secure Linux 1.5
    PHP PHP 4.0.5
    PHP PHP 4.0.4
  • Compaq Compaq Secure Web Server PHP 1.0
  • Conectiva Linux 6.0
  • Guardian Digital Engarde Secure Linux 1.0.1
  • S.u.S.E. Linux 7.2
  • S.u.S.E. Linux 7.1 x86
  • S.u.S.E. Linux 7.1 sparc
  • S.u.S.E. Linux 7.1 ppc
  • S.u.S.E. Linux 7.1 alpha
  • S.u.S.E. Linux 7.1
  • S.u.S.E. Linux 7.0 sparc
  • S.u.S.E. Linux 7.0 ppc
  • S.u.S.E. Linux 7.0 i386
  • S.u.S.E. Linux 7.0 alpha
  • S.u.S.E. Linux 7.0
    PHP PHP 4.0.3 pl1
  • S.u.S.E. Linux 6.4 ppc
  • S.u.S.E. Linux 6.4 i386
  • S.u.S.E. Linux 6.4 alpha
  • S.u.S.E. Linux 6.4
    PHP PHP 4.0.3
  • Debian Linux 2.2 sparc
  • Debian Linux 2.2 powerpc
  • Debian Linux 2.2 IA-32
  • Debian Linux 2.2 arm
  • Debian Linux 2.2 alpha
  • Debian Linux 2.2 68k
  • Debian Linux 2.2
  • Sun Cobalt Control Station 4100CS
  • Sun Cobalt Qube3 Japanese 4000WGJ
  • Sun Cobalt Qube3 Japanese w/ Caching and RAID 4100WGJ
  • Sun Cobalt Qube3 Japanese w/Caching 4010WGJ
  • Sun Cobalt RaQ XTR 3500R
  • Sun Cobalt RaQ XTR Japanese 3500R-ja
    PHP PHP 4.0.2
    PHP PHP 4.0.1 pl2
    PHP PHP 4.0.1 pl1
    PHP PHP 4.0.1
  • Sun Cobalt Qube3 4000WG
  • Sun Cobalt Qube3 w/ Caching and RAID 4100WG
  • Sun Cobalt Qube3 w/Caching 4010WG
  • Sun Cobalt RaQ4 3001R
  • Sun Cobalt RaQ4 Japanese RAID 3100R-ja
  • Sun Cobalt RaQ4 RAID 3100R
    PHP PHP 4.0 0
    PHP PHP 5.2

不受影响系统

PHP PHP 5.2.1
PHP PHP 4.4.5

升级到最新程序:

PHP PHP 5.2

* PHP PHP 5.2.1
  <a href="http://www.php.net/downloads.php#v5" target="_blank">http://www.php.net/downloads.php#v5</a>

PHP PHP 4.4.4

* PHP PHP 4.4.5
  <a href="http://www.php.net/downloads.php#v4" target="_blank">http://www.php.net/downloads.php#v4</a>

                                                &lt;?php

&nbsp;&nbsp;&nbsp;&nbsp;$url&nbsp;=&nbsp;&quot;php://filter/read=OFF_BY_ONE./resource=/etc/passwd&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;fopen($url,&nbsp;&quot;r&quot;);
?&gt;