Description
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.
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 6.0 | php5 | 5.3.3-7+squeeze9 | DSA-2465-1 |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Tumbleweed | php5 | 5.6.28-1.1 | openSUSE-SU-2024:10344-1 |
| openSUSE Tumbleweed | php7 | 7.0.14-1.4 | openSUSE-SU-2024:10290-1 |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Exploit-DB 4
- Apache + PHP < 5.3.12 / < 5.4.2 - Remote Code Execution + Scanner EDB-29316 · remote · Oct 31, 2013
- Apache + PHP < 5.3.12 / < 5.4.2 - cgi-bin Remote Code Execution EDB-29290 · remote · Oct 29, 2013 · verified
- PHP < 5.3.12 / < 5.4.2 - CGI Argument Injection EDB-18836 · remote · May 5, 2012 · verified
- PHP 5.3.12/5.4.2 - CGI Argument Injection (Metasploit) EDB-18834 · remote · May 4, 2012 · verified
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Advisories 3
- DSA-2465-1 php5 - several Debian Security (DSA / DLA) · Mar 9, 2026
- openSUSE-SU-2024:10290-1 apache2-mod_php7-7.0.14-1.4 on GA media SUSE / openSUSE Security Updates · Feb 4, 2026
- openSUSE-SU-2024:10344-1 apache2-mod_php5-5.6.28-1.1 on GA media SUSE / openSUSE Security Updates · Feb 4, 2026
References
- SSRT100856 vendor-advisory
- SUSE-SU-2012:0604 vendor-advisory
- 1027022 vdb-entry
- openSUSE-SU-2012:0590 vendor-advisory
- https://bugs.php.net/patch-display.php?bug_id=61910&patch=cgi.diff-fix-check.patch&revision=1336093719&display=1
- 49014 third-party-advisory
- SUSE-SU-2012:0598 vendor-advisory
- https://bugs.php.net/bug.php?id=61910
- http://www.php.net/archive/2012.php#id2012-05-08-1
- APPLE-SA-2012-09-19-2 vendor-advisory
- http://support.apple.com/kb/HT5501
- SSRT100992 vendor-advisory
- http://eindbazen.net/2012/05/php-cgi-advisory-cve-2012-1823/
- VU#520827 third-party-advisory
- DSA-2465 vendor-advisory
- 49085 third-party-advisory
- http://www.php.net/ChangeLog-5.php#5.4.3