Chapter 17 Exercises: Active Directory Attacks
⚖️ Legal Note: All exercises must be performed in your Student Home Lab AD environment. Never test AD attacks against production environments without explicit written authorization.
Exercise 1: Build an AD Lab Environment
Difficulty: Beginner | Time: 90 minutes
Set up a vulnerable Active Directory lab for practicing the techniques in this chapter.
- Install Windows Server 2019/2022 as a Domain Controller (DC01).
- Promote it to a domain controller for a test domain (e.g.,
lab.local). - Install AD Certificate Services on DC01.
- Join a Windows 10/11 workstation (WS01) to the domain.
- Create the following accounts:
- 5 standard domain users
- 1 service account (
svc_sql) with an SPN and a weak password - 1 account with "Do not require Kerberos preauthentication" enabled - 1 account in Domain Admins - Run BadBlood or manually create vulnerable configurations.
Deliverable: Functioning AD lab with documented vulnerable configurations.
Exercise 2: BloodHound Data Collection and Analysis
Difficulty: Beginner | Time: 30 minutes
- Install BloodHound and neo4j on your attack machine.
- Run SharpHound on WS01 to collect AD data.
- Import the data into BloodHound.
- Run the following pre-built queries: - "Find Shortest Paths to Domain Admins" - "Find Kerberoastable Accounts" - "Find AS-REP Roastable Users" - "Find Computers with Unconstrained Delegation"
- Write custom Cypher queries to find: - Users with DCSync rights - Accounts with password never expires - Computers where Domain Users are local admin
Deliverable: Screenshots of BloodHound attack paths and custom query results.
Exercise 3: Kerberoasting Attack
Difficulty: Intermediate | Time: 25 minutes
- Using PowerView, enumerate all domain accounts with SPNs.
- Request a TGS ticket for the
svc_sqlservice account using Rubeus. - Export the ticket in hashcat format.
- Crack the hash using hashcat with a wordlist.
- Verify the cracked password by authenticating as the service account.
- Repeat the exercise using Impacket's GetUserSPNs.py from Linux.
Deliverable: Documentation of the complete Kerberoasting workflow with evidence.
Exercise 4: AS-REP Roasting
Difficulty: Intermediate | Time: 20 minutes
- Identify accounts with "Do not require Kerberos preauthentication" using PowerView.
- Request AS-REP tickets using Rubeus.
- Crack the tickets using hashcat (-m 18200).
- Compare the cracking difficulty between AS-REP and Kerberoasting hashes.
- Fix the vulnerability by disabling the preauthentication flag.
Deliverable: AS-REP Roasting walkthrough with cracking metrics.
Exercise 5: Pass-the-Hash and Overpass-the-Hash
Difficulty: Intermediate | Time: 30 minutes
- Use Mimikatz to extract NTLM hashes from a compromised workstation.
- Perform Pass-the-Hash using Impacket's psexec.py to access another system.
- Perform Overpass-the-Hash using Rubeus to convert the NTLM hash to a TGT.
- Use the TGT to access resources via Kerberos.
- Compare the network traffic generated by each technique (use Wireshark).
Deliverable: Comparison of PtH vs. OPtH with network traffic analysis.
Exercise 6: Delegation Attack Lab
Difficulty: Advanced | Time: 45 minutes
- Configure a computer account with unconstrained delegation.
- Use SpoolSample to coerce DC01 to authenticate to the delegation server.
- Capture the DC01$ TGT using Rubeus monitor.
- Configure a service account with constrained delegation to a specific SPN.
- Use Rubeus S4U to impersonate a Domain Admin to the allowed service.
- Configure RBCD by creating a machine account and setting the
msDS-AllowedToActOnBehalfOfOtherIdentityattribute.
Deliverable: Complete delegation attack documentation covering all three types.
Exercise 7: DCSync Attack
Difficulty: Intermediate | Time: 20 minutes
- From a compromised Domain Admin session, use Mimikatz to perform DCSync.
- Extract the krbtgt hash and the Administrator hash.
- Repeat using Impacket's secretsdump.py from Linux.
- Verify the extracted hashes by performing Pass-the-Hash.
- Identify which non-default accounts have DCSync rights using BloodHound.
Deliverable: DCSync evidence and non-default DCSync rights audit.
Exercise 8: Golden Ticket Creation and Usage
Difficulty: Advanced | Time: 30 minutes
- Using the krbtgt hash from Exercise 7, create a Golden Ticket with Mimikatz.
- Inject the ticket and verify domain-wide access.
- Create a Golden Ticket for a non-existent user and verify it works.
- Create a Golden Ticket using Impacket's ticketer.py.
- Test access to file shares, remote execution, and other services.
- Reset the krbtgt password twice and verify the Golden Ticket is invalidated.
Deliverable: Golden Ticket creation and validation documentation.
Exercise 9: Silver Ticket Creation
Difficulty: Advanced | Time: 25 minutes
- Extract a computer account NTLM hash from a compromised system.
- Create a Silver Ticket for the CIFS service using Mimikatz.
- Access the target's file shares using the forged ticket.
- Create Silver Tickets for different service types (HOST, HTTP, LDAP).
- Compare Silver Ticket detection visibility with Golden Ticket.
Deliverable: Silver Ticket comparison with service-type analysis.
Exercise 10: AD CS ESC1 Exploitation
Difficulty: Advanced | Time: 40 minutes
- Install AD Certificate Services on your DC with default templates.
- Create a vulnerable certificate template (ESC1): enable
ENROLLEE_SUPPLIES_SUBJECT, Client Authentication EKU, and allow Domain Users to enroll. - Use Certify/Certipy to identify the vulnerable template.
- Request a certificate with the Administrator's UPN as the SAN.
- Use the certificate to authenticate as Administrator.
- Fix the template by disabling
ENROLLEE_SUPPLIES_SUBJECT.
Deliverable: Complete AD CS ESC1 exploitation walkthrough.
Exercise 11: PowerView Enumeration Mastery
Difficulty: Intermediate | Time: 30 minutes
Using PowerView, perform the following enumeration tasks:
- List all domain users with their descriptions (searching for passwords in descriptions).
- Find all Kerberoastable accounts and their group memberships.
- Identify all computers with unconstrained or constrained delegation.
- Enumerate all domain trusts and their directions.
- Find all GPOs and identify which ones grant local admin rights.
- Check for ACLs that grant GenericAll, GenericWrite, or WriteDacl to non-admin users.
Deliverable: PowerView command reference with sample output.
Exercise 12: NTLM Relay Attack
Difficulty: Advanced | Time: 45 minutes
- Set up Responder to capture NTLM authentication on your lab network.
- Use ntlmrelayx to relay captured authentication to a target server.
- Demonstrate the impact: relay authentication to gain code execution.
- Combine with PetitPotam to coerce DC authentication for relay.
- Implement SMB signing and EPA as mitigations and verify the relay fails.
Deliverable: NTLM relay attack documentation with mitigation verification.
Exercise 13: AD Persistence Mechanisms
Difficulty: Advanced | Time: 30 minutes
Implement and detect the following AD persistence mechanisms:
- Create a Golden Ticket and verify persistence across password resets.
- Modify AdminSDHolder ACL and wait for SDProp to propagate.
- Add a backdoor entry to the domain's ACL granting DCSync rights.
- Create a Silver Ticket and compare its persistence with Golden Ticket.
- For each mechanism, document the detection method and cleanup procedure.
Deliverable: Persistence mechanism comparison with detection and cleanup procedures.
Exercise 14: Complete AD Attack Chain
Difficulty: Advanced | Time: 90 minutes
Starting from a standard domain user on WS01, achieve domain dominance:
- Enumerate the domain using BloodHound and PowerView.
- Identify at least two attack paths to Domain Admin.
- Execute the fastest attack path.
- Achieve DCSync and extract all domain hashes.
- Create a Golden Ticket for persistence.
- Write a professional penetration test report documenting the entire chain.
Deliverable: Complete penetration test report with executive summary and technical findings.
Exercise 15: AD Security Assessment Script
Difficulty: Intermediate | Time: 45 minutes
Write a Python script (using ldap3) that connects to AD and identifies:
- Accounts with SPNs (Kerberoastable)
- Accounts without preauthentication (AS-REP Roastable)
- Computers with unconstrained delegation
- Accounts with the "Password Never Expires" flag
- Machine Account Quota (can users create computer accounts?)
Reference: See code/example-01-ad-enumerator.py for a starting framework.
Deliverable: Working Python script with sample output.
🔵 Blue Team Exercise: AD Hardening Assessment
Difficulty: Advanced | Time: 60 minutes
- Run PingCastle or Purple Knight against your lab domain.
- Review the security score and all findings.
- Implement fixes for the top 10 findings.
- Re-run the assessment and verify improved scores.
- Deploy Microsoft Defender for Identity and trigger detection alerts.
- Configure tiered administration and verify enforcement.
- Set ms-DS-MachineAccountQuota to 0.
- Audit and fix all delegation configurations.
Deliverable: AD security assessment report with before/after scores.