HackTheBoxActiveDirectoryWindows

Scrambled

Medium Windows AD box. Kerberoast sqlsvc → silver ticket → MSSQL creds for MiscSvc → WinRM shell. Reverse engineer .NET app on port 4411 → BinaryFormatter deserialization RCE → SYSTEM.

Difficulty: Medium OS: Windows (Active Directory) IP: 10.129.3.74


Enumeration

Nmap

The large number of open ports is typical of a Windows domain controller.

Port 4411 hosts an unknown service. Connecting with telnet shows a banner (SCRAMBLECORP_ORDERS_V1.0.3;) but no valid commands are known yet — this will be revisited during privilege escalation.

IIS — Port 80

Browsing to http://scrm.local reveals the Scramble Corp intranet site.

IT Services tab: A notice states that NTLM authentication has been disabled across the entire network following a security breach, and that Kerberos is to be used instead.

Contacting IT Support page: A screenshot of a Command Prompt window is shown as an example of how to collect network information for a support ticket. The screenshot reveals a username in the file path. This part of the website reveals a username

and the website also mentions that the NTLM has been turned off, plus the nxc smb displays NTLM to be false

SMB Enumeration

The password of ksimpson turns out be the same as username Then SMB shares are enumerated using nxc with Kerberos authentication (-k):

The Public share is accessible. Connecting to it reveals a PDF: The PDF is an internal memo confirming NTLM has been disabled


Kerberoasting

Service accounts are assigned Service Principal Names (SPNs) in Active Directory. Any domain user can request a Kerberos service ticket for an SPN, which is encrypted with the service account's password hash. This ticket can be taken offline and cracked — an attack known as Kerberoasting.

GetUserSPNs.py is used from Impacket. Since NTLM is disabled, the -dc-host option must use the FQDN rather than the IP:

A TGS hash for the sqlsvc account is obtained. The hash is cracked with hashcat:

The plaintext password for sqlsvc is Pegasus60.


Foothold — Silver Ticket Attack

Although we now have the password for sqlsvc, we cannot simply authenticate to MSSQL as that account and gain useful access. However, because sqlsvc is the service account running the MSSQL service and we know its password, we can perform a silver ticket attack.

A silver ticket is a forged Kerberos TGS (service ticket) that is signed using the service account's own password hash. Unlike a golden ticket, it does not involve the KDC — the ticket is forged entirely offline and used to authenticate directly to the target service, impersonating any user (including Administrator).

Three pieces of information are needed:

  1. The NTLM hash of sqlsvc's password

  2. The domain SID

  3. The SPN of the MSSQL service

Step 1 — Derive the NTLM Hash

NTLM hashes are computed as the MD4 hash of the UTF-16LE encoded password:

Step 2 — Retrieve the Domain SID

getPac.py from Impacket is used to extract the domain SID:

Step 3 — Forge the Silver Ticket

ticketer.py from Impacket is used to forge a TGS ticket for the Administrator user against the MSSQL SPN:

Step 4 — Connect to MSSQL

The forged ticket is exported and used to authenticate to the MSSQL service We are now connected to MSSQL as Administrator.

Database Enumeration

We are now connected to MSSQL as Administrator. xp_cmdshell is enabled to confirm the execution context:

The databases are listed:

The ScrambleHR database is interesting. Its tables are enumerated:

The UserImport table contains credentials:


User Flag

The credentials MiscSvc:ScrambledEggs9900 are used to connect via WinRM using evil-winrm with Kerberos authentication:


Privilege Escalation — Insecure Deserialisation (Port 4411)

During system enumeration, the IT SMB share (accessible as MiscSvc) contains a .NET application:

Reverse Engineering ScrambleLib.dll

The DLL is decompiled using dnSpy. Analysis reveals:

1. Hardcoded developer authentication bypass: The Logon() method in the ScrambleNetClient class contains a bypass: if the username is scrmdev, authentication is skipped entirely.

2. Custom TCP wire protocol:

Commands are sent as newline-terminated ASCII strings in the format CODE;PARAMETER\n. The server listens on port 4411 and responds to commands such as LIST_ORDERS and UPLOAD_ORDER.

3. Insecure BinaryFormatter deserialisation: The UPLOAD_ORDER command causes the server to deserialise a Base64-encoded payload using BinaryFormatter.Deserialize() with no validation:

BinaryFormatter is an inherently unsafe deserialiser — it instantiates arbitrary .NET types during deserialisation, making it susceptible to gadget-chain attacks.

Crafting the Payload

nc64.exe is first uploaded to the target via the existing MiscSvc WinRM session:

A malicious serialised payload is generated using ysoserial.net with the WindowsIdentity gadget chain, which triggers command execution during deserialisation:

A listener is started:

The payload is delivered to the server via telnet. The protocol flow is:

  1. Connect — server responds with SCRAMBLECORP_ORDERS_V1.0.3;

  2. No explicit login is needed; the UPLOAD_ORDER command is sent directly with the Base64 payload

Despite the error response from the server (the object cannot be cast to SalesOrder), the gadget chain executes during deserialisation before the cast, so the payload fires regardless.

Root Shell

A shell is obtained as NT AUTHORITY\SYSTEM (the context of the service running the sales order application), and the root flag is retrieved.


Attack Chain Summary

Step
Technique
Outcome

Web enumeration

OSINT / screenshot analysis

Discovered username ksimpson and password policy

SMB access

Kerberos auth with ksimpson:ksimpson

Read Public share; obtained Network Security Changes.pdf

Kerberoasting

GetUserSPNs.py + hashcat

Cracked sqlsvc hash → Pegasus60

Silver ticket

ticketer.py (Impacket)

Forged TGS as Administrator on MSSQL

DB enumeration

mssqlclient.py

Found MiscSvc:ScrambledEggs9900 in UserImport table

WinRM shell

evil-winrm + Kerberos

Shell as MiscSvc; user flag

.NET RE

dnSpy analysis of ScrambleLib.dll

Discovered dev bypass + insecure BinaryFormatter

Deserialisation RCE

ysoserial.net + telnet

Shell as NT AUTHORITY\SYSTEM; root flag

Last updated