What is wrong
Windows-based PHP used in CGI mode contains an OS command injection vulnerability. An attacker can exploit this flaw to execute arbitrary code on the server.
Who is affected
This vulnerability affects Windows-based PHP installations running in CGI mode for versions 8.1.0 to before 8.1.29, 8.2.0 to before 8.2.20, and 8.3.0 to before 8.3.8.
What to do
Upgrade PHP to fixed version 8.1.29, 8.2.20, or 8.3.8. If updates cannot be immediately applied, follow vendor mitigation instructions or discontinue use of the product.
Original description
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.
Known exploited (CISA KEV)
- Added to KEV
- 2024-06-12
- Remediation due (US federal)
- 2024-07-03
- Ransomware use
- Known
- Required action
- Apply mitigations per vendor instructions or discontinue use of the product if mitigations are unavailable.
Affected software
- PHP ≥ 8.1.0 < 8.1.29≥ 8.2.0 < 8.2.20≥ 8.3.0 < 8.3.8 Fixed in: 8.1.29, 8.2.20, 8.3.8 exact match
Details
- Published
- 2024-06-10
- Last modified
- 2025-10-22
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H- CWE
- CWE-78
- EPSS (30-day exploit probability)
- 99.99% (percentile 100)
References
- cve.org/CVE-2024-4577
- nvd.nist.gov/vuln/detail/CVE-2024-4577
- github.com/php/php-src/security/advisories/GHSA-3qgc-jrrr-25jv
- blog.orange.tw/2024/06/cve-2024-4577-yet-another-php-rce.html
- devco.re/blog/2024/06/06/security-alert-cve-2024-4577-php-cgi-argument-injection-vulnerabi...
- arstechnica.com/security/2024/06/php-vulnerability-allows-attackers-to-run-malicious-code-...
- www.imperva.com/blog/imperva-protects-against-critical-php-vulnerability-cve-2024-4577/
- github.com/11whoami99/CVE-2024-4577
- github.com/xcanwin/CVE-2024-4577-PHP-RCE
- github.com/rapid7/metasploit-framework/pull/19247
- labs.watchtowr.com/no-way-php-strikes-again-cve-2024-4577/
- github.com/watchtowrlabs/CVE-2024-4577
- www.php.net/ChangeLog-8.php#8.1.29
- www.php.net/ChangeLog-8.php#8.2.20
Track these versions on your own servers
InfraGuard collects installed software versions from every server and flags the ones with known vulnerabilities. Self-hosted — nothing leaves your network.
This product uses data from the NVD API but is not endorsed or certified by the NVD. CVE® is a registered trademark of The MITRE Corporation; CVE records are used under the CVE Program Terms of Use.