How the Vulnerability Works
CVE-2024-4577 is a parameter injection vulnerability in PHP-CGI on Windows (CVSS 9.8). Windows' "Best-Fit" character conversion maps certain Unicode characters (such as the %AD soft hyphen) to ordinary characters; once a crafted query string passes through this conversion, the attacker's malicious parameters are injected into the php-cgi.exe command line, ultimately enabling arbitrary code execution.
Affected scope: all PHP running on Windows in PHP-CGI mode (8.1.x and earlier; fixed in 8.1.29/8.2.20/8.3.8). One-click environments like XAMPP are the hardest hit.
What an Attack Request Looks Like
Successful exploitation typically happens in two steps: probe first (to confirm the vulnerability exists), then execute. In a capture, what you're hunting for is the probe request — its signatures are unmistakable:
1. Malformed query string
The exploit request's URL carries a carefully crafted query string containing Best-Fit-convertible characters such as %AD, along with the separators used to inject CGI parameters. Legitimate business URLs never take this shape.
2. Paths pointing to php-cgi.exe
The request path or parameters directly reference php-cgi.exe (or php.exe) — a precondition of the exploit, since the attacker must specify which CGI executable to inject into.
3. Post-exploitation signatures
After the probe (if the vulnerability exists), the RCE payload lands: command output echoed back (responses to commands like whoami or systeminfo), WebShell write requests, or reverse connections.
How-to: Spotting It in a Capture
Step 1: Filter HTTP traffic and inspect request URIs. Open the capture in PcapDecoder, filter HTTP requests, and screen by URI signatures (containing php-cgi or abnormal query strings). WAF-class devices usually log hits directly; the capture serves for secondary confirmation and forensics.
Step 2: Extract HTTP hosts and URIs. PcapDecoder's HTTP extraction panel lists the Host and URI of every request, so suspicious requests are located at a glance.
Step 3: Examine source IP behavior. Confirm whether it's sporadic probing (scanner) or sustained exploitation (targeted attack). The former is background noise across the internet; the latter warrants emergency response.
Step 4: Dig into the follow-up packets. If the attack succeeded, the probe is followed by a 200 response carrying command output — the key evidence for declaring a host compromised.
Real-Sample Verification
The Malware Traffic Analysis 2024-06-11 sample captures in-the-wild exploitation of CVE-2024-4577: source IP 221.122.67.75 launches exploit attempts against internet-exposed PHP-CGI targets.
When analyzing this sample with PcapDecoder:
- The HTTP request list fully reveals the URI shape of the exploit packets — the
%ADcharacter-conversion signature and thephp-cgi.exeparameter-injection path are plainly visible; - Deep scanning flags this traffic as suspicious web attack activity, consistent with the sample's exploitation classification;
- The attack timeline reconstructs the progression of "scan → probe → exploit attempt."
The value of this sample lies in this: it shows the "standard appearance" of exploit traffic. Memorize this shape, and the next time you see similar requests in your own production captures, you'll know which alert to raise.
Response Recommendations
- Verify versions: upgrade every PHP below 8.1.29/8.2.20/8.3.8 on any Windows + PHP-CGI system;
- Check logs: search web access logs for
php-cgi+%ADcombinations and unusual query strings to confirm whether exploitation already occurred; - Temporary mitigation: if you can't patch immediately, disable CGI-related features per the official advisory or block with WAF rules;
- Compromise response: if you find evidence of successful command execution, follow your host-compromise playbook — isolate, forensicate (pcap + memory + disk image), hunt for WebShells, and assess data-exposure scope.
A generic methodology for identifying exploit traffic: watch for "abnormal request shape" (malformed URIs, unusual parameters, unfamiliar paths) + "abnormal response" (command output echoed back, unusual status-code combinations) + "abnormal source behavior" (scanning cadence, targeted persistence). If two of the three are present, escalate your response level.
Related reading: How to Identify Cobalt Strike Beacon Traffic, Detecting NetSupport RAT Traffic.
