Bug 953902 - (CVE-2013-1978) CVE-2013-1978 gimp: XWD plugin color map heap-based buffer overflow
CVE-2013-1978 gimp: XWD plugin color map heap-based buffer overflow
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
: Security
Depends On: 955471 955472 955473 955474 1030899 1037720
Blocks: 879318
  Show dependency treegraph
Reported: 2013-04-19 09:27 EDT by Stefan Cornelius
Modified: 2016-03-04 06:06 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-12-14 14:49:24 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
proposed patch for CVE-2013-1978 (4.19 KB, patch)
2013-11-26 05:06 EST, Nils Philippsen
no flags Details | Diff
updated patch for CVE-2013-1978 (4.43 KB, patch)
2013-11-27 05:41 EST, Nils Philippsen
no flags Details | Diff

  None (edit)
Description Stefan Cornelius 2013-04-19 09:27:21 EDT
Murray McAllister of the Red Hat Security Response Team has discovered a heap-based buffer overflow in the way GIMP, the GNU Image Manipulation Program, performed loading of certain X Window System (XWD) image dumps containing a small number of color map entries but a large number of colors. A remote attacker could provide a specially-crafted XWD format image file that, when processed, would lead to gimp XWD plug-in crash or, potentially, arbitrary code execution with the privileges of the user running the gimp executable.
Comment 3 Nils Philippsen 2013-11-26 05:06:44 EST
Created attachment 829128 [details]
proposed patch for CVE-2013-1978

The attached patch checks that the number of colormap entries isn't less than the number of colors. While it's not clear if the format specification permits file with a higher number of colormap entries than colors, such files can be constructed and are readable by e.g. ImageMagick tools.
Comment 4 Nils Philippsen 2013-11-27 05:41:39 EST
Created attachment 829635 [details]
updated patch for CVE-2013-1978
Comment 5 Tomas Hoger 2013-11-27 16:50:19 EST
The problem here is that load_image() in file-xwd.c reads XWD image file header.  Header contains l_colormap_entries (number of color map entries) and l_ncolors (number of image colors).  xwdcolmap buffer used to store color map is allocated to contain space for l_colormap_entries items:


Subsequently, read_xwd_cols() is called to populate the color map buffer.


However, this function uses l_ncolors instead of l_colormap_entries as an upper bound when populating xwdcolmap.  Image specifying higher value for l_ncolors than l_colormap_entries causes gimp to overflow the heap based buffer.
Comment 6 Tomas Hoger 2013-11-27 16:52:28 EST

This issue was discovered by Murray McAllister of the Red Hat Security Response Team.
Comment 7 Vincent Danen 2013-12-03 11:29:42 EST
Created gimp tracking bugs for this issue:

Affects: fedora-all [bug 1037720]
Comment 8 errata-xmlrpc 2013-12-03 11:52:55 EST
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5
  Red Hat Enterprise Linux 6

Via RHSA-2013:1778 https://rhn.redhat.com/errata/RHSA-2013-1778.html

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