PHP vulnerabilities

CVE-2024-4577: the PHP-CGI flaw on Windows explained

CVE-2024-4577, the PHP-CGI flaw on Windows

In June 2024, a critical PHP vulnerability was exploited less than two days after the fix was released. CVE-2024-4577 only affects one specific setup, PHP in CGI mode on a Windows server, but that setup was the XAMPP default. Here you will find out whether your sites are affected, what happened and what to check.

What the vulnerability allows

According to the NVD entry, the flaw affects PHP 8.1 before 8.1.29, 8.2 before 8.2.20 and 8.3 before 8.3.8, when PHP runs in CGI mode behind Apache on Windows. An anonymous visitor can then pass command-line options to the PHP binary, which makes it possible to read the source code of scripts or to run arbitrary PHP code on the server. The CVSS 3.1 score is 9.8 out of 10, assigned by both the PHP team and NIST.

The principle fits in one sentence: Windows applies a so-called "Best-Fit" conversion to certain characters when it passes a command line to a program. With code pages 932 (Japanese), 936 (Simplified Chinese) and 950 (Traditional Chinese), a harmless-looking character is converted into a plain hyphen. PHP-CGI then takes it as the start of an option. The PHP advisory describes this behavior as a bypass of CVE-2012-1823, a 2012 flaw in the same CGI mode whose protection relied precisely on detecting that hyphen.

Researcher Orange Tsai (DEVCORE) reported it on May 7, 2024. The fixed versions were released on June 6, 2024.

Who is actually affected

The exposure condition is narrow, which is good news for most WordPress sites. The DEVCORE advisory describes two scenarios:

  • Apache configured to pass PHP files to the php-cgi executable (Action directive);
  • a php-cgi.exe or php.exe executable exposed in a CGI directory, for example through ScriptAlias. This was the default configuration of XAMPP for Windows, widely used to develop WordPress sites locally.

DEVCORE confirmed direct code execution on systems set to Traditional Chinese, Simplified Chinese and Japanese. For other languages (English, Korean, Western European languages), the advisory says it cannot yet enumerate every scenario and recommends updating in all cases. A Windows server set to French, for instance, should not be considered safe by default.

Decision tree: Windows server, PHP in CGI mode, unpatched version; if all three answers are yes, the site is exposed
ConfigurationExposed to CVE-2024-4577?Comment
Linux shared hosting (Apache, LiteSpeed, Nginx)NoThe flaw depends on a conversion specific to Windows
Linux VPS with PHP-FPMNoSame
Windows server, PHP as a module or via FastCGINo, according to the advisoryDEVCORE actually recommends migrating to mod_php, FastCGI or PHP-FPM
Windows server, Apache + PHP-CGIYes, if the version is unpatchedMain case described by DEVCORE
XAMPP for Windows (default install)Yes, if the version is unpatchedEspecially risky if the machine is reachable from the internet

The PHP 8.0, 7 and 5 branches are all affected but are no longer maintained: no fixed version exists for them. DEVCORE offered temporary Apache rewrite rules for these cases, noting that they only cover the three confirmed code pages.

Very fast exploitation

The timeline shows how quickly a published vulnerability becomes a weapon.

Timeline from May 2024 to January 2025: report, fix, first attacks, CISA catalog, fix for the bypass, 2025 campaigns
  • June 8, 2024: Imperva observes the first attacks, used to distribute the TellYouThePass ransomware.
  • June 12, 2024: CISA adds the vulnerability to its catalog of actively exploited vulnerabilities (KEV).
  • July 2024: Akamai reports attempts on its honeypots within 24 hours of disclosure, involving several malware families (remote access trojan, cryptocurrency miner).
  • September 26, 2024: PHP 8.3.12, 8.2.24 and 8.1.30 fix CVE-2024-8926, a bypass of the first fix that is possible with certain non-standard Windows code page configurations.
  • Early 2025: Cisco Talos describes a campaign against Japanese organizations (technology, telecoms, entertainment, education, e-commerce) that uses CVE-2024-4577 as its entry point. GreyNoise counts 1,089 distinct IP addresses attempting exploitation in January 2025 alone, well beyond Japan.

Six months after the fix, the vulnerability was still being actively hunted. This is the usual pattern: bots keep scanning the internet as long as unpatched servers respond.

PHP branchFixes CVE-2024-4577Also fixes CVE-2024-8926Status in October 2026
8.38.3.88.3.12Maintained (security fixes until December 31, 2027)
8.28.2.208.2.24Maintained until December 31, 2026
8.18.1.298.1.30End of life since December 31, 2025
8.0 and earlierNo fixNo fixEnd of life

Do not aim only for the minimum version that fixes this vulnerability: install the latest release of your branch. In October 2026, PHP again released critical fixes (8.5.12, 8.4.27, 8.3.36 and 8.2.35) for two other code execution flaws which, unlike this one, affect every execution mode. We cover them in detail in our article on end-of-life PHP versions.

What to check

On a production WordPress site

In the Dashboard, open Tools, Site Health, Info tab, then the Server section. There you will find the server architecture (Windows or Linux), the web server, the PHP version and the PHP SAPI, that is, the way PHP is run. On Linux, whatever the SAPI, the site is not affected. On Windows, the cgi-fcgi SAPI alone does not let you tell classic CGI from FastCGI: ask your host or your administrator how PHP is invoked, and update PHP in any case.

On your development machine

  • Update XAMPP or replace its PHP version with a fixed one.
  • If you do not need CGI mode, DEVCORE advises commenting out the ScriptAlias /php-cgi/ line in httpd-xampp.conf.
  • Make sure Apache is not listening on all network interfaces and that Windows Firewall does not expose it: a local environment should never be reachable from the internet.

If a server was exposed without the fix

Updating PHP closes the door, but it does not remove anything that may have been planted before. The campaigns described by Talos installed persistence tools (scheduled tasks, services, registry keys). Treat the machine as potentially compromised: look for unknown PHP files, added administrator accounts and suspicious scheduled tasks, and change the passwords and the keys in wp-config.php.

With WP Feint

No WordPress plugin fixes a PHP vulnerability: the only answer is to update the server. WP Feint can still help you see and verify. The bot traps count requests that probe for nonexistent paths on your site, which is useful for measuring automated scanning. With the Pro version, the integrity check compares core files against the official wordpress.org checksums, and email alerts flag a modified or added file, which helps after an exposure.

Key takeaways

  • CVE-2024-4577 affects PHP in CGI mode on Windows, including the XAMPP default: Linux hosting is not affected.
  • Fixed versions: 8.3.8, 8.2.20 and 8.1.29, then 8.3.12, 8.2.24 and 8.1.30 for the CVE-2024-8926 bypass.
  • Exploitation observed from June 8, 2024, still active in 2025.
  • PHP 8.0 and earlier have no fix: the only solution is to migrate.
  • After an exposure, updating is not enough: look for signs of compromise.

Sources

Other sources consulted: official documentation and security research publications.

Start free, go Pro when you’re ready

The free version already hides WordPress and moves the login page. Pro adds aliases, two-factor authentication and monitoring.