sapi/cgi/cgi_main.c in PHP before 5.3.13 and 5.4.x before 5.4.3, when
configured as a CGI script (aka php-cgi), does not properly handle query
strings that contain a %3D sequence but no = (equals sign) character, which
allows remote attackers to execute arbitrary code by placing command-line
options in the query string, related to lack of skipping a certain
php_getopt for the 'd' case. NOTE: this vulnerability exists because of an
incomplete fix for CVE-2012-1823.
It was discovered that PHP, when used as a stand alone CGI processor
for the Apache Web Server, did not properly parse and filter query
strings. This could allow a remote attacker to execute arbitrary code
running with the privilege of the web server. Configurations using
mod_php5 and FastCGI were not vulnerable.
Please see for more details
when using configurations other than as described in
/usr/share/doc/php5-cgi/README.Debian.gz. The
article has an updated set of mod_rewrite rules that can mitigate
the vulnerability as well:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^[^=]*$
RewriteCond %{QUERY_STRING} %2d|\- [NC]
RewriteRule .? - [F,L]
Source: php5 (LP Ubuntu Debian)
Ubuntu 8.04 LTS (Hardy Heron):released (5.2.4-2ubuntu5.24)
Ubuntu 10.04 LTS (Lucid Lynx):released (5.3.2-1ubuntu4.15)
Ubuntu 11.04 (Natty Narwhal):released (5.3.5-1ubuntu7.8)
Ubuntu 11.10 (Oneiric Ocelot):released (5.3.6-13ubuntu3.7)
Ubuntu 12.04 LTS (Precise Pangolin):released (5.3.10-1ubuntu3.1)
Ubuntu 12.10 (Quantal Quetzal):released (5.3.10-1ubuntu4)
More Information

Valid XHTML 1.0 Strict

Updated: 2012-06-01 15:22:45 UTC (commit 5347)