CVE-2009-2503 - Improper Control of Generation of Code ('Code Injection')

Severity

93%

Complexity

86%

Confidentiality

165%

GDI+ in Microsoft Internet Explorer 6 SP1, Windows XP SP2 and SP3, Windows Server 2003 SP2, Office XP SP3, Office 2003 SP3, 2007 Microsoft Office System SP1 and SP2, Office Project 2002 SP1, Visio 2002 SP2, Office Word Viewer, Word Viewer 2003 Gold and SP3, Office Excel Viewer 2003 Gold and SP3, Office Excel Viewer, Office PowerPoint Viewer 2007 Gold, SP1, and SP2, Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats SP1 and SP2, Expression Web, Expression Web 2, Groove 2007 Gold and SP1, Works 8.5, SQL Server 2000 Reporting Services SP2, SQL Server 2005 SP2 and SP3, Report Viewer 2005 SP1, Report Viewer 2008 Gold and SP1, and Forefront Client Security 1.0 does not properly allocate an unspecified buffer, which allows remote attackers to execute arbitrary code via a crafted TIFF image file that triggers memory corruption, aka "GDI+ TIFF Memory Corruption Vulnerability."

GDI+ in Microsoft Internet Explorer 6 SP1, Windows XP SP2 and SP3, Windows Server 2003 SP2, Office XP SP3, Office 2003 SP3, 2007 Microsoft Office System SP1 and SP2, Office Project 2002 SP1, Visio 2002 SP2, Office Word Viewer, Word Viewer 2003 Gold and SP3, Office Excel Viewer 2003 Gold and SP3, Office Excel Viewer, Office PowerPoint Viewer 2007 Gold, SP1, and SP2, Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats SP1 and SP2, Expression Web, Expression Web 2, Groove 2007 Gold and SP1, Works 8.5, SQL Server 2000 Reporting Services SP2, SQL Server 2005 SP2 and SP3, Report Viewer 2005 SP1, Report Viewer 2008 Gold and SP1, and Forefront Client Security 1.0 does not properly allocate an unspecified buffer, which allows remote attackers to execute arbitrary code via a crafted TIFF image file that triggers memory corruption, aka "GDI+ TIFF Memory Corruption Vulnerability."

CVSS 2.0 Base Score 9.3. CVSS Attack Vector: network. CVSS Attack Complexity: medium. CVSS Vector: (AV:N/AC:M/Au:N/C:C/I:C/A:C).

Demo Examples

Improper Control of Generation of Code ('Code Injection')

CWE-94

This example attempts to write user messages to a message file and allow users to view them.


               
}
echo "Message Saved!<p>\n";
include($MessageFile);

While the programmer intends for the MessageFile to only include data, an attacker can provide a message such as:


               
message=%3C?php%20system(%22/bin/ls%20-l%22);?%3E

which will decode to the following:


               
<?php system("/bin/ls -l");?>

The programmer thought they were just including the contents of a regular data file, but PHP parsed it and executed the code. Now, this code is executed any time people view messages.

Notice that XSS (CWE-79) is also possible in this situation.

Improper Control of Generation of Code ('Code Injection')

CWE-94

edit-config.pl: This CGI script is used to modify settings in a configuration file.


               
}
# code to add a field/key to a file goes here
# code to set key to a particular file goes here
# code to delete key from a particular file goes here
eval($code);# this is super-efficient code, especially if you have to invoke# any one of dozens of different functions!
handleConfigAction($configfile, param('action'));
print "No action specified!\n";

The script intends to take the 'action' parameter and invoke one of a variety of functions based on the value of that parameter - config_file_add_key(), config_file_set_key(), or config_file_delete_key(). It could set up a conditional to invoke each function separately, but eval() is a powerful way of doing the same thing in fewer lines of code, especially when a large number of functions or variables are involved. Unfortunately, in this case, the attacker can provide other values in the action parameter, such as: add_key(",","); system("/bin/ls"); This would produce the following string in handleConfigAction(): config_file_add_key(",","); system("/bin/ls"); Any arbitrary Perl code could be added after the attacker has "closed off" the construction of the original function call, in order to prevent parsing errors from causing the malicious eval() to fail before the attacker's payload is activated. This particular manipulation would fail after the system() call, because the "_key(\$fname, \$key, \$val)" portion of the string would cause an error, but this is irrelevant to the attack because the payload has already been activated.

Overview

First reported 15 years ago

2009-10-14 10:30:00

Last updated 6 years ago

2018-10-12 21:51:00

Affected Software

Microsoft Windows 2003 Server Service Pack 2

Microsoft Windows 2003 Server Service Pack 2 Itanium

Microsoft Windows 2003 Server Service Pack 2 x64 (64-bit)

Microsoft Windows Server 2008 Itanium

Windows Server 2008 for 32-bit Systems

Microsoft Windows Server 2008 x64 (64-bit) (intial release)

Microsoft Windows Vista

Microsoft Windows Vista x64 (64-bit)

Microsoft Windows Vista Service Pack 1 (initial release)

Microsoft Windows Vista Service Pack 1 x64 (64-bit)

Microsoft Windows XP Service Pack 2

Microsoft Windows XP Service Pack 3

Microsoft SQL Server 2005 Service Pack 2

2005

Microsoft SQL Server 2005 Service Pack 3

2005

Microsoft SQL Server 2005 Service Pack 3 Itanium

2005

Microsoft SQL Server 2005 Service Pack 3 64-bit (X64)

2005

Microsoft SQL Server Reporting Services 2000 Service Pack 2

2000

Microsoft Excel Viewer 2003

2003

Microsoft Expression Web

Microsoft Expression Web 2

2

Microsoft Office 2003 Service Pack 3

2003

Microsoft Office 2007 Service Pack 1

2007

Microsoft Office 2007 Service Pack 2

2007

Microsoft Office XP

xp

Microsoft Office Compatibility Pack 2007 Service Pack 2

2007

Microsoft Office Word Viewer

Microsoft Project 2002 sp1

2002

Microsoft Visio 2002 Service Pack 2

2002

Microsoft Word Viewer 2003

2003

Microsoft Works 8.5

8.5

Microsoft Visual Studio 2008 Service Pack 1

2008

Microsoft Visual Studio .NET 2003 SP1

2003

Microsoft Visual Studio .NET 2005 SP1

2005

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.