ZeroHour
Help Net Securitypublished ()ingested @zeljkazorz

PHP command injection flaw exploited to deliver ransomware (CVE-2024-4577)

highRansomware exploited in the wildimportance 60CVE-2024-4577CVE-2012-1823CVE-2024-3577

Vulnerabilities mentionedAll →

CVEVulnerabilityCVSSEPSSFlagsAffectedExposurePublished
CVE-2012-1823
PHP-CGI Query String Parsing Flaw Enables Unauthenticated Remote Code Execution

PHP, when the interpreter is exposed through the CGI (php-cgi) interface, mishandles query strings (CWE-20 improper input validation), allowing attackers to pass command-line switches such as -d and -s directly to the interpreter. A remote, unauthenticated attacker triggers the flaw by sending a crafted query string beginning with a dash (including URL-encoded forms) to any URL handled by php-cgi. Successful exploitation allows arbitrary code execution under the web server's privileges, as well as disclosure of script source code or phpinfo output, with no authentication required. Only deployments that invoke PHP via CGI/FastCGI (common in legacy shared hosting and bundled software stacks) are affected; PHP running as an Apache module or via PHP-FPM is not exposed. The flaw was added to CISA's Known Exploited Vulnerabilities catalog on 2022-03-25 with EPSS at 100%, indicating active in-the-wild exploitation; any ransomware association is not yet confirmed.

Do: Upgrade PHP to at least 5.3.13/5.4.3 or, preferably, a currently supported PHP branch, and stop exposing the php-cgi binary directly by moving to mod_php or PHP-FPM. As an interim mitigation, block or rewrite requests whose query string begins with a dash (e.g., -d, -s, or URL-encoded dash characters) and review web server logs for such patterns to detect prior exploitation.

100% KEV
  • PHP Deployments running PHP through the CGI (php-cgi) interface at the time of disclosure; per public advisories this includes versions prior to 5.3.12/5.4.2, fixed
masshundreds of thousands of internet-exposed php-cgi endpoints (a subset of the tens of millions of PHP-powered websites)
CVE-2024-4577
OS Command Injection in Windows PHP-CGI Allows Remote Code Execution

CVE-2024-4577 is an OS command injection flaw (CWE-78) in Windows-based PHP when it runs in CGI mode, allowing arbitrary code execution on the server. It is triggered when attacker-supplied characters in HTTP requests are mishandled by Windows' character-encoding conversion as the OS invokes php-cgi, letting attackers inject command-line arguments to the PHP interpreter; this bypasses the decade-old fix for CVE-2012-1823. A successful attacker gains the ability to run arbitrary commands and code in the context of the web server. Affected systems are PHP running on Windows through the CGI interface; deployments that do not use PHP-CGI on Windows are not described as affected in the source data. Exploitation is active: the flaw was added to CISA KEV on 2024-06-12 with known ransomware use, and EPSS assigns roughly 100% probability of exploitation within 30 days.

Do: Per the CISA KEV required action, apply mitigations per vendor instructions or discontinue use: upgrade Windows PHP-CGI deployments to a PHP release that fixes CVE-2024-4577 per PHP Group advisories, or stop using CGI mode on Windows (e.g., switch to FastCGI) and apply any vendor-recommended workarounds. Given known ransomware abuse, review web server access logs for exploitation attempts (notably %AD-encoded soft hyphens and injected -d/-s arguments in php-cgi query strings) and prioritize patching internet-facing Windows hosts.

9.8100% KEV ransomware PoC ×11
  • PHP Group PHP
large≈10,000–100,000 internet-exposed Windows PHP-CGI systems
Full article418 words · extracted from helpnetsecurity.com · click to collapse

An OS command injection vulnerability in Windows-based PHP (CVE-2024-4577) in CGI mode is being exploited by the TellYouThePass ransomware gang.

CVE-2024-4577 exploited

Imperva says the attacks started on June 8, two days after the PHP development team pushed out fixes, and one day after WatchTowr researchers published a technical analysis of the flaw and proof-of-concept exploit code.

About CVE-2024-4577

Discovered and reported by Orange Tsai, principal security researcher at Devcore, CVE-2024-4577 allows attackers to bypass the protections for an older PHP-CGI vulnerability (CVE-2012-1823) by using specific character sequences, and allows attackers to remotely execute code on targeted vulnerable systems.

The vulnerability affects all versions of PHP installed on the Windows operating system when running in CGI (common gateway interface) mode, which is a common enough scenario.

But “even if PHP is not configured under the CGI mode, merely exposing the PHP executable binary in the CGI directory is affected by this vulnerability, too,” the Devcore team noted.

The latter scenario is the default configuration for XAMPP (open-source PHP development environment) for Windows, so all versions of XAMPP installations on Windows are vulnerable by default, they added.

They urged users to ugrade their PHP to version 8.3.8, 8.2.20, or 8.1.29, or implement temporary mitigations.

The ransomware attack

On June 7, the Shadowserver Foundation warned about multiple IPs trying to exploit CVE-2024-4577 on internet-facing machines.

On Monday, Censys said there are about 458,800 exposed PHP instances that are potentially vulnerable, though they noted that the number of actually vulnerable ones is likely smaller.

On the same day, Imperva threat researchers shared that the TellYouThePass ransomware gang has been trying to leverage the vulnerability since June 8.

“The attackers used the known exploit for CVE-2024-3577 to execute arbitrary PHP code on the target system, leveraging the code to use the ‘system’ function to run an HTML application file hosted on an attacker-controlled web server via the mshta.exe binary. mshta.exe is a native Windows binary that can execute remote payloads, pointing to the attackers operating in a ‘living off the land’ style,” they explained.

The gang tries to install web shells and execute the ransomware.

UPDATE (June 13, 2024, 05:20 p.m. ET):

Greynoise has set up a tag to track in-the-wild attempts to exploit the vulnerability, and have revealed that attackers are trying to deliver a variety of malicious payloads, including a Gh0st RAT variant and Cobalt Strike beacons.

Subscribe to our breaking news e-mail alert to never miss out on the latest breaches, vulnerabilities and cybersecurity threats. Subscribe here!

Text extracted automatically; images, tables and formatting may be missing. Original: https://www.helpnetsecurity.com/2024/06/13/cve-2024-4577-exploited/