CVE-2024-4577PHP Group PHP
OS Command Injection in PHP-CGI on Windows
Critical 9.8 KEVRansomware No auth neededHigh EPSS
Follow: this CVE · PHP Group · PHP Group PHP We alert you by email or Slack (account required).
- Priority
- 98
- CVSS 3.1
- 9.8
- EPSS
- 94.8% probability of exploitation in 30 days · percentile 100
- Auth required
- No
- In KEV since
- Jun 12, 2024
- CISA deadline
- Jul 3, 2024
- Ransomware use
- Confirmed
- Published
- Jun 9, 2024
- Updated
- Jun 17, 2026
- Category
- Web application · Cross-platform
- Weakness (CWE)
- CWE-78
- SSVC (CISA)
- Exploitation: active · Automatable: yes · Technical impact: total
- Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
What happens
PHP versions 8.1 (before 8.1.29), 8.2 (before 8.2.20), and 8.3 (before 8.3.8) on Windows with Apache and PHP-CGI are vulnerable to OS command injection. An unauthenticated attacker can exploit Windows "Best-Fit" code page behavior to pass malicious options to the PHP binary, allowing source code disclosure or arbitrary PHP code execution. CISA confirmed this vulnerability as actively exploited.
Show the original NVD text
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.
Exploitation confirmed by CISA
PHP, specifically Windows-based PHP used in CGI mode, contains an OS command injection vulnerability that allows for arbitrary code execution. This vulnerability is a patch bypass for CVE-2012-1823.
Action required by CISA: Apply mitigations per vendor instructions or discontinue use of the product if mitigations are unavailable.
What to do
Patch available · fixed versions: 8.1.29, 8.2.20, 8.3.8
Update PHP to version 8.1.29, 8.2.20, 8.3.8 or later depending on your version branch. If you use PHP-CGI on Windows with Apache, apply the update immediately.
- Apply the vendor's security update for PHP.
- CISA has confirmed it is exploited: treat it as urgent. The deadline for US federal agencies was July 3, 2024.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
- Check logs for signs of earlier exploitation.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| php | php | ≥ 8.1.0 < 8.1.29 |
| php | php | ≥ 8.2.0 < 8.2.20 |
| php | php | ≥ 8.3.0 < 8.3.8 |
| fedoraproject | fedora | 39 |
| fedoraproject | fedora | 40 |
Official sources
References
Links published by the sources. Open them with care.
- www.openwall.com Mailing List Third Party Advisory
- arstechnica.com Exploit Press/Media Coverage Third Party Advisory
- blog.orange.tw Third Party Advisory
- cert.be Third Party Advisory
- devco.re Exploit Third Party Advisory
- github.com Exploit
- github.com Exploit Third Party Advisory
- github.com Exploit Issue Tracking Patch
- github.com Exploit Third Party Advisory
- github.com Exploit Third Party Advisory
- isc.sans.edu Exploit Third Party Advisory
- labs.watchtowr.com Exploit Third Party Advisory
- lists.fedoraproject.org Mailing List
- lists.fedoraproject.org Mailing List
- security.netapp.com Third Party Advisory
- www.imperva.com Third Party Advisory
- www.php.net Release Notes
- www.php.net Release Notes
- www.php.net Release Notes
- blog.talosintelligence.com Exploit Third Party Advisory
- www.vicarius.io Exploit Third Party Advisory
- www.vicarius.io Exploit Third Party Advisory
- www.cisa.gov US Government Resource