LetsDefend: PHP-CGI (CVE-2024-4577)


You will confront an attempted exploitation of a newly discovered and unpatched vulnerability (CVE-2024-XXXX) in a critical software component within your organization’s infrastructure. The CVE allows for remote code execution, posing a significant threat if successfully exploited. At 12:05 PM UTC, an alert is generated by the Intrusion Detection System (IDS) and Intrusion Prevention System (IPS), indicating an attack on one of your web servers. Your task is to analyze the provided artifacts, confirm the exploitation attempt, and answer the provided questions.


First, transfer the files to our sandbox environment and explore the types of files we can analyze.

To determine the PHP version, check the snapshot.txt file located in the PHP folder.

snapshot.txt in PHP logs is a file that provides details about the PHP build, including the version, build date, and configuration settings. It’s often used to verify the installed PHP version and environment details.

When PHP is configured to run as CGI, the Action directive in httpd.conf specifies the script handler for PHP files.

Let’s analyze the Apache server’s access logs to gather more information. These logs record client requests, including IP addresses, requested URLs, HTTP methods, and response codes, providing insights into server activity.

Since we know the CVE, let’s research it to understand exploitation techniques and payloads.

CVE-2024-4577 Exploits in the Wild One Day After Disclosure

Error Logs: If Apache is configured to log version information, it may be present in the error logs.

Correlate Apache access log timestamps with prefetch log times to identify executed commands.

First, list the prefetch logs by the latest timestamp using the following command:

ls -lt --time-style=full-iso

I couldn’t correlate the access logs and prefetch logs by date, but I found whoami.exe, a common tool used by intruders to check the accessed user. This is often a step taken after gaining access.

I also noticed calc.exe trying to mimic calculator.exe to avoid detection, which is suspicious and suggests a potential persistence technique.

CVE-2024-4577