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

Critical severity, CVSS 9.8. Actively exploited: in CISA KEV since 2022-03-25. EPSS: >99% probability of exploitation activity in the next 30 days.

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.

What to do

CISA's required action (US federal agencies, by 2022-04-15): Apply updates per vendor instructions.

The record states a fixed version for each range of affected versions. Update to the one for the range your version is in: a later release on another branch may not have the fix.

  • Apple Mac OS X, from 10.6.8, before 10.7.5: fixed in 10.7.5
  • Apple Mac OS X, from 10.8.0, before 10.8.2: fixed in 10.8.2
  • PHP, before 5.3.12: fixed in 5.3.12
  • PHP, from 5.4.0, before 5.4.2: fixed in 5.4.2

Affected products

Published 2012-05-11. Last modified 2026-06-16.