Authentication Server Response (AS-REP) Roasting
Introduction
AS-REP Roasting is a post-exploitation technique used by attackers to extract and crack password hashes for user accounts in a Kerberos authentication environment. It specifically targets user accounts that have "Do not require Kerberos preauthentication" enabled, exploiting a feature of the Kerberos protocol that allows attackers to obtain encrypted password hashes without direct interaction with the target user.
AS-REP Roasting is categorised under the Credential Access tactic in the MITRE ATT&CK framework (ID: T1558.004) and is often used to escalate privileges or move laterally within a compromised environment.
How AS-REP Roasting Works
Kerberos Overview:
In a typical Kerberos authentication process, pre-authentication requires the client to prove its identity by encrypting a timestamp with the user's password hash and sending it to the Key Distribution Center (KDC). This mechanism prevents offline brute-force attacks against Kerberos accounts.
No Preauthentication Accounts:
Some accounts in Active Directory may have the "Do not require Kerberos preauthentication" flag enabled. This is often done for compatibility with legacy systems or misconfiguration.
For these accounts, the KDC skips the preauthentication step and directly sends an encrypted AS-REP message containing the user's Ticket Granting Ticket (TGT).
Attack Workflow:
Discovery: The attacker enumerates accounts in Active Directory to identify those with preauthentication disabled.
Request AS-REP: The attacker requests authentication for the target account without needing any credentials.
Receive AS-REP: The KDC responds with an AS-REP message encrypted using the target user's password hash.
Offline Hash Cracking: The attacker extracts the encrypted hash from the AS-REP message and uses tools like
John the Ripper
orHashcat
to perform an offline brute-force or dictionary attack to recover the plaintext password.
Why AS-REP Roasting is Effective
No Interaction with the Target User: Unlike techniques like phishing, AS-REP Roasting does not require user interaction, making it stealthier.
Offline Cracking: Once the attacker retrieves the AS-REP hash, the cracking process is entirely offline, bypassing detection systems that monitor real-time activities.
Weak Passwords: Environments with weak password policies are highly vulnerable as attackers can easily crack poorly secured hashes.
Detection and Mitigation
Detection:
Log Monitoring:
Monitor Windows Security Event Logs for Kerberos authentication anomalies:
Event ID 4768: Kerberos Authentication Ticket Request.
Event ID 4771: Kerberos Pre-authentication Failed.
Event ID 4625: This event is generated when an account fails to log on.
Event ID 4738, 5136: These events are generated when a user account is changed
Look for multiple AS-REP requests from a single host or for rarely used accounts.
Network Traffic Analysis:
Use tools like Zeek or Wireshark to detect Kerberos AS-REP traffic originating from unusual IP addresses or hosts.
Threat Hunting:
Query Active Directory to identify accounts with the
DONT_REQUIRE_PREAUTH
attribute enabled:
Use EDR/SIEM Tools:
Configure detection rules for tools like Splunk, Elastic, or Microsoft Sentinel to flag unusual AS-REP requests.
Mitigation:
Disable Legacy Settings:
Audit and disable the "Do not require Kerberos pre-authentication" setting for all accounts unless absolutely necessary.
Enforce Strong Passwords:
Implement strong password policies and enforce multi-factor authentication (MFA) to make brute-force attacks impractical.
Limit Privileges:
Ensure accounts with sensitive privileges do not have pre-authentication disabled.
Regular Audits:
Periodically audit Active Directory for misconfigurations, including accounts with
DONT_REQUIRE_PREAUTH
enabled.
Common Tools for AS-REP Roasting
Impacket (GetNPUsers.py):
Enumerates accounts with pre-authentication disabled and extracts AS-REP hashes.
Rubeus:
A powerful tool for Kerberos abuse, including AS-REP Roasting.
Cracking Tools:
Tools like
John the Ripper
andHashcat
are used to crack the extracted hashes offline.
AS-REP Roasting highlights how minor misconfigurations in Kerberos authentication can lead to significant security risks. By understanding how the attack works and implementing proactive detection and mitigation measures, organisations can better protect their Active Directory environments from credential theft and lateral movement threats.
KQL Dection Queries:
Explanation of the Query
Filter for Event ID 4768:
Event ID 4768 corresponds to "Kerberos Authentication Ticket Request" in Windows Security logs.
This is the event generated when the KDC responds with an AS-REP.
Focus on Preauthentication Disabled:
Pre-authentication disabled is indicated by FailureCode = 0x12.
The query also considers Success (0x0) to identify successful AS-REP requests that might indicate compromised accounts.
Summarisation:
Groups data by the
AccountName
andDomain
.Tracks the total number of requests (
RequestCount
) and distinct client IPs (UniqueIPs
).Also lists all involved client IPs for further investigation.
Anomalous Behavior Detection:
Flags accounts with more than 10 requests or requests originating from more than 3 unique IPs.
These thresholds (
RequestCount > 10
orUniqueIPs > 3
) can be adjusted based on your environment.
Severity Classification:
Adds a
SuspiciousActivity
field to classify detected activity as High, Moderate, or Low based on thresholds.
Presentation:
Displays key details such as account name, domain, request count, unique IPs, and their suspicious activity level for SOC analysts.
Adjustments for Environment
Tune Thresholds: Customise
RequestCount > 10
andUniqueIPs > 3
based on the normal behaviour in your organisation.Exclude Whitelisted Accounts/IPs: Use a lookup table or additional filters to exclude known safe accounts or IP addresses.
Correlate with Other Events:
Combine with Event ID 4625 (failed logons) or Event ID 4771 (Kerberos pre-auth failures) for better context.
Splunk Detection Queries
Query Breakdown
Filter for Event ID 4768:
Searches for Kerberos authentication ticket requests in Windows Security logs.
Focuses on instances where
FailureCode="0x12"
(pre-authentication is not required).
Extract Relevant Fields:
TargetUserName
: The account being requested.IpAddress
: The source IP making the request.
Aggregate Data:
Counts the number of requests per
TargetAccount
(RequestCount
).Identifies distinct source IPs (
UniqueIPs
).Captures the time range of activity (
FirstSeen
,LastSeen
).
Calculate Suspicious Score:
Assign a "High" score if both
RequestCount > 10
andUniqueIPs > 3
.Assign a "Medium" score if either condition is true.
Assigns a "Low" score for benign activity.
Filter and Display:
Excludes low-risk activity by keeping only
High
andMedium
scores.Displays a concise table with actionable details for SOC analysts.
Customisations
Threshold Tuning:
Adjust thresholds (
RequestCount > 10
andUniqueIPs > 3
) based on your organisation’s baseline activity.
Whitelist Legitimate Accounts:
Add a filter to exclude known legitimate accounts (e.g., a lookup of service accounts).
Alert Configuration:
Use this query as the basis for Splunk alerts, triggering notifications for
SuspiciousScore = High
.
Additional Recommendations
Correlation with Failed Logons:
Combine with Event ID 4625 (failed logons) to check if attackers are also attempting brute force or password spraying.
Integration with Threat Intelligence:
Cross-reference the
ClientIP
field with known malicious IPs from threat intelligence feeds.
Reference
Last updated