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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| PHP Group | PHP | 8.1.* – < 8.1.29, 8.2.* – < 8.2.20, 8.3.* – < 8.3.8 | 8.1.29 |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Tumbleweed | php8 | 8.3.12-1.1 | openSUSE-SU-2024:14376-1 |
Alpine
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine v3.19 | php81 | 8.1.29-r0 | — |
| Alpine v3.19 | php82 | 8.2.20-r0 | — |
| Alpine v3.19 | php83 | 8.3.8-r0 | — |
Azure Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Azure Linux 3 | php | 8.3.8-1 | — |
| Azure Linux 2 (CBL-Mariner) | php | 8.1.29-1 | — |
Wolfi
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Wolfi rolling | php-8.1 | 8.1.29-r0 | — |
| Wolfi rolling | php-8.2 | 8.2.20-r0 | — |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Metasploit 1 module
-
PHP CGI Argument Injection Remote Code Execution
exploit/windows/http/php_cgi_arg_injection_rce_cve_2024_4577
Exploit-DB 1
- PHP CGI Module 8.3.4 - Remote Code Execution (RCE) EDB-52331 · webapps · Jun 15, 2025
GitHub 73 repositories · most starred shown
-
watchtowrlabs/CVE-2024-4577 ★ 325 · Jun 7, 2024
PHP CGI Argument Injection (CVE-2024-4577) Remote Code Execution PoC
-
xcanwin/CVE-2024-4577-PHP-RCE ★ 162 · Jun 8, 2024
[漏洞复现] 全球首款利用PHP默认环境(XAMPP)的CVE-2024-4577 PHP-CGI RCE 漏洞 EXP。
-
TAM-K592/CVE-2024-4577 ★ 75 · Jun 7, 2024
CVE-2024-4577 is a critical vulnerability in PHP affecting CGI configurations, allowing attackers to execute arbitrary commands via crafted URL parameters.
-
Night-have-dreams/php-cgi-Injector ★ 52 · Mar 15, 2025
一個測試CVE-2024-4577和CVE-2024-8926的安全滲透工具
-
11whoami99/CVE-2024-4577 ★ 43 · Jun 7, 2024
POC & $BASH script for CVE-2024-4577
-
Chocapikk/CVE-2024-4577 ★ 35 · Jun 9, 2024
PHP CGI Argument Injection vulnerability
-
ZephrFish/CVE-2024-4577-PHP-RCE ★ 33 · Jun 8, 2024
PHP RCE PoC for CVE-2024-4577 written in bash, go, python and a nuclei template
-
BTtea/CVE-2024-4577-RCE-PoC ★ 25 · Nov 6, 2024
CVE-2024-4577 RCE PoC
-
gh-ost00/CVE-2024-4577-RCE ★ 25 · Aug 20, 2024
PHP CGI Argument Injection (CVE-2024-4577) RCE
-
huseyinstif/CVE-2024-4577-Nuclei-Template ★ 21 · Jun 7, 2024
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Automated scanner template
A ready-made Nuclei template detects this vulnerability automatically. Vulnerabilities with public scanner templates are typically probed across the internet soon after the template appears — exposed systems should be patched first.
- PHP CGI - Argument Injection http/cves/2024/CVE-2024-4577.yaml
Source: projectdiscovery/nuclei-templates (MIT) — updated daily. Only links are listed.
Advisories 6
- WID-SEC-2024-1320 PHP: Mehrere Schwachstellen BSI CERT-Bund (WID) · Oct 21, 2026
- WID-SEC-2024-3195 Oracle Communications: Mehrere Schwachstellen BSI CERT-Bund (WID) · Aug 11, 2026
- openSUSE-SU-2024:14376-1 php8-8.3.12-1.1 on GA media SUSE / openSUSE Security Updates · Feb 4, 2026
- NCSC-2024-0414 Kwetsbaarheden verholpen in Oracle Communications NCSC-NL (Netherlands) · Oct 17, 2024
- NCSC-2024-0411 Kwetsbaarheden verholpen in Oracle Database producten NCSC-NL (Netherlands) · Oct 17, 2024
- NCSC-2024-0243 Kwetsbaarheden verholpen in PHP NCSC-NL (Netherlands) · Jun 10, 2024
References
- https://github.com/php/php-src/security/advisories/GHSA-3qgc-jrrr-25jv
- https://blog.orange.tw/2024/06/cve-2024-4577-yet-another-php-rce.html
- https://devco.re/blog/2024/06/06/security-alert-cve-2024-4577-php-cgi-argument-injection-vulnerability-en/
- https://arstechnica.com/security/2024/06/php-vulnerability-allows-attackers-to-run-malicious-code-on-windows-servers/
- https://www.imperva.com/blog/imperva-protects-against-critical-php-vulnerability-cve-2024-4577/
- https://github.com/11whoami99/CVE-2024-4577
- https://github.com/xcanwin/CVE-2024-4577-PHP-RCE
- https://github.com/rapid7/metasploit-framework/pull/19247
- https://labs.watchtowr.com/no-way-php-strikes-again-cve-2024-4577/
- https://github.com/watchtowrlabs/CVE-2024-4577
- https://www.php.net/ChangeLog-8.php#8.1.29
- https://www.php.net/ChangeLog-8.php#8.2.20
- https://www.php.net/ChangeLog-8.php#8.3.8
- https://cert.be/en/advisory/warning-php-remote-code-execution-patch-immediately
- https://isc.sans.edu/diary/30994
- http://www.openwall.com/lists/oss-security/2024/06/07/1
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PKGTQUOA2NTZ3RXN22CSAUJPIRUYRB4B/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W45DBOH56NQDRTOM2DN2LNA2FZIMC3PK/
- https://security.netapp.com/advisory/ntap-20240621-0008/