CVE-2024-4577PHP-CGI OS Command Injection Vulnerability
CVSS score
9.8
Critical
CVSS 3.1 from NVD
Exploit probability (EPSS)
100.0%
100.0% chance of exploitation in the next 30 days, higher than 100.0% of all CVEs.
CISA KEV
Actively exploited
Added to KEV on 12 Jun 2024.
US federal deadline to fix: 3 Jul 2024.
Ransomware
Official 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.
Source: NVD · CNA: security@php.net
How to fix it, step by step
Treat it as urgent
Attackers are already exploiting this flaw: CISA added it to its Known Exploited Vulnerabilities list on 12 Jun 2024.
US federal agencies must fix it by 3 Jul 2024. It's a sensible deadline for everyone else too.
CISA reports it has been used in ransomware attacks.
CISA's full instruction
Apply mitigations per vendor instructions or discontinue use of the product if mitigations are unavailable.
Check whether you're affected
Find every system running Php, fedoraproject Fedora and compare its version with the affected versions.
Update to a fixed version
- Update Php to 8.1.29, 8.2.20, 8.3.8 or later, on the branch you run.
If you can't update right away
Apply the workaround or mitigation in the vendor's advisory until you can update:
Check for signs of compromise
Updating closes the flaw but doesn't remove an attacker who got in earlier. Review affected systems for unknown accounts, unusual logins and configuration changes, and use any indicators of compromise the vendor or CISA publish.
Confirm the fix
Check that every affected system now reports a fixed version, and recheck the vendor's advisory: fixes are sometimes revised.
Was this useful?
How it can be exploited
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Values in red make the vulnerability easier to exploit or more damaging. CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Affected products
| Affected products | Versions |
|---|---|
| PHP Php | ≥ 8.1.0, < 8.1.29 · ≥ 8.2.0, < 8.2.20 · ≥ 8.3.0, < 8.3.8 |
| fedoraproject Fedora | 39 · 40 |
| PHP Group PHP | ≥ 8.1.*, < 8.1.29 · ≥ 8.2.*, < 8.2.20 · ≥ 8.3.*, < 8.3.8 · ≥ 8.1.0, < 8.1.29 · ≥ 8.2.0, < 8.2.20 · ≥ 8.3.0, < 8.3.8 |
Weakness
- CWE-78 OS command injection
Timeline
- Published:
- Added to CISA KEV:
- Last modified:
Frequently asked questions
Is CVE-2024-4577 being exploited?
Yes. CISA added CVE-2024-4577 to its Known Exploited Vulnerabilities catalog on 12 Jun 2024, which means there is evidence of exploitation in the wild. Its EPSS score estimates a 100.0% probability of exploitation in the next 30 days.
What is the CVSS score of CVE-2024-4577?
CVE-2024-4577 has a CVSS 3.1 base score of 9.8 (critical).
Which versions are affected?
PHP Php (≥ 8.1.0, < 8.1.29; ≥ 8.2.0, < 8.2.20; ≥ 8.3.0, < 8.3.8), Fedoraproject Fedora (39; 40), Php Group PHP (≥ 8.1.*, < 8.1.29; ≥ 8.2.*, < 8.2.20; ≥ 8.3.*, < 8.3.8; ≥ 8.1.0, < 8.1.29; ≥ 8.2.0, < 8.2.20; ≥ 8.3.0, < 8.3.8)
Is there a patch for CVE-2024-4577?
The official record links to vendor advisories or patches; see “What to do” above.
References
- github.com/rapid7/metasploit-framework/pull/19247(Exploit, Issue Tracking, Patch)
- arstechnica.com/security/2024/06/php-vulnerability-allows-attackers-to-run-malicious-code-on-windows-servers/(Exploit, Press/Media Coverage, Third Party Advisory)
- devco.re/blog/2024/06/06/security-alert-cve-2024-4577-php-cgi-argument-injection-vulnerability-en/(Exploit, Third Party Advisory)
- github.com/11whoami99/CVE-2024-4577(Exploit)
- github.com/php/php-src/security/advisories/GHSA-3qgc-jrrr-25jv(Exploit, Third Party Advisory)
- github.com/watchtowrlabs/CVE-2024-4577(Exploit, Third Party Advisory)
- github.com/xcanwin/CVE-2024-4577-PHP-RCE(Exploit, Third Party Advisory)
- isc.sans.edu/diary/30994(Exploit, Third Party Advisory)
- labs.watchtowr.com/no-way-php-strikes-again-cve-2024-4577/(Exploit, Third Party Advisory)
- blog.talosintelligence.com/new-persistent-attacks-japan/(Exploit, Third Party Advisory)
- www.vicarius.io/vsociety/posts/php-cgi-argument-injection-to-rce-cve-2024-4577(Exploit, Third Party Advisory)
- www.vicarius.io/vsociety/posts/php-cgi-os-command-injection-vulnerability-cve-2024-4577(Exploit, Third Party Advisory)
- www.openwall.com/lists/oss-security/2024/06/07/1(Mailing List, Third Party Advisory)
- blog.orange.tw/2024/06/cve-2024-4577-yet-another-php-rce.html(Third Party Advisory)
- cert.be/en/advisory/warning-php-remote-code-execution-patch-immediately(Third Party Advisory)
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PKGTQUOA2NTZ3RXN22CSAUJPIRUYRB4B/(Mailing List)
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W45DBOH56NQDRTOM2DN2LNA2FZIMC3PK/(Mailing List)
- security.netapp.com/advisory/ntap-20240621-0008/(Third Party Advisory)
- www.imperva.com/blog/imperva-protects-against-critical-php-vulnerability-cve-2024-4577/(Third Party Advisory)
- www.php.net/ChangeLog-8.php#8.1.29(Release Notes)
Data: NVD, CVE.org (cvelistV5), CISA KEV and FIRST EPSS. Summary written by RedCVE with AI assistance from the official data.