XAMPP
Windows XAMPP can expose Apache/PHP on alternate ports. If a PHP page includes a user-controlled page parameter, use LFI to read files and poison Apache logs for command execution.
Discovery
Useful service indicators:
21/tcp open ftp FileZilla ftpd 0.9.41 beta
3306/tcp open mysql MariaDB 10.3.24 or later
4443/tcp open http Apache httpd 2.4.43 ((Win64) OpenSSL/1.1.1g PHP/7.4.6)
8080/tcp open http Apache httpd 2.4.43 ((Win64) OpenSSL/1.1.1g PHP/7.4.6)WhatWeb may show XAMPP and PHP:
Apache[2.4.43], HTTPServer[Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6], PHP[7.4.6], RedirectLocation[/dashboard/], X-Powered-By[PHP/7.4.6]Useful paths:
http://TARGET:8080/dashboard/
http://TARGET:8080/dashboard/phpinfo.php
http://TARGET:8080/phpmyadmin/Directory Enumeration
Use -n because the server may redirect or behave noisily:
feroxbuster -u http://TARGET:8080 -n -x php -Eg -t 10 -w /md/wl/raft-small-directories.txtUseful hits:
The application path was:
LFI
Test Windows file read through the page parameter:
The working Apache access log path was:
Confirm the LFI can read it:
Log Poisoning RCE
Send a request with a PHP webshell in the User-Agent header:
Trigger command execution by including the poisoned access log:
Successful command execution:
Working directory:
Reverse Shell
Use PowerShell to download and execute powercat.ps1:
URL-encode the command and pass it through the poisoned log webshell:
Successful shell:
Confirm context:
Observed user:
Last updated