PHP up to 5.3.12/5.4.2 sapi/cgi/cgi_main.c $_SERVER['QUERY_STRING'] command injection
| CVSS Meta Temp Score | Current Exploit Price (≈) | CTI Interest Score |
|---|---|---|
| 8.4 | $0-$5k | 0.00 |
Summary
A vulnerability classified as very critical has been found in PHP up to 5.3.12/5.4.2. The affected element is an unknown function of the file sapi/cgi/cgi_main.c. Performing a manipulation of the argument $_SERVER['QUERY_STRING'] with the input -s results in input validation.
This vulnerability is cataloged as CVE-2012-1823. It is possible to initiate the attack remotely. Furthermore, there is an exploit available. Due to its background and reception, this vulnerability has an historic impact.
It is recommended to upgrade the affected component.
Details
A vulnerability classified as very critical has been found in PHP up to 5.3.12/5.4.2 (Programming Language Software). This affects some unknown processing of the file sapi/cgi/cgi_main.c. The manipulation of the argument $_SERVER['QUERY_STRING'] with the input value -s leads to a input validation vulnerability. CWE is classifying the issue as CWE-77. The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. This is going to have an impact on confidentiality, integrity, and availability. The summary by CVE is:
sapi/cgi/cgi_main.c in PHP before 5.3.12 and 5.4.x before 5.4.2, when configured as a CGI script (aka php-cgi), does not properly handle query strings that lack an = (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.
The bug was discovered 01/13/2012. The weakness was shared 05/03/2012 by De Eindbazen as confirmed blog post (Website). It is possible to read the advisory at eindbazen.net. The vendor cooperated in the coordination of the public release. This vulnerability is uniquely identified as CVE-2012-1823 since 03/21/2012. It is possible to initiate the attack remotely. No form of authentication is needed for exploitation. Technical details and a public exploit are known. The pricing for an exploit might be around USD $0-$5k at the moment (estimation calculated on 11/04/2025). The attack technique deployed by this issue is T1202 according to MITRE ATT&CK. Due to its background and reception, this vulnerability has a historic impact.
A public exploit has been developed by metasploit (rayh4c) in C and been published 1 days after the advisory. The exploit is shared for download at exploit-db.com. It is declared as attacked. The vulnerability was handled as a non-public zero-day exploit for at least 111 days. During that time the estimated underground price was around $25k-$100k. The vulnerability scanner Nessus provides a plugin with the ID 74630 (openSUSE Security Update : php5 (openSUSE-2012-288)), which helps to determine the existence of the flaw in a target environment. It is assigned to the family SuSE Local Security Checks and running in the context l. The commercial vulnerability scanner Qualys is able to test this issue with plugin 185005 (HP-UX Apache Web Server Running PHP Denial of Service Vulenrability (HPSBUX02791)). The CISA Known Exploited Vulnerabilities Catalog lists this issue since 03/25/2022 with a due date of 04/15/2022:
Apply updates per vendor instructions.Upgrading to version 5.4.2 or 5.3.12 [first official Patch not working!] eliminates this vulnerability. Applying the patch CVE-2012-1823-mitigation.tar.gz (inofficial Patch) is able to eliminate this problem. The bugfix is ready for download at eindbazen.net.It is possible to mitigate the weakness by firewalling tcp/80 (Web Services). The problem might be mitigated by replacing the product with FastCGI & ASP as an alternative. The best possible mitigation is suggested to be upgrading to the latest version. A possible mitigation has been published immediately after the disclosure of the vulnerability. Attack attempts may be identified with Snort ID 22063.
The vulnerability is also documented in the databases at Exploit-DB (18834), Tenable (74630), OSVDB (81633†), Secunia (SA49014†) and SecurityTracker (ID 1027022†). Further details are available at kb.cert.org. The entries VDB-4600, VDB-9012, VDB-60825 and VDB-60732 are related to this item. Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.
Product
Type
Name
Version
License
Website
- Product: https://www.php.org/
CPE 2.3
CPE 2.2
Screenshot

Video

CVSSv4
VulDB Vector: 🔍VulDB Reliability: 🔍
CVSSv3
VulDB Meta Base Score: 8.5VulDB Meta Temp Score: 8.4
VulDB Base Score: 7.3
VulDB Temp Score: 7.0
VulDB Vector: 🔍
VulDB Reliability: 🔍
NVD Base Score: 9.8
NVD Vector: 🔍
CVSSv2
| AV | AC | Au | C | I | A |
|---|---|---|---|---|---|
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| Vector | Complexity | Authentication | Confidentiality | Integrity | Availability |
|---|---|---|---|---|---|
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
VulDB Base Score: 🔍
VulDB Temp Score: 🔍
VulDB Reliability: 🔍
NVD Base Score: 🔍
Exploiting
Class: Command injectionCWE: CWE-77 / CWE-74 / CWE-707
CAPEC: 🔍
ATT&CK: 🔍
Physical: No
Local: No
Remote: Yes
Availability: 🔍
Access: Public
Status: Attacked
Author: metasploit (rayh4c)
Reliability: 🔍
Programming Language: 🔍
Download: 🔍
EPSS Score: 🔍
EPSS Percentile: 🔍
KEV Added: 🔍
KEV Due: 🔍
KEV Remediation: 🔍
KEV Ransomware: 🔍
KEV Notice: 🔍
Price Prediction: 🔍
Current Price Estimation: 🔍
| 0-Day | Unlock | Unlock | Unlock | Unlock |
|---|---|---|---|---|
| Today | Unlock | Unlock | Unlock | Unlock |
Nessus ID: 74630
Nessus Name: openSUSE Security Update : php5 (openSUSE-2012-288)
Nessus File: 🔍
Nessus Risk: 🔍
Nessus Family: 🔍
Nessus Context: 🔍
Nessus Port: 🔍
OpenVAS ID: 71344
OpenVAS Name: Debian Security Advisory DSA 2465-1 (php5)
OpenVAS File: 🔍
OpenVAS Family: 🔍
Saint ID: exploit_info/php_cgi_arg_rce
Saint Name: PHP CGI Query String Parameters Command Execution
Qualys ID: 🔍
Qualys Name: 🔍
MetaSploit ID: php_cgi_arg_injection.rb
MetaSploit Name: PHP CGI Argument Injection
MetaSploit File: 🔍
Exploit-DB: 🔍
Threat Intelligence
Interest: 🔍Active Actors: 🔍
Active APT Groups: 🔍
Countermeasures
Recommended: UpgradeStatus: 🔍
Reaction Time: 🔍
0-Day Time: 🔍
Exposure Time: 🔍
Exploit Delay Time: 🔍
Upgrade: PHP 5.4.2/5.3.12 [first official Patch not working!]
Patch: CVE-2012-1823-mitigation.tar.gz (inofficial Patch)
Firewalling: 🔍
Alternative: FastCGI & ASP
Snort ID: 22063
Snort Message: SERVER-WEBAPP PHP-CGI remote file include attempt
Snort Class: 🔍
Suricata ID: 2014704
Suricata Class: 🔍
Suricata Message: 🔍
Timeline
01/13/2012 🔍01/17/2012 🔍
03/21/2012 🔍
05/03/2012 🔍
05/03/2012 🔍
05/04/2012 🔍
05/04/2012 🔍
05/04/2012 🔍
05/04/2012 🔍
05/11/2012 🔍
06/13/2014 🔍
11/04/2025 🔍
Sources
Product: php.orgAdvisory: eindbazen.net
Researcher: De Eindbazen
Status: Confirmed
Confirmation: 🔍
Coordinated: 🔍
CVE: CVE-2012-1823 (🔍)
GCVE (CVE): GCVE-0-2012-1823
GCVE (VulDB): GCVE-100-5319
OVAL: 🔍
CERT: 🔍
Secunia: 49014
OSVDB: 81633 - CVE-2012-1823 - PHP - Code Execution Issue
SecurityTracker: 1027022
scip Labs: https://www.scip.ch/en/?labs.20161013
Misc.: 🔍
See also: 🔍
Entry
Created: 05/04/2012 12:16Updated: 11/04/2025 20:23
Changes: 05/04/2012 12:16 (117), 07/30/2019 18:59 (1), 04/24/2024 08:29 (29), 06/10/2024 20:46 (1), 07/16/2024 22:47 (11), 09/09/2024 22:29 (1), 12/24/2024 02:17 (1), 01/06/2025 21:33 (1), 11/04/2025 20:23 (1)
Complete: 🔍
Cache ID: 216:D2B:103
No comments yet. Languages: en.
Please log in to comment.