CVE-2013-1899 - Improper Control of Generation of Code ('Code Injection')

Severity

65%

Complexity

80%

Confidentiality

106%

Per http://www.ubuntu.com/usn/USN-1789-1/ "A security issue affects these releases of Ubuntu and its derivatives: Ubuntu 12.10 Ubuntu 12.04 LTS Ubuntu 11.10 Ubuntu 10.04 LTS Ubuntu 8.04 LTS"

Argument injection vulnerability in PostgreSQL 9.2.x before 9.2.4, 9.1.x before 9.1.9, and 9.0.x before 9.0.13 allows remote attackers to cause a denial of service (file corruption), and allows remote authenticated users to modify configuration settings and execute arbitrary code, via a connection request using a database name that begins with a "-" (hyphen).

Per http://www.ubuntu.com/usn/USN-1789-1/ "A security issue affects these releases of Ubuntu and its derivatives: Ubuntu 12.10 Ubuntu 12.04 LTS Ubuntu 11.10 Ubuntu 10.04 LTS Ubuntu 8.04 LTS"

CVSS 2.0 Base Score 6.5. CVSS Attack Vector: network. CVSS Attack Complexity: low. CVSS Vector: (AV:N/AC:L/Au:S/C:P/I:P/A:P).

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 11 years ago

2013-04-04 17:55:00

Last updated 11 years ago

2013-12-01 04:27:00

Affected Software

PostgreSQL 9.2

9.2

PostgreSQL 9.2.1

9.2.1

PostgreSQL 9.2.2

9.2.2

PostgreSQL PostgreSQL 9.2.3

9.2.3

PostgreSQL 9.1

9.1

PostgreSQL 9.1.1

9.1.1

PostgreSQL 9.1.2

9.1.2

PostgreSQL 9.1.3

9.1.3

PostgreSQL 9.1.4

9.1.4

PostgreSQL 9.1.5

9.1.5

PostgreSQL 9.1.6

9.1.6

PostgreSQL 9.1.7

9.1.7

PostgreSQL 9.1.8

9.1.8

PostgreSQL 9.0

9.0

PostgreSQL 9.0.1

9.0.1

PostgreSQL 9.0.2

9.0.2

PostgreSQL 9.0.3

9.0.3

PostgreSQL 9.0.4

9.0.4

PostgreSQL 9.0.5

9.0.5

PostgreSQL 9.0.6

9.0.6

PostgreSQL 9.0.7

9.0.7

PostgreSQL 9.0.8

9.0.8

PostgreSQL 9.0.9

9.0.9

PostgreSQL 9.0.10

9.0.10

PostgreSQL 9.0.11

9.0.11

PostgreSQL 9.0.12

9.0.12

Canonical Ubuntu Linux 8.04 LTS (Long-Term Support)

8.04

Canonical Ubuntu Linux 10.04 LTS

10.04

Canonical Ubuntu Linux 11.10

11.10

Canonical Ubuntu Linux 12.04 LTS (Long-Term Support)

12.04

Canonical Ubuntu Linux 12.10

12.10

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.