Skip to main content

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

Patch nowCritical9.8Exploited, CISA due date 2024-07-03EPSS 100%, higher than 100% of scored CVEs

CVE-2024-4577 is a OS command injection in PHP, rated critical (9.8 on CVSS 3.1).

Why this priority: Exploited in the wild: listed in CISA's KEV catalog.

Published · Updated · NVD status: Analyzed

What it is

Input reaches an operating-system command line, letting an attacker run their own commands on the host.

How it is reached

An attacker can exploit it over the network, without an account, and nobody has to click anything.

What an attacker gains

A successful attack can read the data it protects, change data or behaviour and take it offline. In practice, this kind of flaw lets an attacker run commands or code with the privileges of the affected service.

Is it being exploited?

CISA added it to the Known Exploited Vulnerabilities catalog on 2024-06-12: it is being exploited in the wild. CISA links it to ransomware campaigns. It can be exploited automatically, at scale. EPSS estimates a 100% chance of exploitation activity in the next 30 days, higher than 100% of scored CVEs.

What to do

  1. Treat it as urgent: it is on CISA's KEV list. CISA's deadline for US federal agencies: 2024-07-03.
  2. Upgrade PHP to a fixed version for your release line (8.1.29, 8.2.20, 8.3.8). The patch notes are linked below.
  3. Until it is patched, keep it off the internet or behind a VPN, allowlist or authenticating proxy.
  4. Check exposed instances for signs of compromise, not only for the version.

Description from NVD

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.

What this means for your architecture.

A CVE names a product. Whether it matters depends on where that product sits in your systems: what reaches it, which trust boundary it guards and what it can reach once compromised. Veriom maps your components, their relationships and your trust boundaries from your code, cloud and delivery evidence, so you can see where a component like this sits. The radar itself does not look at your systems.

Components it touches

  • Operating systems on servers, workstations or devices. Everything on the host inherits the flaw.
  • Application servers and the hosts they run on. The flaw sits between untrusted input and code or command execution.
  • Template engines. The flaw sits between untrusted input and code or command execution.

Trust boundaries in play

  • Internet-facing entry points. No account is needed. Any instance reachable from outside your perimeter, through a load balancer, gateway, VPN or exposed admin port, is in scope.
  • Between untrusted input and code or command execution. An attacker who crosses it can run commands or code with the privileges of the affected service.

Questions to answer about your own systems

  • Where does PHP run in your systems, and at which version?
  • Which of those instances can be reached from the internet or partner networks?
  • What can it reach once compromised: which data stores, secrets and services?

Read more

Sources

  • CVE records and CVSS scores from the NVD CVE API. This product uses the NVD API but is not endorsed or certified by the NVD.
  • Exploitation status from CISA’s Known Exploited Vulnerabilities catalog.
  • Exploit likelihood from FIRST’s Exploit Prediction Scoring System (EPSS), refreshed daily.
  • Explanations are written by Veriom from fixed templates over each record’s data, not by a person reviewing each CVE. Descriptions are quoted from the records as published.