← Vulnerability feed

Vulnerability record · CVE-2012-1823 · published 11 May 2012

CVE-2012-1823: PHP-CGI query string option injection enables remote code execution

Php · Php

PHP versions before 5.3.12 and 5.4.x before 5.4.2, when run as a CGI script (php-cgi), mishandle query strings that lack an equals sign, allowing command-line options to be passed through the query string. This lets a remote attacker inject PHP options such as -d to alter configuration and execute arbitrary code. It matters because php-cgi deployments are directly reachable over HTTP with no authentication.

9.8 CVSS 3.1 Critical CISA KEV since 25 Mar 2022 EPSS 100% · top 0.1% CWE-77 · Command injection
9.8CVSS 3.1 base score, v2 7.5
100%EPSS exploitation probability, 30 days
YesIn CISA KEV, fix deadline passed
17Affected product versions listed by NVD
60References, 8 tagged exploit
16 Jun 2026Last modified by NVD

Description

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.

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Automated analysis

Generated by VULONE's analysis model from the NVD record, CISA KEV and EPSS data on 16 September 2026. Confidence: high.

critical priorityUnauthenticated remote code execution with a CVSS 3.1 score of 9.8, confirmed KEV listing and near-maximum EPSS probability.

What it is

PHP versions before 5.3.12 and 5.4.x before 5.4.2, when run as a CGI script (php-cgi), mishandle query strings that lack an equals sign, allowing command-line options to be passed through the query string. This lets a remote attacker inject PHP options such as -d to alter configuration and execute arbitrary code. It matters because php-cgi deployments are directly reachable over HTTP with no authentication.

Impact

An unauthenticated remote attacker can execute arbitrary code with the privileges of the web server process, leading to full host compromise, data theft or use as a pivot point.

Attack surface

Reached over the network via HTTP requests to a php-cgi endpoint; the CVSS vector shows no privileges and no user interaction required. Any exposed php-cgi configuration is directly attackable.

Exploitation

CVE-2012-1823 is listed in CISA KEV (added 2022-03-25) and has an EPSS 30-day probability of 0.99998, with reference tags marking public exploit material. Exploitation is confirmed and widespread.

What to do

  • Upgrade PHP to 5.3.12, 5.4.2 or later, or apply the vendor patch for your distribution.
  • If php-cgi cannot be patched, disable the CGI SAPI and use PHP-FPM or mod_php instead.
  • Restrict or block direct HTTP access to php-cgi binaries at the web server or reverse proxy.
  • Apply the relevant Red Hat, Debian, SUSE, Apple or HP vendor advisories for bundled PHP packages.
  • Monitor and alert on query strings containing option-like tokens such as -d or --define.

Detection

  • Search web and proxy logs for requests to php-cgi paths with query strings containing -d, -s, -r or other PHP CLI options.
  • Alert on HTTP requests whose query string lacks an equals sign but contains leading dashes.
  • Monitor web server child processes for unexpected command execution or outbound connections from the PHP process.
  • Review exposed php-cgi endpoints and confirm they are not internet-facing.

This assessment is produced automatically and is not human-reviewed. Verify against the vendor advisory before acting on it.

Exploitation in the wild

CISA added CVE-2012-1823 to the Known Exploited Vulnerabilities catalog on 25 March 2022 as "PHP-CGI Query String Parameter Vulnerability". Required action: Apply updates per vendor instructions. Federal deadline 15 April 2022.

Affected products

17 vulnerable configurations from NVD's CPE data, grouped by vendor and product.

References

LinkTags
http://eindbazen.net/2012/05/php-cgi-advisory-cve-2012-1823/ Broken LinkExploit
http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c03360041 Broken Link
http://lists.apple.com/archives/security-announce/2012/Sep/msg00004.html Mailing ListThird Party Advisory
http://lists.opensuse.org/opensuse-security-announce/2012-05/msg00002.html Mailing ListThird Party Advisory
http://lists.opensuse.org/opensuse-security-announce/2012-05/msg00007.html Mailing ListThird Party Advisory
http://lists.opensuse.org/opensuse-security-announce/2012-05/msg00011.html Mailing ListThird Party Advisory
http://marc.info/?l=bugtraq&m=134012830914727&w=2 Mailing List
http://rhn.redhat.com/errata/RHSA-2012-0546.html Third Party Advisory
http://rhn.redhat.com/errata/RHSA-2012-0547.html Third Party Advisory
http://rhn.redhat.com/errata/RHSA-2012-0568.html Third Party Advisory
http://rhn.redhat.com/errata/RHSA-2012-0569.html Third Party Advisory
http://rhn.redhat.com/errata/RHSA-2012-0570.html Third Party Advisory
http://secunia.com/advisories/49014 Broken Link
http://secunia.com/advisories/49065 Broken Link
http://secunia.com/advisories/49085 Broken Link
http://secunia.com/advisories/49087 Broken Link
http://support.apple.com/kb/HT5501 Third Party Advisory
http://www.debian.org/security/2012/dsa-2465 Third Party Advisory
http://www.kb.cert.org/vuls/id/520827 ExploitThird Party AdvisoryUS Government Resource
http://www.kb.cert.org/vuls/id/673343 Third Party AdvisoryUS Government Resource
http://www.mandriva.com/security/advisories?name=MDVSA-2012:068 Broken Link
http://www.openwall.com/lists/oss-security/2024/06/07/1 Mailing List
http://www.php.net/ChangeLog-5.php#5.4.2 ExploitPatchRelease Notes
http://www.php.net/archive/2012.php#id2012-05-03-1 Release Notes
http://www.securitytracker.com/id?1027022 Broken LinkThird Party AdvisoryVDB Entry
https://bugs.php.net/bug.php?id=61910 ExploitPatch
https://bugs.php.net/patch-display.php?bug_id=61910&patch=cgi.diff&revision=1335984315&display=1 Patch
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/PKGTQUOA2NTZ3RXN22CSAUJ Mailing ListRelease Notes
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/W45DBOH56NQDRTOM2DN2LNA Mailing ListRelease Notes
http://eindbazen.net/2012/05/php-cgi-advisory-cve-2012-1823/ Broken LinkExploit
http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c03360041 Broken Link
http://lists.apple.com/archives/security-announce/2012/Sep/msg00004.html Mailing ListThird Party Advisory
http://lists.opensuse.org/opensuse-security-announce/2012-05/msg00002.html Mailing ListThird Party Advisory
http://lists.opensuse.org/opensuse-security-announce/2012-05/msg00007.html Mailing ListThird Party Advisory
http://lists.opensuse.org/opensuse-security-announce/2012-05/msg00011.html Mailing ListThird Party Advisory
http://marc.info/?l=bugtraq&m=134012830914727&w=2 Mailing List
http://rhn.redhat.com/errata/RHSA-2012-0546.html Third Party Advisory
http://rhn.redhat.com/errata/RHSA-2012-0547.html Third Party Advisory
http://rhn.redhat.com/errata/RHSA-2012-0568.html Third Party Advisory
http://rhn.redhat.com/errata/RHSA-2012-0569.html Third Party Advisory

Track CVE-2012-1823 inside VULONE

Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.

Start free Open in platform

Related vulnerabilities

Same products first, then exploited flaws of the same weakness class.

10.0CVE-2025-32433Erlang/OTP SSH server missing authentication allows remote code executionErlang/OTP SSH servers before OTP-27.3.3, OTP-26.2.5.11 and OTP-25.3.2.20 mishandle SSH protocol messages, letting an unauthenticated attacker execut…KEVEPSS 99%analysed10.0CVE-2025-24201Apple WebKit out-of-bounds write allows sandbox escapeCVE-2025-24201 is an out-of-bounds write in Apple's WebKit that was addressed with improved checks. Maliciously crafted web content may break out of …KEVEPSS 3.8%analysed10.0CVE-2021-44228Apache Log4j2 JNDI lookup remote code executionApache Log4j2 versions 2.0-beta9 through 2.15.0 (excluding 2.12.2, 2.12.3, and 2.3.1) do not protect against attacker-controlled LDAP and other JNDI …KEVEPSS 100%analysed9.8CVE-2026-24061GNU Inetutils telnetd argument injection allows remote auth bypasstelnetd in GNU Inetutils through 2.7 fails to sanitize the USER environment variable, so a value such as "-f root" is passed as an argument to login …KEVEPSS 99%analysed9.8CVE-2025-39682Linux kernel TLS zero-length record handling flaw on rx_listThe Linux kernel TLS receive path mishandles zero-length records that arrive from the rx_list, breaking the assumption that a record type change cann…KEVEPSS 2.9%analysed9.8CVE-2025-24813Apache Tomcat Default Servlet path equivalence enables RCE and file disclosureApache Tomcat mishandles path equivalence for names containing an internal dot, letting a remote unauthenticated attacker write files through the Def…KEVEPSS 100%analysed9.8CVE-2024-9680Mozilla Firefox and Thunderbird use-after-free in Animation timelinesA use-after-free flaw in Animation timelines allows an attacker to execute code in the content process of Firefox and Thunderbird. Mozilla reports ex…KEVEPSS 23%analysed9.8CVE-2024-4577PHP-CGI on Windows argument injection leads to remote code executionPHP-CGI on Windows can misinterpret characters in the command line passed to Win32 API functions when certain code pages are configured, due to Windo…KEVEPSS 100%analysed

Source: NIST National Vulnerability Database (record CVE-2012-1823), CISA KEV, FIRST EPSS (scores of 2026-09-16). This page is refreshed as NVD updates the record.