[php-maint] research for recent PHP security vulnerabilities

Martin Pitt martin.pitt at ubuntu.com
Thu Sep 7 12:25:27 UTC 2006

Hi PHP maintainers,

I just finished the PHP security update for Ubuntu, to fix some of the
recent issues. I talked to Sean yesterday and promised to share my
patch research, so here it is.

I ported the patches to php 5.1.4 (dapper), 5.0.5 (breezy), and 4.3.10
(hoary), so feel free to grab the patches from the updated source
packages at security.ubuntu.com.



sscanf buffer overflow
5.1: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/scanf.c?r1=
4.4: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/scanf.c?r1=

The sscanf() function did not properly check array boundaries. In
applications which use sscanf() with argument swapping, a remote attacker
could potentially exploit this to crash the affected web application
or even execute arbitrary code with the application's privileges.

ip2long() information disclosure
no patch yet

does not limit the character set of PHPSESSID
a bit diffuse and questionable, bug in Zend core, needs further investigations

safe_mode/open_basedir bypass with file_exists() and imap_reopen()
4.4 [imap_reopen()]: http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=
5.1 [imap_reopen()]: http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=
5.1 [file_exists()]: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c?r1=

The file_exists() and imap_reopen() functions did not perform
proper open_basedir and safe_mode checks which could allow local
scripts to bypass intended restrictions.

str_repeat() and wordwrap() buffer overflow on 64 bit systems
5.1: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.

On 64 bit systems the str_repeat() and wordwrap() functions did not
properly check buffer boundaries. Depending on the application, this
could potentially be exploited to execute arbitrary code with the
applications' privileges. This only affects the amd64 and sparc

safe_mode/open_basedir bypass with curl
(already fixed as CVE-2006-2563, the actual CVE-2006-2563 fix might be
a different one)

GIF parser overflow
4.4: http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_gif_in.c?r1=
5.1: http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_gif_in.c?r1=

A buffer overflow was discovered in the LWZReadByte_() function of the
GIF image file parser. By tricking a PHP application into processing a
specially crafted GIF image, a remote attacker could exploit this to
execute arbitrary code with the application's privileges.

stripos() overflow
4.4: N/A (function does not exist)
5.1: mentioned in release announcement, but not in detailled changelog, no CVS fix

unspecified memory_limit bug on 64 bit systems
further information required

Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org

In a world without walls and fences, who needs Windows and Gates?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-php-maint/attachments/20060907/cff39918/attachment.pgp

More information about the pkg-php-maint mailing list