Bug 529213 - (CVE-2009-3546) CVE-2009-3546 gd: insufficient input validation in _gdGetColors()
CVE-2009-3546 gd: insufficient input validation in _gdGetColors()
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
impact=low,public=20091012,reported=2...
: Security
Depends On: 537908 541594 541595 541596 541597 541598 541630 541631 541632 541633 548502 647242 830745 833901
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-15 10:34 EDT by Tomas Hoger
Modified: 2016-03-04 06:40 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-03-29 05:10:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tomas Hoger 2009-10-15 10:34:08 EDT
While investigating CVE-2009-3293 (bug #524217) fixed in PHP 5.2.11, it was discovered that _gdGetColors() (in libgd/gd_gd.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.
Comment 2 Jan Lieskovsky 2009-10-20 04:47:44 EDT
MITRE's CVE-2009-3546 record:
------------------------------

The _gdGetColors function in gd_gd.c in PHP 5.2.11 and 5.3.0, 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.
Comment 4 Fedora Update System 2009-11-20 15:53:42 EST
php-5.3.1-1.fc12,maniadrive-1.2-19.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/php-5.3.1-1.fc12,maniadrive-1.2-19.fc12
Comment 8 Fedora Update System 2009-12-04 18:35:46 EST
php-5.3.1-1.fc12, maniadrive-1.2-19.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 errata-xmlrpc 2010-01-04 13:26:32 EST
This issue has been addressed in following products:

  Red Hat Enterprise Linux 4
  Red Hat Enterprise Linux 5

Via RHSA-2010:0003 https://rhn.redhat.com/errata/RHSA-2010-0003.html
Comment 11 errata-xmlrpc 2010-01-13 13:10:08 EST
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5
  Red Hat Enterprise Linux 4
  Red Hat Enterprise Linux 3

Via RHSA-2010:0040 https://rhn.redhat.com/errata/RHSA-2010-0040.html
Comment 12 Fedora Update System 2010-01-31 20:09:10 EST
php-5.2.12-1.fc11, maniadrive-1.2-17.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 13 Vincent Danen 2010-10-27 12:46:19 EDT
As noted in a Debian bug report [1], plt-scheme has an embedded copy of GD that is vulnerable to this.  I'm not sure if it's possible to make plt-scheme link to the system libgd or not (I would hope it is), but regardless this needs to be fixed.

I verified that the _gdGetColors() function exists in both F12 and F13 by searching on binary symbols:

$ ./rqp -z gdGetColors
rqp 0.6 ($Id: rqp 395 2010-10-17 04:26:14Z vdanen@ANNVIX.CA $)

Searching database records for substring match for symbols (gdGetColors)


Results in Tag: f12_i386
========================================

gd-2.0.35-9.fc12 (gd): _gdGetColors in /usr/lib/libgd.so.2.0.0
plt-scheme-4.1.2-3.fc12 (plt-scheme): _gdGetColors in /usr/lib/plt/collects/plot/compiled/native/i386-linux/libplplot.so


Results in Tag: f12_x86_64
========================================

gd-2.0.35-9.fc12 (gd): _gdGetColors in /usr/lib/libgd.so.2.0.0
gd-2.0.35-9.fc12 (gd): _gdGetColors in /usr/lib64/libgd.so.2.0.0
plt-scheme-4.1.2-3.fc12 (plt-scheme): _gdGetColors in /usr/lib64/plt/collects/plot/compiled/native/x86_64-linux/libplplot.so


Similar results in F13 and I suspect F14 and rawhide as well.

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=601525
Comment 15 Tomas Hoger 2012-06-11 06:28:38 EDT
Created gd tracking bugs for this issue

Affects: fedora-all [bug 830745]

Note You need to log in before you can comment on or make changes to this bug.