iDEFENSE Security Advisory 11.15.05: Multiple Vendor GTK+ gdk-pixbuf XPM Loader Heap Overflow Vulnerability

Type securityvulns
Reporter Securityvulns
Modified 2005-11-16T00:00:00


Multiple Vendor GTK+ gdk-pixbuf XPM Loader Heap Overflow Vulnerability

iDEFENSE Security Advisory 11.15.05 November 15, 2005


GTK+ is a multi-platform toolkit for creating graphical user interfaces. Offering a complete set of widgets, GTK+ is suitable for projects ranging from small one-off projects to complete application suites.


Remote exploitation of heap overflow vulnerability in various vendors' implementations of the GTK+ gdk-pixbuf XPM image rendering library could allow for arbitrary code execution.

The vulnerability specifically exists due to an integer overflow while processing XPM files. The following code snippet illustrates the vulnerability:

if (n_col <= 0 || n_col >= G_MAXINT / (cpp + 1)) { g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("XPM file has invalid number of colors")); return NULL; } [...] colors = (XPMColor *) g_try_malloc ((sizeof (XPMColor) * n_col)); [...]

The validity check of n_col is enough to prevent an integer overflow in the first g_try_malloc, however there is not a proper check for the second g_try_malloc, which allows an undersized heap buffer to be allocated, then overflowed while using n_col as an upper bounds in a copying loop. This can be used to execute arbitrary code via traditional heap overflow 4 byte write methods or by overwriting adjacent areas of the heap with important values such as function pointers.


Exploitation could allow for arbitrary code execution in the context of the user running the affected application. As this library is used in a variety of applications, this vulnerability could be exploited either remotely, via a networked application or locally.


iDEFENSE has confirmed the existence of this vulnerability in gtk+ 2.4.0 compiled from source. It is suspected that previous versions are also affected by this vulnerability. The following vendors include susceptible GTK+ and GdkPixBuf packages within their respective operating system distributions:

The Debian Project:
  Debian GNU/Linux 3.0 and 3.1 &#40;all architectures&#41;
Mandriva &#40;formerly Mandrakesoft&#41;:
  Mandriva Linux &#40;formerly Mandrakelinux&#41; 10.0 and 10.1,
  Corporate Server 3.0
Novell Inc.:
  SuSE Linux 8.2, 9.0, 9.1 and 9.2
Red Hat Inc.:
  Red Hat Enterprise Linux 2.1, 3, 4,
  Fedora Core 3, 4


Users should not open untrusted media files.


Red Hat Inc.:

"This issue affects the gtk2 packages as shipped with Red Hat Enterprise Linux 3 and 4, and the gdk-pixbuf packages as shipped with Red Hat Enterprise Linux 2.1, 3, and 4. Updates to these packages are available at the URL below or by using the Red Hat Network up2date tool.

This issue affects the gtk2 and gdk-pixbuf packages as shipped with Fedora Core 3 and 4."


The Common Vulnerabilities and Exposures (CVE) project has assigned the name CAN-2005-3186 to this issue. This is a candidate for inclusion in the CVE list (, which standardizes names for security problems.


10/12/2005 Initial vendor notification 10/14/2005 Initial vendor response 11/15/2005 Coordinated public disclosure


infamous41md is credited with the discovery of this vulnerability.

Get paid for vulnerability research

Free tools, research and upcoming events


Copyright © 2005 iDEFENSE, Inc.

Permission is granted for the redistribution of this alert electronically. It may not be edited in any way without the express written consent of iDEFENSE. If you wish to reprint the whole or any part of this alert in any other medium other than electronically, please email for permission.

Disclaimer: The information in the advisory is believed to be accurate at the time of publishing based on currently available information. Use of the information constitutes acceptance for use in an AS IS condition. There are no warranties with regard to this information. Neither the author nor the publisher accepts any liability for any direct, indirect, or consequential loss or damage arising from use of, or reliance on, this information.