CVE-2024-1874
published 2024-04-29CVE-2024-1874: In PHP versions 8.1.* before 8.1.28, 8.2.* before 8.2.18, 8.3.* before 8.3.5, when using proc_open() command with array syntax, due to insufficient escaping…
PriorityP275critical9.4CVSS 3.1
AVNACLPRNUINSUCHIHAL
EPSS
32.57%
98.1th percentile
In PHP versions 8.1.* before 8.1.28, 8.2.* before 8.2.18, 8.3.* before 8.3.5, when using proc_open() command with array syntax, due to insufficient escaping, if the arguments of the executed command are controlled by a malicious user, the user can supply arguments that would execute arbitrary commands in Windows shell.
Affected
22 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| debian | php7.4 | — | — |
| debian | php8.2 | — | — |
| fedoraproject | fedora | — | — |
| fedoraproject | fedora | — | — |
| msrc | azl3_php_8.3.6-1_on_azure_linux_3.0 | — | — |
| msrc | azl3_php_8.3.8-1_on_azure_linux_3.0 | — | — |
| msrc | azure_linux_3.0_arm | — | — |
| msrc | azure_linux_3.0_x64 | — | — |
| msrc | cbl2_php_8.1.22-2_on_cbl_mariner_2.0 | — | — |
| msrc | cbl2_php_8.1.28-1_on_cbl_mariner_2.0 | — | — |
| msrc | cbl2_php_8.1.29-1_on_cbl_mariner_2.0 | — | — |
| msrc | cbl_mariner_2.0_arm | — | — |
| msrc | cbl_mariner_2.0_x64 | — | — |
| php | php | >= 8.1.0 < 8.1.29 | 8.1.29 |
| php | php | >= 8.1.0 < 8.1.28 | 8.1.28 |
| php | php | >= 8.2.0 < 8.2.20 | 8.2.20 |
| php | php | >= 8.2.0 < 8.2.18 | 8.2.18 |
| php | php | >= 8.3.0 < 8.3.8 | 8.3.8 |
| php | php | >= 8.3.0 < 8.3.5 | 8.3.5 |
| php_group | php | >= 8.1.* < 8.1.29 | 8.1.29 |
| php_group | php | >= 8.2.* < 8.2.20 | 8.2.20 |
| php_group | php | >= 8.3.* < 8.3.8 | 8.3.8 |
Detection & IOCsextracted from sources · hover to see the quote
- →Exploitation targets PHP's proc_open() when called with array syntax on Windows; monitor for proc_open() calls where command arguments contain shell metacharacters or batch-file injection sequences (e.g., '&', '|', ';', '%', '^') passed as array elements. ↗
- →The bypass of the CVE-2024-1874 fix is triggered specifically when the command name includes trailing spaces; detection logic should flag proc_open() array-syntax calls where the first element (command name) has trailing whitespace. ↗
- →Exploitation is exclusive to Windows environments and leverages the implicit use of cmd.exe by the CreateProcess function when executing batch files; alert on PHP processes spawning cmd.exe with batch file arguments on Windows hosts. ↗
- ·Vulnerability is Windows-only; Linux/Unix PHP deployments are not affected by this command injection vector. ↗
- ·Affected PHP versions for the original CVE-2024-1874: 8.1.* before 8.1.28, 8.2.* before 8.2.18, 8.3.* before 8.3.5. The bypass (CVE-2024-5585) extends affected ranges to 8.1.* before 8.1.29, 8.2.* before 8.2.20, 8.3.* before 8.3.8. ↗
- ·No Red Hat Enterprise Linux products are affected by this CVE across all supported PHP streams. ↗
CVSS provenance
nvdv3.19.4CRITICALCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L
vendor_debian9.4LOW
vendor_msrc9.4CRITICAL
vendor_redhat9.4CRITICAL
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
Microsoft
Command injection via array-ish $command parameter of proc_open() (bypass CVE-2024-1874 fix)
vendor_msrc·2024-06-11·CVSS 8.8
CVE-2024-5585 [CRITICAL] CWE-116 Command injection via array-ish $command parameter of proc_open() (bypass CVE-2024-1874 fix)
Command injection via array-ish $command parameter of proc_open() (bypass CVE-2024-1874 fix)
FAQ: Is Azure Linux the only Microsoft product that includes this open-source library and is therefore potentially affected by this vulnerability?
One of the main benefits to our customers who choose to use the Azure Linux distro is the commitment to keep it up to date with the most recent and most secure versions of the open source libraries with which the distro is composed. Microsoft is committed to transparency in this work which is why we began publishing CSAF/VEX in October 2025. See this blog post for more information. If impact to additional products is identified, we will update the CVE to reflect this.
Mariner: Mariner
php: php
Customer Action Required: Yes
Remediation: CBL-Mariner R
Red Hat
php: Arguments execute arbitrary commands in Windows shell
vendor_redhat·2024-06-07·CVSS 9.4
CVE-2024-5585 [CRITICAL] CWE-78 php: Arguments execute arbitrary commands in Windows shell
php: Arguments execute arbitrary commands in Windows shell
In PHP versions 8.1.* before 8.1.29, 8.2.* before 8.2.20, 8.3.* before 8.3.8, the fix for CVE-2024-1874 does not work if the command name includes trailing spaces. Original issue: when using proc_open() command with array syntax, due to insufficient escaping, if the arguments of the executed command are controlled by a malicious user, the user can supply arguments that would execute arbitrary commands in Windows shell.
In PHP, the fix for CVE-2024-1874 does not work if the command name includes trailing spaces. Original issue: when using proc_open() command with array syntax, due to insufficient escaping, if the arguments of the executed command are controlled by a malicious user, the user can supply arguments that would execute
Microsoft
Command injection via array-ish $command parameter of proc_open()
vendor_msrc·2024-04-09·CVSS 9.4
CVE-2024-1874 [CRITICAL] CWE-116 Command injection via array-ish $command parameter of proc_open()
Command injection via array-ish $command parameter of proc_open()
FAQ: Is Azure Linux the only Microsoft product that includes this open-source library and is therefore potentially affected by this vulnerability?
One of the main benefits to our customers who choose to use the Azure Linux distro is the commitment to keep it up to date with the most recent and most secure versions of the open source libraries with which the distro is composed. Microsoft is committed to transparency in this work which is why we began publishing CSAF/VEX in October 2025. See this blog post for more information. If impact to additional products is identified, we will update the CVE to reflect this.
Mariner: Mariner
php: php
Customer Action Required: Yes
Remediation: CBL-Mariner Releases
Reference: https:/
Red Hat
php: Fail to Escape Arguments Properly in Microsoft Windows
vendor_redhat·2024-04-09·CVSS 9.4
CVE-2024-1874 [CRITICAL] CWE-78 php: Fail to Escape Arguments Properly in Microsoft Windows
php: Fail to Escape Arguments Properly in Microsoft Windows
In PHP versions 8.1.* before 8.1.28, 8.2.* before 8.2.18, 8.3.* before 8.3.5, when using proc_open() command with array syntax, due to insufficient escaping, if the arguments of the executed command are controlled by a malicious user, the user can supply arguments that would execute arbitrary commands in Windows shell.
A command injection flaw was found in PHP, exclusive to Windows environments. This flaw allows an attacker to perform command injection on Windows applications that indirectly depend on the CreateProcess function in specific conditions. The CreateProcess function implicitly uses cmd.exe when executing batch files, which has complicated parsing rules for arguments that have not fully escaped. It is possible to inje
Debian
CVE-2024-1874: php7.4 - In PHP versions 8.1.* before 8.1.28, 8.2.* before 8.2.18, 8.3.* before 8.3.5, wh...
vendor_debian·2024·CVSS 9.4
CVE-2024-1874 [CRITICAL] CVE-2024-1874: php7.4 - In PHP versions 8.1.* before 8.1.28, 8.2.* before 8.2.18, 8.3.* before 8.3.5, wh...
In PHP versions 8.1.* before 8.1.28, 8.2.* before 8.2.18, 8.3.* before 8.3.5, when using proc_open() command with array syntax, due to insufficient escaping, if the arguments of the executed command are controlled by a malicious user, the user can supply arguments that would execute arbitrary commands in Windows shell.
Scope: local
bullseye: resolved
Debian
CVE-2024-5585: php7.4 - In PHP versions 8.1.* before 8.1.29, 8.2.* before 8.2.20, 8.3.* before 8.3.8, th...
vendor_debian·2024·CVSS 9.4
CVE-2024-5585 [CRITICAL] CVE-2024-5585: php7.4 - In PHP versions 8.1.* before 8.1.29, 8.2.* before 8.2.20, 8.3.* before 8.3.8, th...
In PHP versions 8.1.* before 8.1.29, 8.2.* before 8.2.20, 8.3.* before 8.3.8, the fix for CVE-2024-1874 does not work if the command name includes trailing spaces. Original issue: when using proc_open() command with array syntax, due to insufficient escaping, if the arguments of the executed command are controlled by a malicious user, the user can supply arguments that would execute arbitrary commands in Windows shell.
Scope: local
bullseye: resolved
No detection rules found.
No public exploits indexed.
No writeups or analysis indexed.
http://www.openwall.com/lists/oss-security/2024/04/12/11http://www.openwall.com/lists/oss-security/2024/06/07/1https://github.com/php/php-src/security/advisories/GHSA-pc52-254m-w9w7https://lists.fedoraproject.org/archives/list/[email protected]/message/PKGTQUOA2NTZ3RXN22CSAUJPIRUYRB4B/https://lists.fedoraproject.org/archives/list/[email protected]/message/W45DBOH56NQDRTOM2DN2LNA2FZIMC3PK/https://security.netapp.com/advisory/ntap-20240510-0009/http://www.openwall.com/lists/oss-security/2024/04/12/11http://www.openwall.com/lists/oss-security/2024/06/07/1https://github.com/php/php-src/security/advisories/GHSA-pc52-254m-w9w7https://lists.fedoraproject.org/archives/list/[email protected]/message/KJZK3X6B7FBE32FETDSMRLJXTFTHKWSY/https://lists.fedoraproject.org/archives/list/[email protected]/message/PKGTQUOA2NTZ3RXN22CSAUJPIRUYRB4B/https://lists.fedoraproject.org/archives/list/[email protected]/message/W45DBOH56NQDRTOM2DN2LNA2FZIMC3PK/https://lists.fedoraproject.org/archives/list/[email protected]/message/ZGWIK3HMBACERGB4TSBB2JUOMPYY2VKY/https://security.netapp.com/advisory/ntap-20240510-0009/https://www.kb.cert.org/vuls/id/123335https://www.vicarius.io/vsociety/posts/command-injection-vulnerability-in-php-on-windows-systems-cve-2024-1874-and-cve-2024-5585
2024-04-29
Published