Advisories · PHP & Laravel
CVE-2024-4577
Critical
CVSS 9.8
Actively exploited
PHP-CGI argument injection on Windows
Disclosed 2024 · Last reviewed 2 Dec 2026
On Windows, certain characters in a request can be treated as PHP command-line arguments when PHP runs as CGI. PHP-FPM and the CLI SAPI are a different setup.
What happened
Windows best-fit character conversion let an attacker smuggle arguments into the PHP CGI binary. The interpreter then honored those arguments.
Affected and patched versions
- Affected
- PHP 8.1 before 8.1.29, 8.2 before 8.2.20, and 8.3 before 8.3.8 when PHP is exposed through CGI on Windows.
- Patched
- PHP 8.1.29, 8.2.20, 8.3.8, and later.
How to check your server
Check
php -v php -i | grep -E 'Server API|PHP Version'
How to fix and harden
- Confirm the Server API. This bug applies to CGI on Windows, not to a Linux php-fpm pool.
- Upgrade PHP to 8.1.29, 8.2.20, 8.3.8, or any later release in that major.
- Prefer PHP-FPM or the official FastCGI setup over exposing php-cgi.exe.
- Restart the web server and check php -v again.
Fix
php -v
Sources
Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON