Token Impersonation
Overview
Token impersonation is a post-exploitation technique that allows attackers to impersonate other users by stealing and using their access tokens. This is particularly effective after successful credential compromise, lateral movement, or privilege escalation attacks.
What are Tokens?
Definition
Access Tokens: Temporary keys that allow access to a system/network without providing credentials each time
Function: Think of them as "cookies for computers"
Purpose: Enable seamless access to resources without repeated authentication
Token Types
Delegate Tokens
Purpose: Created for logging into a machine or using Remote Desktop
Characteristics:
Interactive logon sessions
Full user privileges
Can be used for network authentication
Higher privilege level
Impersonate Tokens
Purpose: "Non-interactive" operations
Use Cases:
Attaching network drives
Domain logon scripts
Automated services
Characteristics:
Limited functionality
Cannot be used for interactive logons
Lower privilege level
Token Discovery and Enumeration
Using Incognito (Metasploit)
Using PowerShell
Token Impersonation Techniques
Method 1: Incognito (Metasploit)
Method 2: Manual Token Manipulation
Practical Attack Scenarios
Scenario 1: Post-Kerberoasting Token Hunt
Scenario 2: Complete Token Impersonation Workflow
Scenario 3: Real-World Token Enumeration
Scenario 4: Post-Impersonation Actions and Limitations
Understanding Token Limitations
Common Limitations After Impersonation
Next Steps When Access Denied
Token Hunting Strategies
PowerShell Token Hunting Script
Token Priority Matrix
Advanced Token Techniques
Token Stealing with Cobalt Strike
Potato Attacks for Token Impersonation
Token Persistence
Method 1: Schedule Task with Token
Method 2: Service Creation
Detection and Evasion
Token Impersonation Detection
Evasion Techniques
Tool Reference
Native Windows Tools
Third-Party Tools
PJPT Exam Tips
For the PJPT Exam
Always check for tokens after gaining SYSTEM access
Prioritize high-value tokens
Domain Admin accounts
Enterprise Admin accounts
Backup Operators
Service accounts with elevated rights
Document token impersonation steps clearly
Show before/after
whoamioutputDocument which tokens were available
Explain why specific tokens were chosen
Have backup plans when token impersonation fails
Credential dumping
Lateral movement
Alternative privilege escalation
Common PJPT token impersonation workflow:
Note: Always ensure proper authorization before conducting token impersonation attacks. These techniques should only be used in authorized penetration testing scenarios or controlled lab environments.
Last updated