PHP < 5.3.12 / 5.4.x < 5.4.2 CGI Query String Code Execution

High Nessus Network Monitor Plugin ID 6993

Synopsis

The remote web server uses a version of PHP that is affected by a code execution vulnerability.

Description

PHP versions earlier than 5.3.12 / 5.4.2 are affected by the following vulnerabilities.

An error in the file 'sapi/cgi/cgi_main.c' can allow a remote attacker to obtain PHP source code from the web server or to potentially execute arbitrary code. In vulnerable configurations, PHP treats certain query string parameters as command line arguments including switches such as '-s', '-d', and '-c'.

Note that this vulnerability is exploitable only when PHP is used in CGI-based configurations. Apache with 'mod_php' is not an exploitable configuration.

Solution

Upgrade to PHP version 5.3.12 / 5.4.2 or later. A 'mod_rewrite' workaround is available as well.

See Also

http://eindbazen.net/2012/05/php-cgi-advisory-cve-2012-1823

https://bugs.php.net/bug.php?id=61910

http://www.php.net/archive/2012.php#id2012-05-03-1

http://www.php.net/ChangeLog-5.php#5.3.12

http://www.php.net/ChangeLog-5.php#5.4.2

Plugin Details

Severity: High

ID: 6993

File Name: 6993.prm

Family: Web Servers

Published: 2013/08/20

Modified: 2016/02/05

Dependencies: 8682, 8728

Nessus ID: 58988

Risk Information

Risk Factor: High

CVSSv2

Base Score: 8.3

Temporal Score: 6.9

Vector: CVSS2#AV:N/AC:M/Au:N/C:C/I:P/A:P

Temporal Vector: CVSS2#E:F/RL:OF/RC:C

CVSSv3

Base Score: 6.9

Temporal Score: 6.4

Vector: CVSS3#AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L

Temporal Vector: CVSS3#E:F/RL:O/RC:C

Vulnerability Information

CPE: cpe:/a:php:php

Patch Publication Date: 2012/05/03

Vulnerability Publication Date: 2012/05/03

Exploitable With

CANVAS (CANVAS)

Metasploit (PHP CGI Argument Injection)

Reference Information

CVE: CVE-2012-1823

BID: 53388