module

PHP CGI Argument Injection Remote Code Execution

Disclosed
06/06/2024
Created
06/17/2024

Description

This module exploits a PHP CGI argument injection vulnerability affecting PHP in certain configurations
on a Windows target. A vulnerable configuration is locale dependant (such as Chinese or Japanese), such that
the Unicode best-fit conversion scheme will unexpectedly convert a soft hyphen (0xAD) into a dash (0x2D)
character. Additionally a target web server must be configured to run PHP under CGI mode, or directly expose
the PHP binary. This issue has been fixed in PHP 8.3.8 (for the 8.3.x branch), 8.2.20 (for the 8.2.x branch),
and 8.1.29 (for the 8.1.x branch). PHP 8.0.x and below are end of life and have note received patches.

XAMPP is vulnerable in a default configuration, and we can target the /php-cgi/php-cgi.exe endpoint. To target
an explicit .php endpoint (e.g. /index.php), the server must be configured to run PHP scripts in CGI mode.

Authors

Orange TsaiwatchTowrsfewer-r7

Platform

PHP,Windows

Architectures

php, cmd

Module Options

To display the available options, load the module within the Metasploit console and run the commands ‘show options’ or ‘show advanced’:

    msf > use exploit/windows/http/php_cgi_arg_injection_rce_cve_2024_4577
    msf /(7) > show actions
        ...actions...
    msf /(7) > set ACTION < action-name >
    msf /(7) > show options
        ...show and set options...
    msf /(7) > run
  
Title
NEW

Explore Exposure Command

Confidently identify and prioritize exposures from endpoint to cloud with full attack surface visibility and threat-aware risk context.