CVE-2024-5585

7.7 HIGH

📋 TL;DR

This vulnerability allows remote command execution on Windows systems when using PHP's proc_open() function with array syntax. An attacker can inject malicious arguments that bypass the previous CVE-2024-1874 fix by adding trailing spaces to command names. Affects PHP applications running on Windows that use proc_open() with user-controlled input.

💻 Affected Systems

Products:
  • PHP
Versions: PHP 8.1.* before 8.1.29, 8.2.* before 8.2.20, 8.3.* before 8.3.8
Operating Systems: Windows
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects Windows systems. Requires proc_open() function usage with array syntax and user-controlled arguments.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise allowing arbitrary command execution with the privileges of the PHP process, potentially leading to data theft, ransomware deployment, or complete system takeover.

🟠

Likely Case

Limited command execution within the PHP process context, potentially allowing file system access, data exfiltration, or lateral movement within the network.

🟢

If Mitigated

No impact if proper input validation and escaping are implemented, or if the application doesn't use proc_open() with user-controlled arguments.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires user-controlled input passed to proc_open() arguments. Public proof-of-concept available in security advisories.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: PHP 8.1.29, 8.2.20, 8.3.8

Vendor Advisory: https://github.com/php/php-src/security/advisories/GHSA-9fcc-425m-g385

Restart Required: Yes

Instructions:

1. Identify PHP version with 'php -v'. 2. Upgrade to patched version: PHP 8.1.29, 8.2.20, or 8.3.8. 3. Restart web server/service. 4. Test application functionality.

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Validate and sanitize all user input before passing to proc_open() function

Avoid proc_open() with User Input

all

Refactor code to avoid using proc_open() with any user-controlled arguments

🧯 If You Can't Patch

  • Implement strict input validation and escaping for all arguments passed to proc_open()
  • Migrate affected applications to Linux systems where this vulnerability doesn't apply

🔍 How to Verify

Check if Vulnerable:

Check PHP version and if proc_open() is used with user-controlled arguments on Windows systems

Check Version:

php -v

Verify Fix Applied:

Verify PHP version is 8.1.29, 8.2.20, or 8.3.8 or higher

📡 Detection & Monitoring

Log Indicators:

  • Unusual process executions from PHP context
  • Suspicious command-line arguments in process logs
  • Multiple failed proc_open() attempts

Network Indicators:

  • Outbound connections from PHP processes to unexpected destinations
  • Command and control traffic patterns

SIEM Query:

Process Creation where Parent Process contains 'php' AND Command Line contains unusual patterns OR includes shell metacharacters

🔗 References

📤 Share & Export