SecurityReason.com - Our Reason is

Security

Register | Forget Password | Login
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 5.2.11 libgd multiple vulnerabilities


Arrow  SecurityAlert : 6688
Arrow  CVE : CVE-2009-3546
Arrow  CWE : CWE-Other
Arrow  SecurityRisk : High  Security Risk High  (About)
Arrow  Remote Exploit : Yes
Arrow  Local Exploit : No
Arrow  Victim interaction required : No
Arrow  Exploit Available : No
Arrow  Credit : Tomas Hoger
Arrow  Published : 22.10.2009

Arrow  Affected Software : libgd:gd_graphics_library:2.0.33
libgd:gd_graphics_library:2.0.36:rc1
libgd:gd_graphics_library:2.0.35
libgd:gd_graphics_library:2.0.35:rc1
libgd:gd_graphics_library:2.0.35:rc2
libgd:gd_graphics_library:2.0.35:rc3
libgd:gd_graphics_library:2.0.35:rc4
libgd:gd_graphics_library:2.0.35:rc5
libgd:gd_graphics_library:2.0.34
libgd:gd_graphics_library:2.0.34:rc1
libgd:gd_graphics_library:2.0.34:rc2
php:php:5.3.0
php:php:5.2.11



Arrow  Advisory Content :  

While looking into this one, I spotted few interesting things.

Patch for this is:
- if (color > -1 && color<im->colorsTotal && color<=gdMaxColors) {
+ if (color > -1 && color < im->colorsTotal && color < gdMaxColors) {

Besides "color<=gdMaxColors" check, there is also "color<im->colorsTotal"
check. GD code also assumes that im->colorsTotal is <= gdMaxColors, as it
is used as an upper bound in multiple cases when accessing arrays of
gdMaxColors size. You can see "im->colorsTotal<=gdMaxColors" enforced in
e.g. gdImageColorAllocateAlpha(), which is called for PHP function
imagecolorallocate().

Hence:
color<im->colorsTotal (from the check)
and
im->colorsTotal<=gdMaxColors (assumed in the rest of the code)
implies
color < gdMaxColor

So the change should not really introduce any extra protection for current
PHP versions.

This change is relevant for pre-4.3.5 PHP versions, which do not have
"color<im->colorsTotal" part of the check. It is possible to trigger
im->alpha[] off-by-one over-write in those versions. This changes neighbor
member of the gdImageStruct structure - trueColor. If that happens, gd
will believe that previously non-TrueColor image is now TrueColor, which
can lead to buffer over-reads or over-writes in subsequent gd operations
(due to a different storage space needed for pixels of TrueColor and
non-TrueColor images).

But there is also concern for current PHP versions, as im->colorsTotal may
be initialized with a value greater than gdMaxColors when using
imagecreatefromgd() PHP function on a specially crafted GD file. Value
read from file is not properly checked in _gdGetColors() (gd_gd.c),possibly
allowing previously mentioned over-reads or over-writes on various places
(e.g. colorsTotal is used in _gdGetColors() when initializing im->open[]
with 0s). CVE-2009-3546 was assigned to
this problem and the fix is now committed in PHP SVN:
http://svn.php.net/viewvc?view=revision&revision=289557


Arrow  References :

http://www.vupen.com/english/advisories/2009/2930
http://www.vupen.com/english/advisories/2009/2929
http://www.securityfocus.com/bid/36712
http://svn.php.net/viewvc?view=revision&revision=289557
http://secunia.com/advisories/37080
http://secunia.com/advisories/37069
http://marc.info/?l=oss-security&m=125562113503923&w=2
2000



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

libc:fts_*() Multiple Denial of Service

Security Risk Medium- 2009-10-02

The fts functions are provided for traversing UNIX file hierarchies...

Apache RSS Apache Alert

» Apache 1.3.41 mod_proxy
   Integer overflow (code
   execution)

» Apache Tomcat 6.0.20 and
   5.5.28 unexpected file
   deletion in work
   directory

» Apache Tomcat 6.0.20 and
   5.5.28 insecure partial
   deploy after failed
   undeploy

» Apache Tomcat 6.0.20 and
   5.5.28 unexpected file
   deletion and/or
   alteration

PHP RSS PHP Alert

» PHP 5.2.12/5.3.1
   session.save_path
   safe_mode and
   open_basedir bypass

» PHP 5.2.12/5.3.1 Multiple
   Vulnerabilities

» PHP 5.2.11 libgd multiple
   vulnerabilities

» PHP 5.2.11 tempnam()
   safe_mode bypass

Copyright © SecurityReason.com. All Rights Reserved.