
CVE-2024-4577 EXP
PHP is an acronym for Hypertext Preprocessor. It is now a widely used open-source scripting language that is particularly suitable for web development and embedding in HTML, and is very simple to use. CGI, which stands for Common Gateway Interface, is the mechanism by which Apache, when encountering a PHP script, submits the PHP program to the CGI application (php-cgi.exe) for interpretation. The interpreted result is returned to Apache, which then returns it to the requesting user.
PHP, during its design, ignored the Best-Fit character conversion feature in Windows. When PHP-CGI runs on the Windows platform and uses specific locales (such as Simplified Chinese 936, Traditional Chinese 950, Japanese 932, etc.), an attacker can construct special query strings. After URL decoding, these strings may contain specific non-ASCII characters that are mapped to hyphens on Windows systems, thereby bypassing the patches for CVE-2012-1823 and CVE-2012-2311, constructing CGI-mode command-line parameters, and executing arbitrary PHP code.
python CVE-2024-4577 --target http://192.168.1.1/index.php -c "<?php system('calc')?>"

Comment out the following configuration in C:\xampp\apache\conf\extra\httpd-xampp.conf and restart the service.
#
# PHP-CGI setup
#
# <FilesMatch "\.php$">
# SetHandler application/x-httpd-php-cgi
# </FilesMatch>
# <IfModule actions_module>
# Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
# </IfModule>
Comment out in C:/xampp/apache/conf/extra/httpd-xampp.conf:
# ScriptAlias /php-cgi/ "C:/xampp/php/"