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 RipperorHashcatto 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_PREAUTHattribute 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_PREAUTHenabled.
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 RipperandHashcatare 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 Detection 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
AccountNameandDomain.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 > 10orUniqueIPs > 3) can be adjusted based on your environment.
Severity Classification:
Adds a
SuspiciousActivityfield 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 > 10andUniqueIPs > 3based 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.
Query performs the following steps:
Defines the time range for the query to look back over the past 7 days.
Identifies AS-REP requests from accounts with pre-authentication disabled, filtering out known service accounts to focus on potentially suspicious activity.
Filters AS-REP requests using weak encryption types (RC4-HMAC and AES128-CTS-HMAC-SHA1-96).
Aggregates the data to count the number of AS-REP requests per TargetUserName.
Filters the results to include only those with more than 5 requests within a 1-hour timeframe.
Displays the results in a table format, sorted by time.
Explanation of the Query
Detecting AS-REP Roasting:
Looks for Event ID 4768 (Kerberos Authentication Ticket Request) with
FailureCode == "0x12", signaling a response from the KDC for accounts without preauthentication.
Rare Account Detection:
Correlates with Event ID 4624 (successful logons) to identify accounts with limited activity (
LogonCount < RareAccountThreshold).
Suspicious Scoring:
Assigns a
SuspiciousScorebased on the following:High request count (
RequestCount > Threshold_RequestCount).High number of unique IPs (
UniqueIPs > Threshold_UniqueIPs).Account rarity (
IsRareAccount == 1).
Output Insights:
Presents actionable insights such as
RequestCount,UniqueIPs, andIsRareAccountto prioritize suspicious accounts.
Customisations and Next Steps
Thresholds: Adjust the thresholds (
Threshold_RequestCount,Threshold_UniqueIPs, andRareAccountThreshold) to align with your organization's baseline.Filtering Known Activity: Add filters or join with lookup tables to exclude known safe accounts or IP addresses.
Alerting: Configure alerts in Microsoft Sentinel for
SuspiciousScore > 2to detect high-risk activities.
Query performs the following steps:
Defines the time range for the query to look back over the past 7 days.
Identifies AS-REP events (Event ID 4768) with pre-authentication disabled (FailureCode == "0x12").
Aggregates AS-REP activity to count the number of requests and unique IPs per account.
Identifies rare accounts with low authentication activity (Event ID 4624).
Combines AS-REP events with rare account information to calculate a SuspiciousScore based on multiple factors.
Displays the results in a table format, sorted by SuspiciousScore and RequestCount.
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 > 10andUniqueIPs > 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
HighandMediumscores.Displays a concise table with actionable details for SOC analysts.
Customisations
Threshold Tuning:
Adjust thresholds (
RequestCount > 10andUniqueIPs > 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
ClientIPfield with known malicious IPs from threat intelligence feeds.
Sysmon Query for AS-REP Roasting Detection
Focus on Sysmon Event ID 13:
Event ID 13 logs Kerberos Service Ticket Requests, which attackers exploit in AS-REP roasting.
Index and source (
index=sysmon) may vary based on your Splunk setup.
Extract Relevant Fields:
AccountName: The account being targeted for service ticket requests.IpAddress/SourceHost: IP address or host making the request.ComputerName: The hostname of the requesting machine.
Aggregate Data:
RequestCount: Total number of requests for the target account.UniqueIPs: Number of unique IP addresses making the requests.FirstSeen,LastSeen: Time range of activity for the target account.
Apply Suspicious Thresholds:
Flag high-frequency requests or those originating from multiple unique IPs:
High: RequestCount > 20 and UniqueIPs > 5.
Medium: RequestCount > 10 or UniqueIPs > 3.
Adjust thresholds (
RequestCount > 10,UniqueIPs > 3) based on the environment.
Filter and Present:
Excludes low-risk activity.
Displays key details (
TargetAccount,RequestingHost,RequestingIPs, etc.) for SOC analysts.
Customisations and Enhancements
Whitelist Legitimate Activity:
Exclude known safe accounts or IPs:
Time-Based Analysis:
Include
FirstSeenandLastSeento track attack patterns over time.
Dashboard Integration:
Visualize
RequestCounttrends for targeted accounts or create heatmaps ofUniqueIPs.
Additional Considerations
Correlate with Active Directory Logs:
Combine this query with Event ID 4768 from Windows Security logs for better context.
Validate with Threat Intelligence:
Check
RequestingIPsagainst known malicious IPs or threat feeds.
Query performs the following steps:
Filters events to include only those from the Sysmon index with the specified sourcetype.
Evaluates the AccountName to identify the target user.
Filters AS-REP requests (EventCode 4768) where preauthentication is not required (Status="0x12").
Aggregates the data to count the number of AS-REP requests per AccountName and the number of unique IPs.
Filters the results to include only those with more than 10 requests or more than 3 unique IPs.
Displays the results in a table format, sorted by RequestCount.
Reference
Last updated