cbcvebase.
CVE-2012-1823
published 2012-05-11

CVE-2012-1823: 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…

PriorityP196critical9.8CVSS 3.1
AVNACLPRNUINSUCHIHAH
KEVITWEXPLOITInitial access
CISA Known Exploited Vulnerabilitydue 2022-04-15
Exploited in the wild
EPSS
100.00%
100.0th percentile
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.

Affected

139 ranges· showing 25
VendorProductVersion rangeFixed in
applemac_os_x>= 10.6.8 < 10.7.510.7.5
applemac_os_x>= 10.8.0 < 10.8.210.8.2
debiandebian_linux
fedoraprojectfedora
fedoraprojectfedora
hphp-ux
hphp-ux
opensuseopensuse
opensuseopensuse
parallelsparallels_plesk_panel
parallelsparallels_plesk_panel
parallelsparallels_small_business_panel
phpphp< 5.3.125.3.12
phpphp<= 5.3.12
phpphp
phpphp
phpphp
phpphp
phpphp
phpphp
phpphp
phpphp
phpphp
phpphp
phpphp

Detection & IOCsextracted from sources · hover to see the quote

snort
SID 22063
snort
SID 22064
snort
SID 22097
  • Detect query strings lacking an '=' character passed to php-cgi, which allows command-line options to be injected. The '-s' flag causes source code disclosure; the '-d' flag combined with 'auto_prepend_file' enables remote code execution.
  • CVE-2012-1823 exploitation involves query strings that lack an '=' character, allowing command-line options to be injected into the PHP binary. Monitor HTTP requests to php-cgi endpoints where the query string contains flags like '-s' or '-d' without an equals sign.
  • Active exploitation of CVE-2012-1823 is observed in cryptomining campaigns. Monitor for automated scanning and exploitation attempts against PHP CGI endpoints, particularly from cloud provider IP ranges (Cloudflare, DigitalOcean, Google, Contabo).
  • ·The vulnerability only affects PHP when configured to run in CGI mode (php-cgi). Default non-CGI PHP deployments are not affected.
  • ·Snort SID 22097 is disabled in all default policies due to performance considerations and must be manually enabled for known-vulnerable installations.

CVSS provenance

nvdv3.19.8CRITICALCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
nvdv2.07.5HIGHAV:N/AC:L/Au:N/C:P/I:P/A:P
vulncheck9.8CRITICAL
cisa9.8CRITICAL
vendor_redhat9.8CRITICAL
vendor_ubuntu7.5HIGH
CVEs like this are exactly what “Exploited This Week” covers.

Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.