CVE-2011-2896: Buffer Overflow

Published Aug 3, 2011
·
Updated

GIF image file format readers in various open source projects are based on the GIF decoder implementation written by David Koblas. This implementation contains a bug in the LZW decompressor, causing it to in correctly handle compressed streams that contain code words that were not yet added to the decompression table. LZW decompression has a special case (a KwKwK string) when code word may match the first free entry in the decompression table. The implementation used in this GIF reading code allows code words not only matching, but also exceeding the first free entry.

This problem is identical to a bug found in BSD compress (CVE-2011-2895, bug #727624), but given the unclear relationship between BSD compress and GIF decoder code bases, separate CVE is used here.

Several projects refer to pbmplus as the source form where GIF reading code was taken:

http://www.acme.com/software/pbmplus/

In pbmplus version of the code, the flaw can be found in LWZReadByte():

if (code >= maxcode) { sp++ = firstcode; code = oldcode; }

This allows creating a loop in the decompression table, which leads to an "infinite" loop:

while (code >= clearcode) { sp++ = table[1][code]; if (code == table[0][code]) pmerror("circular table entry BIG ERROR"); code = table[0][code]; }

where:

#define MAXLWZBITS 12 static int table[2][(1<< MAXLWZBITS)]; static int stack[(1<<(MAXLWZBITS))2], sp; sp = stack;

This results in stack[] buffer overflow. If table[][] is located above stack[], stack[] overflow may further modify decoding table and break infinite loop.

Other sources

The LZW decompressor in the LWZReadByte function in giftoppm.c in the David Koblas GIF decoder in PBMPLUS, as used in the gifreadlzw function in filter/image-gif.c in CUPS before 1.4.7, the LZWReadByte function in plug-ins/common/file-gif-load.c in GIMP 2.6.11 and earlier, the LZWReadByte function in img/gifread.c in XPCE in SWI-Prolog 5.10.4 and earlier, and other products, does not properly handle code words that are absent from the decompression table when encountered, which allows remote attackers to trigger an infinite loop or a heap-based buffer overflow, and possibly execute arbitrary code, via a crafted compressed stream, a related issue to CVE-2006-1168 and CVE-2011-2895.

MITRE

Affected Software

3 affected components
SWI-Prolog SWI-Prolog<=5.10.4
Apple CUPS<=1.4.6
GIMP GIMP<=2.6.11

Event History

Aug 3, 2011
Data Sourced
via Red Hat·09:22 AM
DescriptionSeverityAffected Software
Aug 19, 2011
CVE Published
via MITRE·05:00 PM
Data Sourced
via MITRE·05:00 PM
Description

Frequently Asked Questions

1

What is the severity of CVE-2011-2896?

CVE-2011-2896 is classified with medium severity due to its potential to cause denial of service in affected applications.

2

How do I fix CVE-2011-2896?

To mitigate CVE-2011-2896, you should upgrade affected software such as SWI-Prolog, CUPS, or GIMP to the latest patched versions.

3

Which applications are affected by CVE-2011-2896?

CVE-2011-2896 affects applications like SWI-Prolog up to version 5.10.4, CUPS up to version 1.4.6, and GIMP up to version 2.6.11.

4

What type of vulnerability is CVE-2011-2896?

CVE-2011-2896 is a vulnerability in the GIF image file format decoder that leads to improper handling of compressed streams.

5

Is CVE-2011-2896 exploitable remotely?

Yes, CVE-2011-2896 can be exploited remotely if an impacted software processes a specially crafted GIF image.

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