CVE Vulnerabilities


Improper Restriction of Operations within the Bounds of a Memory Buffer

Published: Feb 07, 2008 | Modified: Oct 15, 2018
CVSS 3.x
CVSS 2.x

Stack-based buffer overflow in the ReadImage function in tkImgGIF.c in Tk (Tcl/Tk) before 8.5.1 allows remote attackers to execute arbitrary code via a crafted GIF image, a similar issue to CVE-2006-4484.


The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.

Affected Software

Name Vendor Start Version End Version
Tcl_tk Tcl_tk 2.1 2.1
Tcl_tk Tcl_tk 3.3 3.3
Tcl_tk Tcl_tk 4.0p1 4.0p1
Tcl_tk Tcl_tk 6.1 6.1
Tcl_tk Tcl_tk 6.1p1 6.1p1
Tcl_tk Tcl_tk 6.2 6.2
Tcl_tk Tcl_tk 6.4 6.4
Tcl_tk Tcl_tk 6.5 6.5
Tcl_tk Tcl_tk 6.6 6.6
Tcl_tk Tcl_tk 6.7 6.7
Tcl_tk Tcl_tk 7.0 7.0
Tcl_tk Tcl_tk 7.1 7.1
Tcl_tk Tcl_tk 7.3 7.3
Tcl_tk Tcl_tk 7.4 7.4
Tcl_tk Tcl_tk 7.5 7.5
Tcl_tk Tcl_tk 7.5p1 7.5p1
Tcl_tk Tcl_tk 7.6 7.6
Tcl_tk Tcl_tk 7.6p2 7.6p2
Tcl_tk Tcl_tk 8.0 8.0
Tcl_tk Tcl_tk 8.0.3 8.0.3
Tcl_tk Tcl_tk 8.0.4 8.0.4
Tcl_tk Tcl_tk 8.0.5 8.0.5
Tcl_tk Tcl_tk 8.0p2 8.0p2
Tcl_tk Tcl_tk 8.1 8.1
Tcl_tk Tcl_tk 8.1.1 8.1.1
Tcl_tk Tcl_tk 8.2.0 8.2.0
Tcl_tk Tcl_tk 8.2.1 8.2.1
Tcl_tk Tcl_tk 8.2.2 8.2.2
Tcl_tk Tcl_tk 8.2.3 8.2.3
Tcl_tk Tcl_tk 8.3.0 8.3.0
Tcl_tk Tcl_tk 8.3.1 8.3.1
Tcl_tk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ise Linux 2.1 RedHat tcltk-0:8.3.3-75 *
Red Hat Enterprise Linux 3 RedHat tcltk-0:8.3.5-92.8 *
Red Hat Enterprise Linux 4 RedHat tk-0:8.4.7-3.el4_6.1 *
Red Hat Enterprise Linux 5 RedHat tk-0:8.4.13-5.el5_1.1 *
Tk8.0 Ubuntu dapper *
Tk8.3 Ubuntu dapper *
Tk8.3 Ubuntu devel *
Tk8.3 Ubuntu edgy *
Tk8.3 Ubuntu feisty *
Tk8.3 Ubuntu gutsy *
Tk8.3 Ubuntu hardy *
Tk8.3 Ubuntu intrepid *
Tk8.4 Ubuntu dapper *
Tk8.4 Ubuntu edgy *
Tk8.4 Ubuntu feisty *
Tk8.4 Ubuntu gutsy *
Tk8.4 Ubuntu hardy *
Tk8.5 Ubuntu devel *
Tk8.5 Ubuntu hardy *
Tk8.5 Ubuntu intrepid *

Extended Description

Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.

Potential Mitigations

  • Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.

  • For example, many languages that perform their own memory management, such as Java and Perl, are not subject to buffer overflows. Other languages, such as Ada and C#, typically provide overflow protection, but the protection can be disabled by the programmer.

  • Be wary that a language’s interface to native code may still be subject to overflows, even if the language itself is theoretically safe.

  • Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.

  • Examples include the Safe C String Library (SafeStr) by Messier and Viega [REF-57], and the Strsafe.h library from Microsoft [REF-56]. These libraries provide safer versions of overflow-prone string-handling functions.

  • Run or compile the software using features or extensions that automatically provide a protection mechanism that mitigates or eliminates buffer overflows.

  • For example, certain compilers and extensions provide automatic buffer overflow detection mechanisms that are built into the compiled code. Examples include the Microsoft Visual Studio /GS flag, Fedora/Red Hat FORTIFY_SOURCE GCC flag, StackGuard, and ProPolice.

  • Consider adhering to the following rules when allocating and managing an application’s memory:

  • Run or compile the software using features or extensions that randomly arrange the positions of a program’s executable and libraries in memory. Because this makes the addresses unpredictable, it can prevent an attacker from reliably jumping to exploitable code.

  • Examples include Address Space Layout Randomization (ASLR) [REF-58] [REF-60] and Position-Independent Executables (PIE) [REF-64].