CVE-2009-3546: Buffer Overflow
The gdGetColors function in gdgd.c in PHP 5.2.11 and 5.3.x before 5.3.1, and the GD Graphics Library 2.x, does not properly verify a certain colorsTotal structure member, which might allow remote attackers to conduct buffer overflow or buffer over-read attacks via a crafted GD file, a different vulnerability than CVE-2009-3293. NOTE: some of these details are obtained from third party information.
Other sources
While investigating CVE-2009-3293 (bug #524217) fixed in PHP 5.2.11, it was discovered that gdGetColors() (in libgd/gdgd.c) does not properly check values read from the input GD file, making it possible to set im->colorsTotal to a value greater than gdMaxColors. GD code assumes that colorsTotal is always less than or equal to gdMaxColors, as it is used as an upper bound when accessing arrays with gdMaxColors size. Higher colorsTotal value can lead to buffer over-reads or over-writes on multiple places.
Issue was reported and fixed upstream: http://svn.php.net/viewvc?view=revision&revision=289557
Fix should get include in the future PHP and GD versions.
Note: GD image format is not meant for general purpose use and should not be used to distribute images. Its purpose is to allow fast loading by applications using libGD: http://www.libgd.org/GdFileFormats
This affects gd in Red Hat Enterprise Linux 4 and 5, version in Red Hat Enterprise Linux 3 is not affected.
It also affects all current PHP versions (Red Hat Enterprise Linux 3, 4 and 5, Fedora), as they include embedded copy of gd 2.x.
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/libgd2to a version that resolves this vulnerability.Fixed in 2.0.33-5.2etch2Fixed in 2.0.36~rc1~dfsg-3+lenny1Fixed in 2.0.36~rc1~dfsg-3.1 - Upgrade
Upgrade
debian/racketto a version that resolves this vulnerability.Fixed in 5.0.2-1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 5.2.11
Event History
Frequently Asked Questions
What is the severity of CVE-2009-3546?
CVE-2009-3546 has a medium severity rating due to the potential for buffer overflow or buffer over-read attacks.
How do I fix CVE-2009-3546?
To fix CVE-2009-3546, upgrade to PHP version 5.3.1 or later and ensure that you are using the latest version of the GD Graphics Library.
Which software versions are affected by CVE-2009-3546?
CVE-2009-3546 affects PHP versions 5.2.11 and 5.3.x prior to 5.3.1, as well as multiple versions of the GD Graphics Library.
What type of attacks can CVE-2009-3546 enable?
CVE-2009-3546 could enable remote attackers to conduct buffer overflow or buffer over-read attacks via crafted GD files.
Is CVE-2009-3546 still a threat today?
CVE-2009-3546 is considered a historical vulnerability but may still pose a threat if outdated software versions are in use.