Command injection via misescaped Windows batch arguments
Published Apr 29, 2024 · Updated Nov 4, 2025
Command injection in proc_open() in The PHP Group PHP 8.1 before 8.1.28, 8.2 before 8.2.18, and 8.3 before 8.3.5 allows attackers to execute commands. On Windows, CreateProcess implicitly invokes cmd.exe for .bat and .cmd targets, but proc_open() escapes array elements with backslashes that cmd.exe does not treat as escapes. Exploitation requires attacker-controlled arguments to reach such a batch target and runs commands with the PHP process's privileges.
Summary
What happened
Command injection in proc_open() in The PHP Group PHP 8.1 before 8.1.28, 8.2 before 8.2.18, and 8.3 before 8.3.5 allows attackers to execute commands. On Windows, CreateProcess implicitly invokes cmd.exe for .bat and .cmd targets, but proc_open() escapes array elements with backslashes that cmd.exe does not treat as escapes. Exploitation requires attacker-controlled arguments to reach such a batch target and runs commands with the PHP process's privileges.
The record
- CVE
- CVE-2024-1874
- Published
- Apr 29, 2024
- Updated
- Nov 4, 2025
- Vendor
- The PHP Group
- Product
- PHP
- Classifications
- T1059.003
- Attack vector
- network
- Privileges
- unauthenticated
Timeline
How it unfolded
- Apr 29, 2024CVE publishedPublication date reported by the CVE source.
- Nov 4, 2025Record updatedLatest update available in the CVE record.
Exploitability
Present is not the same as exploitable
Compare your product and version with the public record. A matching version still requires validation against your environment.
Is a vulnerable build present?
Compare these published version ranges with your installed build and any vendor patches.
- Affected versionversion=8.1.0
- Affected versionversion=8.1.* <8.1.28
- Affected versionversion=8.2.0
- Affected versionversion=8.2.* <8.2.18
- Affected versionversion=8.3.0
- Affected versionversion=8.3.* <8.3.5
What conditions does exploitation require?
What is affected?
Published CVSS scores
CVSS describes severity. EPSS estimates exploitation probability.
Attacks
What attackers are doing with it
Daily unique IPs observed by Shadowserver honeypots for known exploited vulnerabilities (KEVs). Missing observations do not establish an absence of attacks.
Weakness, pattern, technique
Public exploit references
- PHP proc_open Windows batch-file proof of conceptproof of concept · demonstrated
Labels summarize the accepted research assessment. They do not indicate a test against your environment.
Technologies
Your stack
See the directory against your own environment.
Your stack
Check the software in your environment
Book a demo to see how Hinoki identifies affected software and validates exploitability in your environment.
Book a demo