PHP2Shell Attacks: Reproducing the Exploit and Detecting Threats with AhnLab EDR/XDR
AhnLab Reproduces Remote Command Execution via PHP2Shell and Outlines EDR/XDR-Based Detection and Response
CVE-2026-109618 and CVE-2026-109619 are critical remote code execution (RCE) vulnerabilities in PHP that could allow unauthenticated attackers to execute arbitrary code remotely. If exploited, these vulnerabilities could enable attackers to execute commands on web servers and carry out additional malicious activities.
AhnLab conducted a PHP2Shell reproduction test using publicly available proof-of-concept (PoC) code as a reference. The test confirmed that the target server established a connection to the attacker's system, allowing the attacker to execute commands with the privileges of the server's web service account.
Based on this analysis, AhnLab also introduced methods for detecting and responding to suspicious activities in PHP services, including abnormal process execution and file creation, using AhnLab EDR/XDR.
1. PHP2Shell Vulnerabilities: Remote Code Execution Risks Arising from Different Root Causes
CVE-2026-109618 and CVE-2026-109619, collectively known as PHP2Shell, are vulnerabilities that arise during PHP's internal request processing. Both vulnerabilities can lead to unauthenticated remote code execution, although their underlying causes differ.
| Category | CVE-2026-109618 | CVE-2026-109619 |
|---|---|---|
| Vulnerability Type | Data corruption during out-of-memory handling | Reuse of internal state associated with freed memory |
| Root Cause | Request processing may be interrupted by an out-of-memory condition before request data is fully initialized, potentially causing invalid data to be treated as valid during subsequent cleanup. | Internal state used during request processing may persist after its associated memory has been freed and be reused by a subsequent request before proper initialization. |
| Potential Impact | Unauthenticated remote code execution | Unauthenticated remote code execution |
| Severity | CVSS v4.0 9.2 | CVSS v4.0 9.2 |
Table 1. Comparison of PHP2Shell Vulnerabilities
Figure 1. PHP2Shell Vulnerability Exploitation Process
Both vulnerabilities stem from issues in PHP's internal processing. Successful exploitation could allow attackers to execute arbitrary commands on servers running PHP-based web services.
Therefore, in addition to applying security fixes for the vulnerabilities, it is important to monitor PHP services for abnormal activities.
2. PHP2Shell Reproduction Test Confirms Remote Command Execution on a Web Server
AhnLab reproduced a PHP2Shell attack using publicly available PoC code as a reference and examined the activities observed on both the attacker's system and the victim server.
The test began by identifying the IP addresses of the attacker and victim server. The attacker then executed a test script targeting a PHP website, which caused the victim server to establish a connection to the attacker's system.
Through this connection, the attacker was able to access a command shell on the victim server from their own system. The test also confirmed that commands were executed with the privileges of the web service account, www-data. The attacker further verified the connection to the victim server by checking its IP address.
| Timestamp | Reproduction Test Activity |
|---|---|
| 0–6 sec | Verify the IP addresses of the attacker and victim server |
| 6–16 sec | Execute a test script targeting the PHP website |
| 16–20 sec | The victim server connects to the attacker's system, enabling command shell access |
| 20–23 sec | Confirm that commands are executed with web service account (www-data) privileges |
| 23–29 sec | Verify the victim server's IP address to confirm successful access |
Table 2. Key Steps in the PHP2Shell Reproduction Test
A key finding from the reproduction test was that the victim server established a connection to the attacker's system, allowing commands to be executed with web service account privileges.
This demonstrates that successful exploitation can go beyond triggering web requests or errors, potentially enabling attackers to execute commands of their choosing on the server.
PHP2Shell Defacement Attack Scenario
The following video demonstrates a defacement attack scenario in which an attacker exploits PHP2Shell to replace the website's main page with a different page.
Watch the PHP2Shell Defacement Attack Video →Analyzing Attack Activity Through the Process Tree
AhnLab also published the process tree observed during the reproduction test.
A process tree illustrates the parent-child relationships between processes. Security administrators can use this information to identify which process initiated a particular command and which programs were subsequently executed.
In remote code execution attacks such as PHP2Shell, abnormal commands may be executed through processes associated with PHP services. Examining process execution relationships within web services is therefore an important part of investigating potential attacks.
Figure 2. Process Tree Observed During the PHP2Shell Reproduction Test
By analyzing these process execution details, administrators can investigate whether commands executed within PHP services are part of normal operations or potentially related to an external attack.
However, the execution of a particular process or command alone does not necessarily confirm an attack. Related events and process execution relationships must also be examined.
3. Detecting Malicious Activity with AhnLab EDR/XDR
Attackers exploiting PHP2Shell vulnerabilities may carry out malicious activities through PHP processes.
Considering these attack characteristics, AhnLab identified suspicious command execution, web shell creation and execution, abnormal file creation, and permission changes within PHP services as key monitoring targets.
AhnLab EDR/XDR detects related suspicious activities as threats or key events, helping security administrators identify root causes and establish appropriate response measures and procedures to prevent similar incidents.
AhnLab EDR: Endpoint Threat Detection and Response
AhnLab EDR (Endpoint Detection and Response) is a security solution that monitors activities across endpoints, including servers and PCs, to detect, analyze, and respond to advanced threats.
Powered by AhnLab's proprietary behavior analysis engine, the solution detects suspicious process execution and file activities while analyzing relationships between related behaviors to help identify the root causes of attacks. Its AI-powered analysis feature, AI Insight, also provides threat context and recommended response measures.
For attacks such as PHP2Shell, AhnLab EDR can help administrators identify abnormal command execution or file creation associated with PHP services and analyze process execution relationships.
AhnLab XDR: Correlated Threat Analysis and Response Across Multiple Security Domains
AhnLab XDR (Extended Detection and Response) is a security solution that collects and correlates data from multiple security domains, including endpoints, to support threat detection and response.
The solution correlates logs from heterogeneous security solutions with user and asset information, assesses the risk levels of detected threats, and helps security administrators prioritize their responses. Integration with AhnLab EDR, AhnLab TIP, and other security solutions also provides additional information for threat analysis.
In web server attacks such as PHP2Shell, AhnLab XDR can correlate suspicious endpoint activities with other security data to help administrators assess risks across their organization.
Key Monitoring Areas for PHP2Shell Attacks
AhnLab identified the following key monitoring areas in its analysis:
- Detection of Abnormal Behavior in PHP Processes: Identify suspicious command execution and process activities associated with PHP services.
- Detection of Web Shell Creation and Execution: Identify suspicious files created or executed on web servers.
- Monitoring of Suspicious File Creation and Permission Changes: Identify abnormal file activities that may occur during an attack.
EDR focuses on analyzing suspicious endpoint activities and process execution relationships, while XDR correlates data from multiple security domains to provide broader threat context and support response prioritization.
4. AhnLab EDR/XDR Detection Names for PHP2Shell
AhnLab published seven AhnLab EDR/XDR detection names that can be used to identify suspicious activities associated with PHP2Shell.
| Detection Name | Category |
|---|---|
| Suspicious/MDP.Behavior.M12823 | Suspicious behavior |
| InitialAccess/EDR.Event.M13289 | Initial access-related event |
| InitialAccess/EDR.Event.M13291 | Initial access-related event |
| InitialAccess/EDR.Event.M13361 | Initial access-related event |
| InitialAccess/DETECT.Upload.M13367 | Upload-related detection |
| InitialAccess/EDR.Upload.M13395 | Upload-related detection |
| InitialAccess/DETECT.Event.M11450 | Initial access-related event |
Table 3. AhnLab EDR/XDR Detection Names Related to PHP2Shell
The following screenshot shows events detected by AhnLab EDR on the target PHP server during the execution of the PHP2Shell PoC.
Figure 3. AhnLab EDR Detection Events on the Target PHP Server During PHP2Shell PoC Execution
Security administrators can use these detection events to identify suspicious activities within PHP services, such as abnormal command execution or file creation.
When threat events associated with PHP services occur, it is particularly important to investigate related processes and file activities to determine whether they are connected to an attack.
However, individual detection names alone cannot definitively confirm a PHP2Shell attack or guarantee detection of every attack variant.
5. PHP2Shell Mitigation: Combining Security Updates with Attack Activity Analysis
The primary mitigation for PHP2Shell vulnerabilities is to apply the patched versions released by the PHP Security Team.
The PHP Security Team released security updates for PHP versions 8.2 through 8.5 and recommended that affected users update their installations promptly.
| PHP Version Series | Patched Version |
|---|---|
| PHP 8.5 | 8.5.12 |
| PHP 8.4 | 8.4.27 |
| PHP 8.3 | 8.3.36 |
| PHP 8.2 | 8.2.35 |
Table 4. Security Update Versions for PHP2Shell Vulnerabilities
After applying the updates, web services must be restarted for the changes to take effect. Organizations unable to update immediately may consider the official temporary mitigation measures provided by the PHP Security Team.
However, regardless of whether the vulnerabilities have been patched, organizations should also examine related activities in environments where an attack may have already occurred or where exploitation is suspected.
During AhnLab's reproduction test, the target server established a connection to the attacker's system, and commands were executed with web service account privileges.
AhnLab EDR/XDR supports the detection of suspicious activities associated with PHP services, including abnormal command execution, web shell creation and execution, suspicious file creation, and permission changes, helping security administrators investigate root causes and respond to potential threats.
Organizations should prioritize applying official security updates while reviewing relevant detection events. When suspicious activities are identified, administrators should investigate their causes and establish appropriate response measures and procedures to prevent similar incidents.
References
- AhnLab, "Reproducing the PHP2Shell Vulnerability and Detection Using AhnLab EDR/XDR"
https://asec.ahnlab.com/en/95956/ - PHP Official Security Updates
https://www.php.net/archive/2026.php#2026-10-21-5
- AhnLab