Control
Executive summary — Control combines a classic web exploitation chain with a Windows escalation technique less common than the usual "potato" attacks. An HTML comment leaks the IP of a supposedly trusted proxy, which turns out to be the exact value expected by an access control check based on the
X-Forwarded-Forheader — once inside the admin panel, a UNION-based SQL injection against a MariaDB account with FILE privilege dumps credentials and writes a PHP webshell straight into the IIS webroot. From there, after ruling out the usual potato routes, the real escalation vector is abusing service registry ACLs: an unprivileged user can rewrite theImagePathof aLocalSystemservice and get code execution as SYSTEM.
| Platform | Hack The Box |
| Operating system | Windows Server 2019 (Build 17763) |
| Difficulty | Hard |
| Status | Retired |
| Target IP | <TARGET_IP> |
Attack map
[80] Fidelity (IIS 10 + PHP 7.3) — HTML comment leaks the "trusted proxy" IP
│ X-Forwarded-For: 192.168.4.28 -> bypasses admin.php's access control
▼
[80] admin.php — UNION SQLi in search_products.php (productName, 6 columns)
│ manager@warehouse has FILE privilege -> dump of mysql.user
│ hector:l33th4x0rhector (mysql-sha1, cracked with rockyou)
▼
[RCE] INTO DUMPFILE writes a PHP webshell into C:\inetpub\wwwroot
│ RunasCs (-l 2 --force-profile) pivots using hector's credentials
▼
[hector] (user.txt)
│ SeImpersonate + GodPotato/PrintSpoofer fail
│ Weak ACLs on HKLM\SYSTEM\CurrentControlSet\Services -> writable ImagePath
▼
[ROOT] hijack a LocalSystem service's ImagePath (Appinfo) + sc start -> SYSTEM
1. Reconnaissance
sudo nmap -p- --min-rate 3000 -T4 -Pn -oN scans/allports.txt <TARGET_IP>
PORT STATE SERVICE
80/tcp open http
135/tcp open msrpc
3306/tcp open mysql
49666/tcp open unknown
49668/tcp open unknown
sudo nmap -p80,135,3306,49666,49668 -sCV -oN scans/services.txt <TARGET_IP>
80/tcp open http Microsoft IIS httpd 10.0
|_http-title: Fidelity
| http-methods:
|_ Potentially risky methods: TRACE
3306/tcp open mysql MariaDB 10.3.24 or later (unauthorized)
The HTTP headers reveal the full stack: Server: Microsoft-IIS/10.0 and X-Powered-By: PHP/7.3.7. Two anomalies worth noting: MariaDB (3306) exposed externally on a Windows box — unusual, suggesting careless configuration — and PHP on IIS, a less common pairing than PHP/Apache or ASP.NET/IIS, pointing at a custom-built application.
mysql -h <TARGET_IP> -u root
ERROR 1130: Host '<ATTACKER_IP>' is not allowed to connect to this MariaDB server
The database will only be reachable from the inside, through the web app.
curl -s http://<TARGET_IP>/ | head -25
The front page's HTML holds a telling developer comment:
<!-- To Do:
- Import Products
- Link to new payment system
- Enable SSL (Certificates location \\192.168.4.28\myfiles)
-->
"Import Products" hints at product search/management functionality (the future SQLi vector), and
192.168.4.28is an internal IP the server treats as trusted — although it reads like a note about where some certificates live, it's the exact value that will resolve the admin panel's access control. HTML comments leaking infrastructure details are a textbook case of information disclosure.
ffuf -u http://<TARGET_IP>/FUZZ -w raft-medium-directories.txt -e .php -mc 200,301,302,403
admin.php (200, "Access Denied: Header Missing")
about.php (200)
database.php (200, empty)
search_products.php (200, "Access Denied")
The site's own JavaScript (assets/js/functions.js) confirms more product CRUD endpoints: update_product.php, view_product.php, delete_product.php.
Root Access unlocks the content you can't see — everything else on the site is already open.
See Root Access plansNo account? Create one free then upgrade from your console.