CVE-2009-3546: Buffer Overflow

Published Oct 15, 2009
·
Updated

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

16 affected componentsFixes available
Libgd GD Graphics Library=2.0.34-rc2
Libgd GD Graphics Library=2.0.33
Libgd GD Graphics Library=2.0.34-rc1
Libgd GD Graphics Library=2.0.35-rc3
Libgd GD Graphics Library=2.0.35-rc2
Libgd GD Graphics Library=2.0.35-rc1
Libgd GD Graphics Library=2.0.35
Libgd GD Graphics Library=2.0.36-rc1
Libgd GD Graphics Library=2.0.34
Libgd GD Graphics Library=2.0.35-rc5
Libgd GD Graphics Library=2.0.35-rc4
PHP PHP=5.2.11
PHP PHP=5.3.0
debian/libgd2
2.0.33-5.2etch22.0.36~rc1~dfsg-3+lenny12.0.36~rc1~dfsg-3.1
debian/libwmf<=0.2.12-5.1, <=0.2.13-1.1, <=0.2.14-1
debian/racket
5.0.2-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/libgd2 to 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
  2. Upgrade

    Upgrade debian/racket to a version that resolves this vulnerability.

    Fixed in 5.0.2-1
  3. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 5.2.11

Event History

Oct 15, 2009
Data Sourced
via Red Hat·02:34 PM
DescriptionSeverityAffected Software
Oct 19, 2009
CVE Published
via MITRE·07:27 PM
Data Sourced
via MITRE·07:27 PM
Description
Data Sourced
08:00 PM
DescriptionWeaknessAffected Software
Data Sourced
via NVD·08:00 PM
RemedyDescriptionSeverityWeaknessAffected Software
Feb 13, 2023
Data Sourced
02:20 AM
RemedySeverity

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

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.

2

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.

3

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.

4

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.

5

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.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203