← Back to Tomes

MSSQL to Domain Compromise: Attack Chain BreakdownFrom MSSQL to Domain Compromise: A Practical Attack Path in Active Directory (HTB Signed)

In many organisations, MSSQL Server is seen as just a database service. In reality, if misconfigured, MSSQL can become the starting point of a Domain Compromise surprisingly quickly.

The Signed machine is a great example of an attack chain that goes all the way from
initial foothold → credential access → Kerberos abuse → SYSTEM

This article summarises the attack path concisely from a penetration tester's perspective.

Initial Foothold — MSSQL Only (100% Real)

Scanning revealed only a single open port:

1433 MSSQL

A realistic scenario — an organisation exposing its database to applications while closing every other service.

After logging in with obtained credentials, the user had low privileges (guest) and could not execute xp_cmdshell.

But one thing mattered: xp_dirtree worked.

That was the first pivot point.

Credential Access — NTLM Capture (This one's extremely satisfying)

xp_dirtree can force SQL Server to initiate an SMB connection to the attacker, which leaks the service account authentication.

Using Responder, we captured the hash of:

SIGNED\mssqlsvc

Then cracked the password (genuinely difficult if the password isn't dictionary-based — otherwise you'd need phishing to collect a custom wordlist):

purPLE9795!@

This step demonstrates that:

A weak service account password can immediately put an entire domain at risk.

Privilege Escalation — Silver Ticket (Cinema Ticket)

After logging in as mssqlsvc, we found:

SIGNED\IT = sysadmin in SQL Server

Instead of trying to brute-force SQL privilege escalation, the faster path was a Kerberos Silver Ticket.

The concept:

  • Use the service account's NTLM hash
  • Forge a Kerberos ticket
  • Fake group membership

Logging in with the forged ticket:

IS_SRVROLEMEMBER('sysadmin') = 1

Now xp_cmdshell was available.

Code Execution — Getting a Shell

With sysadmin access, command execution is straightforward.

General steps:

  1. Enable xp_cmdshell
  2. Download netcat
  3. Reverse shell

Shell obtained as:

signed\mssqlsvc

User flag readable.

Root — Multiple Attack Paths

What's interesting about this machine is the multiple root paths — which mirrors real-world enterprise environments where there are always several routes in. Like a building with many doors.

Life always gives you options

Method 1 — Direct File Read (Seen in real engagements)

With Domain Admin privileges in the ticket, you can use:

OPENROWSET(BULK)

to read files directly from the filesystem.

This method is:

  • Fast
  • Quiet
  • No shell needed

Method 2 — PowerShell History

A commonly overlooked file:

ConsoleHost_history.txt

The Administrator had run commands containing a plaintext password.

Classic example of:

Operational Security Failure

Then used RunasCs to spawn an Administrator shell immediately.

Method 3 — Token Impersonation (Everyone forgets to close this)

The service account had:

SeImpersonatePrivilege

Opening the door to Potato-type exploits.

Flow:

  1. Steal token
  2. Spawn process
  3. Escalate to SYSTEM

A technique penetration testers and red teamers use constantly in Windows environments.

Method 4 — Intended Solution (NTLM Reflection)

The intended path uses vulnerability:

CVE-2025-33073

Concept:

  1. DNS spoof
  2. Coerce authentication
  3. Relay NTLM → WinRM
  4. SYSTEM

This technique reflects the new attack trend:

Cross-protocol relay and identity abuse rather than traditional memory corruption exploits.

Key Takeaways

This machine teaches several important lessons:

1. Service Accounts are high-value targets — a weak password can collapse an entire domain.

2. MSSQL is not just a Database — it's a powerful entry point.

3. Kerberos Abuse still works — Silver Ticket remains highly effective.

4. PowerShell History is a Data Leak — most organisations don't monitor this at all.

5. SeImpersonatePrivilege = Dangerous — this privilege is almost a guaranteed local privilege escalation.

6. DNS and NTLM are still a large Attack Surface — many organisations haven't hardened these seriously.

Final Thoughts

Signed is a great example of a realistic enterprise attack chain.
Not a single-vulnerability exploit, but:

Misconfiguration + Weak Password + Privilege Abuse + Identity Attacks = Domain Compromise

And this is exactly what happens in real penetration tests and incident responses.

Want to see the full walkthrough? Come to the
Not The Hidden Wiki x HackTheBox Meetup (Not The Hidden Skillz) — where I (Sabastiaz), Chicken, and international guests will walk through both Machine and Sherlock challenges. 21 February 2026.

Register here: https://www.meetup.com/hack-the-box.../events/313264719/

P.S. All speakers will present in English — including us. So bear with us. (Snake Fish Fish Yes No ok Thank you)

More details on Facebook or LinkedIn

— — — — See you there — — — —

ในหลายองค์กร MSSQL Server มักถูกมองว่าเป็นเพียง database service แต่ในความเป็นจริง หากมีการตั้งค่าที่ไม่เหมาะสม MSSQL สามารถกลายเป็นจุดเริ่มต้นของ Domain Compromise ได้อย่างรวดเร็ว

เครื่อง Signed เป็นตัวอย่างที่ดีของ attack chain ตั้งแต่ 
initial foothold → credential access → Kerberos abuse → SYSTEM

บทความนี้สรุป attack path แบบกระชับในมุมมองของ penetration tester

Initial Foothold — MSSQL Only (เรื่องจริงเป็น 10)

การสแกนพบเพียงพอร์ตเดียวที่เปิดคือ

1433 MSSQL

ซึ่งเป็นสถานการณ์ที่พบได้จริงในองค์กรที่เปิด database ให้ application ใช้งานแต่ปิด service อื่นทั้งหมด

หลังจาก login ด้วย credential ที่ได้มา พบว่า user มีสิทธิ์ต่ำ (guest) และไม่สามารถใช้ xp_cmdshell ได้

แต่มีสิ่งหนึ่งที่สำคัญมาก: xp_dirtree ใช้งานได้

นี่คือจุด pivot แรก

Credential Access — NTLM Capture (อันนี้สุดมากเปิดรอตึง ๆ )

xp_dirtree สามารถบังคับให้ SQL Server เชื่อมต่อ SMB ไปยัง attacker ได้ ซึ่งทำให้ service account authentication ถูกส่งออกมา

เมื่อใช้ Responder จึงสามารถ capture hash ของ:

SIGNED\mssqlsvc

และ crack ได้ password (ของจริงแอบยากถ้าไม่ได้ใช้ password ตาม dictionary ไม่งั้นต้อง phishing เพื่อเก็บ password ทำ wordlist)

purPLE9795!@

ขั้นตอนนี้แสดงให้เห็นว่า:

Service account password ที่อ่อนแอ สามารถทำให้ environment ทั้ง domain เสี่ยงได้ทันที

Privilege Escalation — Silver Ticket (ตั๋วโรงหนัง)

หลังจาก login เป็น mssqlsvc พบว่า

SIGNED\IT = sysadmin ใน SQL Server

แทนที่จะพยายาม brute force privilege escalation ใน SQL วิธีที่เร็วกว่า คือใช้ Kerberos Silver Ticket

แนวคิดคือ:

  • ใช้ NTLM hash ของ service account
  • Forge Kerberos ticket
  • ปลอม group membership

เมื่อ login ใหม่ด้วย forged ticket

IS_SRVROLEMEMBER('sysadmin') = 1

ตอนนี้สามารถใช้ xp_cmdshell ได้แล้ว

Code Execution — Getting a Shell

เมื่อได้ sysadmin การ execute command เป็นเรื่องง่าย

ขั้นตอนทั่วไป:

  1. เปิด xp_cmdshell
  2. ดาวน์โหลด netcat
  3. Reverse shell

จากนั้นได้ shell เป็น:

signed\mssqlsvc

และสามารถอ่าน user flag ได้

Root — Multiple Attack Paths

จุดที่น่าสนใจของเครื่องนี้คือมีหลายวิธีในการขึ้น root ซึ่งสะท้อนโลกจริงได้ดี เพราะ environment จริงมักมีหลายช่องทางเสมอ เหมือนประตูที่มีหลายบาน (ไม่เกี่ยวเลย)

ชีวิตมีทางเลือกให้เราเสมอ

Method 1 — Direct File Read (เคยเจอในชีวิตจริง)

ถ้ามี Domain Admin privilege ใน ticket สามารถใช้

OPENROWSET(BULK)

อ่านไฟล์จาก filesystem ได้โดยตรง

เป็นวิธีที่:

  • เร็ว
  • เงียบ
  • ไม่ต้อง shell

Method 2 — PowerShell History

ไฟล์ที่มักถูกมองข้าม:

ConsoleHost_history.txt

พบว่า Administrator เคยรันคำสั่งที่มี password แบบ plaintext

นี่เป็นตัวอย่าง classic ของ:

Operational Security Failure

จากนั้นใช้ RunasCs เพื่อ spawn shell เป็น Administrator ได้ทันที

Method 3 — Token Impersonation (ท่ายอดฮิตที่คนมักลืมปิด)

service account มี:

SeImpersonatePrivilege

ซึ่งเปิดทางไปสู่เทคนิคประเภท Potato exploit

Flow:

  1. Steal token
  2. Spawn process
  3. Escalate to SYSTEM

นี่เป็นเทคนิคที่ penetration tester และ red team ใช้บ่อยมากใน Windows environment (บ่อยมาก ๆ)

Method 4 — Intended Solution (NTLM Reflection)

วิธี intended ใช้ vulnerability:

CVE-2025-33073

แนวคิด:

  1. DNS spoof
  2. Coerce authentication
  3. Relay NTLM → WinRM
  4. ได้ SYSTEM

เทคนิคนี้สะท้อน trend ใหม่ของ attack:

Cross-protocol relay และ identity abuse มากกว่าการ exploit memory corruption แบบเดิม

Key Takeaways

เครื่องนี้สอนบทเรียนสำคัญหลายข้อ:

1. Service Accounts คือเป้าหมายสำคัญ password ที่อ่อนแอสามารถทำให้ domain ล่มได้

2. MSSQL ไม่ใช่แค่ Database แต่เป็น entry point ที่ทรงพลัง

3. Kerberos Abuse ยังใช้ได้จริง Silver Ticket ยังเป็นเทคนิคที่ effective มาก

4. PowerShell History คือ Data Leak หลายองค์กรไม่ monitor จุดนี้เลย

5. SeImpersonatePrivilege = Dangerous สิทธิ์นี้แทบเท่ากับ local privilege escalation guarantee

6. DNS และ NTLM ยังเป็น Attack Surface ใหญ่หลายองค์กรยังไม่ได้ harden จริงจัง

Final Thoughts

Signed เป็นตัวอย่างที่ดีของ realistic enterprise attack chain
ไม่ใช่การ exploit ช่องโหว่เดียว แต่เป็นการ:

Misconfiguration + Weak Password + Privilege Abuse + Identity Attacks = Domain Compromise

และนี่คือสิ่งที่เกิดขึ้นจริงใน penetration test และ incident response อยู่เสมอ

หากอยากดูแบบละเอียดและจัดเต็มสามารถไปดูพร้อมกันได้ที่งาน
Not The Hidden Wiki x HackTheBox Meetup (Not The Hidden Skillz) งานที่คุณจะได้ชมการ Walkthrough ทั้ง Machine และ Sherlock จากผม (Sabastiaz), Chicken และคนดังจากต่างประเทศมากมาย งาน 21 กุมภาพันธ์ 2026

Link Register: https://www.meetup.com/hack-the-box.../events/313264719/

ปล. speaker ทุกคนจะต้องพูดภาษาอังกฤษ รวมถึงพวกผมด้วย เพราะงั้นฝากตัวด้วยครับ (Snake Fish Fish Yes No ok Thank you)

อ่านเพิ่มเติมได้ที่ Facebook หรือ Linkedin

— — — — แล้วพบกันนะครับ — — — —