cve.bz

CVE-2024-4577 PHP-CGI OS Command Injection Vulnerability

9.8 criticalKEVExploitEPSS >99.9%Fix available

Critical (9.8) in PHP Group PHP. In CISA KEV since 2024-06-12, with known ransomware use. EPSS >99.9% estimated probability of exploitation activity in the next 30 days.

On this page
In PHP versions 8.1.* before 8.1.29, 8.2.* before 8.2.20, 8.3.* before 8.3.8, when using Apache and PHP-CGI on Windows, if the system is set up to use certain code pages, Windows may use "Best-Fit" behavior to replace characters in command line given to Win32 API functions. PHP CGI module may misinterpret those characters as PHP options, which may allow a malicious user to pass options to PHP binary being run, and thus reveal the source code of scripts, run arbitrary PHP code on the server, etc.

Severity

CVSS 3.1

9.8 critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
>99.9% (unchanged from >99.9% a week ago; >99.9% 30 days ago) estimated probability of exploitation activity in the next 30 days; 100th percentile. Scored 2026-11-21. A forecast for this CVE across the internet, not for your own systems.
CISA KEV
listed 2024-06-12, due 2024-07-03, known ransomware use
CISA's assessment (SSVC)
Exploitation: active · Automatable: yes · Technical impact: total, assessed 2024-06-15. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-78 Improper Neutralization of Special Elements used in an OS Command (OS Command Injection)
OWASP Top 10
A05:2025 Injection
Published
Modified
NVD analysis
Analyzed
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2024-4577 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2024-4577?via=ask-ai-copy and https://cve.bz/cve/CVE-2024-4577?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2024-4577 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the CNA's record in the CVE List.

ProductAffected
PHP Group PHPfrom 8.1.* before 8.1.29
PHP Group PHPfrom 8.2.* before 8.2.20
PHP Group PHPfrom 8.3.* before 8.3.8

Linux distributions

DistributionReleasePackageFixed inAdvisory
openSUSETumbleweedphp88.3.12-1.1openSUSE-SU-2024:14376-1
Alpinev3.19php818.1.29-r0ALPINE-CVE-2024-4577
Alpinev3.19php828.2.20-r0ALPINE-CVE-2024-4577
Alpinev3.19php838.3.8-r0ALPINE-CVE-2024-4577
Azure Linux2php8.1.29-1AZL-42424
Azure Linux3php8.3.8-1AZL-42433

From the distributions' data via OSV.dev: SUSE security data, CC BY 4.0; the Alpine secdb, CC BY-SA 4.0; Microsoft's Azure Linux vulnerability data, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: openSUSE · Alpine.

Red Hat

Red Hat rates this Critical.

Red Hat's statement

No Red Hat products are affected by this CVE.

Red Hat's mitigation

Mitigation for this issue is either not available or the currently available options don't meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.

ProductPackageStateAdvisory
Red Hat Enterprise Linux 10phpNot affected
Red Hat Enterprise Linux 6phpNot affected
Red Hat Enterprise Linux 7phpNot affected
Red Hat Enterprise Linux 8php:7.4/phpNot affected
Red Hat Enterprise Linux 8php:8.0/phpNot affected
Red Hat Enterprise Linux 8php:8.2/phpNot affected
Red Hat Enterprise Linux 9phpNot affected
Red Hat Enterprise Linux 9php:8.1/phpNot affected
Red Hat Enterprise Linux 9php:8.2/phpNot affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2024-4577.

Public exploits

GitHub PoC

Repositories on GitHub named after this CVE or listed for it by the PoC-in-GitHub index. For those marked Harbor Check: matches CVE, Flawharbor read the code and found it implements this CVE's exploitation technique: read, not run, and its dependencies only checked for warning signs, so a pointer and no guarantee. The rest are unverified: some hold a working proof of concept, some nothing useful, and some malware made to look like one. Read the code before you run any of it. How Harbor Check reads them, and what it found.

1 more
  • rayngnpc/CVE-2024-4577-rayng 0 stars, created
    CVE-2024-4577 PHP CGI Argument Injection - Detection Lab with Vagrant VMs and Wazuh SIEM rules

Detection rules

Ways to detect this CVE, not exploit code: the nuclei template that checks a system for it, and the Suricata and Snort rules that name it. A rule set may ship a rule turned off, so check yours by its sid.

  • Nuclei template PHP CGI - Argument Injection
  • Emerging Threats Open ET WEB_SPECIFIC_APPS PHP-CGI OS Command Injection (soft hyphen) (CVE-2024-4577) sid 2060800
  • Emerging Threats Open ET WEB_SERVER Generic PHP Remote File Include sid 2019957
  • Emerging Threats Open ET WEB_SERVER PHP Possible php Remote File Inclusion Attempt sid 2013001

Attack patterns (CAPEC)

  • CAPEC-6 Argument Injection Likelihood: High · Severity: High
  • CAPEC-15 Command Delimiters Likelihood: High · Severity: High
  • CAPEC-43 Exploiting Multiple Input Interpretation Layers Likelihood: Medium · Severity: High
  • CAPEC-88 OS Command Injection Likelihood: High · Severity: High
  • CAPEC-108 Command Line Execution through SQL Injection Likelihood: Low · Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON