SecurityReason.com - Our Reason is

Security

Register | Forget Password | Login
Search :
SecurityReason
WLB
Services
RSS
Corporate
Note

If you have found a vulnerability, please send to our SecurityAlert Database :
secalert()securityreason()com

Also if you have new ( 0-day ) exploit, please send to our ExploitAlert Archive :
exploit()securityreason()com

Home arrow SecurityAlert Database

Arrow  Topic :

PHP ImageCopyResized/ImageCopyResampled Integer Overflow


Arrow  SecurityAlert : 3103
Arrow  CVE : CVE-2007-3996
Arrow  SecurityRisk : Medium  Security Risk Medium  (About)
Arrow  Remote Exploit : Yes
Arrow  Local Exploit : Yes
Arrow  Exploit Given : Yes
Arrow  Credit : Mattias Bengtsson & Philip Olausson
Arrow  Published : 08.09.2007

Arrow  Affected Software : x <= PHP 5.2.3



Arrow  Advisory Text :  

PHP ImageCopyResized/ImageCopyResampled Integer Overflow

Affected Products:
<= PHP 5.2.3

Authors:
Mattias Bengtsson <mattias@secweb.se>
Philip Olausson <po@secweb.se>

Reported:
2007-06-05

Released:
2007-08-30

CVE:
CVE-2007-3996

Issue:

Two integer overflows exists in PHP's implementation of libgd. Remote
exploitation of this overflow may under some circumstances allow execution
of arbitrary code.

Description:

PHP is a widely-used general-purpose scripting language that is especially
suited for Web development and can be embedded into HTML. libgd is used for
dynamic creation of images.

Details:

The overflow is located in the function gdImageCopyResized(). Which are
used within the PHP code and can also be reached from PHP using
imagecopyresized() or imagecopyresampled().

...

stx = (int *) gdMalloc (sizeof (int) * srcW);
sty = (int *) gdMalloc (sizeof (int) * srcH);

...

for (i = 0; (i < srcW); i++) {
stx[i] = dstW * (i+1) / srcW - dstW * i / srcW ;
}
for (i = 0; (i < srcH); i++) {
sty[i] = dstH * (i+1) / srcH - dstH * i / srcH ;
}

...


Passing a high value of srcW or srcH results in a integer overflow when
allocating the buffer for stx and sty. The for-loops occuring after the
allocation will then try to write a big amout of data that will result in a
crash or possible execution of arbitrary code.

If a web application use this function for resizing images that could be
uploaded remotely, the overflow can be triggered by a specially crafted
image file.

Proof Of Concepts:

<?php

imagecopyresized(imagecreatetruecolor(0x7fffffff, 120),
imagecreatetruecolor(120, 120),
0, 0, 0, 0, 0x7fffffff, 120, 120, 120);

?>

Impact:

Due to the fact that this vulnerability can be triggered remotely the
impact should be considered high.

Solution:

Upgrade to PHP 5.2.4




Arrow  Feedback :

If you have additional information or notice any errors regarding this security advisory, please use contact form or email us at info()securityreason()com.
Alert

Multiple Vendors libc/gdtoa printf(3) Array Overrun

Security Risk High- 2009-05-30

SecurityReason realised new advisory about vulnerabilities libc/gdtoa...

Apache RSS Apache Alert

» Apache Tomcat
   RequestDispatcher
   directory traversal
   vulnerability

» Apache mod_dav / svn
   Remote Denial of Service
   Exploit

» Apache Tomcat Information
   disclosure

» Apache Tomcat User
   enumeration vulnerability
   with FORM authentication

PHP RSS PHP Alert

» PHP 5.2.9 curl safe_mode
   & open_basedir bypass

» PHP 5.2.6 SAPI
   php_getuid() overload

» PHP
   ZipArchive::extractTo()
   Directory Traversal
   Vulnerability

» PHP 5.2.6 dba_replace()
   destroying file

Copyright © SecurityReason.com. All Rights Reserved.