Skip to content
Server Security Center
KEVcritical9.8

CVE-2012-1823: PHP-CGI Query String Parameter

PHP · listed in the CISA catalog of actively exploited vulnerabilities since 2022-03-25.

CVSS v3.1 (CISA ADP)
9.8
critical
EPSS (exploit probability, 30 days)
>99.9%
among the highest 0.1% of all CVEs
Added to CISA KEV
2022-03-25
US federal due date 2022-04-15
Automatable (CISA SSVC)
yes
technical impact: total

CVE-2012-1823 explained

CVE-2012-1823 is a command injection flaw in PHP when it runs as a CGI script (php-cgi). Query strings without an equals sign are mishandled, so remote attackers can pass command-line options and execute arbitrary code. CISA lists it as known to be exploited.

Impact

An unauthenticated remote attacker can execute arbitrary code on servers running PHP in CGI mode. No user interaction is needed and attack complexity is low. Confidentiality, integrity and availability impact are all high. CISA rates the flaw as automatable, meaning attackers can exploit it at scale, with total technical impact, meaning full control of the affected component. CISA lists it as known exploited. Ransomware use is unknown.

Who is affected

The description names PHP before 5.3.12 and 5.4.x before 5.4.2 as affected when PHP is configured as a CGI script (php-cgi). The structured CVE record lists no affected versions and names no fixed version. Check the vendor's release information to confirm which release fixes the flaw on your branch.

Written with AI from the data on this page and checked against it automatically.

Official 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.

CISA required action: Apply updates per vendor instructions.

CISA notes

How to fix it

  • The CVE record names no fixed version – check CISA's required action for updates and mitigations.
  • CISA's deadline for US federal agencies: 2022-04-15 (passed) – a useful benchmark for everyone else, too.

What to do

  1. Identify all servers where PHP runs as a CGI script (php-cgi).
  2. Apply updates per vendor instructions, as CISA requires, and move off the versions named in the description.
  3. Until updated, stop exposing php-cgi directly to untrusted networks where possible.
  4. Check exposed servers for signs of compromise, such as unexpected processes, files or configuration changes.

The CVE record names no fixed version. Follow CISA's required action: apply updates per vendor instructions. Use the vendor's release information to confirm the fixed release for your PHP branch. Meanwhile, limit network exposure of php-cgi and monitor affected servers for signs of compromise.

Written with AI from the data on this page and checked against it automatically.

CISA's assessment (SSVC)

Exploitation
Exploited in the wild
Automatable
Yes – attackers can automate it at scale
Technical impact
Total – full control of the component or total information disclosure

Weakness: CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection')

Questions about CVE-2012-1823

Are all PHP installations affected?
The description limits the flaw to PHP configured as a CGI script (php-cgi), in versions before 5.3.12 and 5.4.x before 5.4.2. Other configurations are not named as affected in the facts.
Is this vulnerability exploited in the wild?
Yes. CISA added CVE-2012-1823 to its Known Exploited Vulnerabilities catalog on 2022-03-25, with a US federal due date of 2022-04-15. Whether it is used in ransomware campaigns is unknown.
Does an attacker need credentials?
No. The flaw can be exploited over the network without privileges or user interaction, and CISA rates it as automatable.

Written with AI from the data on this page and checked against it automatically.

References

Data: CISA Known Exploited Vulnerabilities (public domain) · CVE Program records incl. CISA ADP enrichment · OSV.dev (CC BY 4.0) incl. Ubuntu and Debian security data · FIRST EPSS · endoflife.date. Updated automatically – facts last changed 2026-11-22. Always confirm with the vendor's or distribution's advisory before patching.