Kerberoasting is a post-exploitation attack technique that targets service accounts in Active Directory environments. Here are the steps involved:
Prerequisites
- You need valid domain credentials (any standard user account)
- Access to a domain-joined system or ability to authenticate to the domain
- The target environment must use Kerberos authentication
Attack Steps
1. Enumerate Service Principal Names (SPNs)
First, identify accounts with registered SPNs. These are typically service accounts that have Kerberos tickets associated with them. You can use tools like:
setspn -T domain -Q */* (Windows native)
- PowerView's
Get-DomainUser -SPN
- Impacket's GetUserSPNs.py
2. Request Service Tickets
Request Kerberos service tickets (TGS) for the discovered SPNs. Since any authenticated user can request service tickets, this doesn't require elevated privileges:
- Use
Add-Type -AssemblyName System.IdentityModel and New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken
- Or tools like Rubeus:
Rubeus.exe kerberoast
- From Linux:
GetUserSPNs.py domain/user:password -dc-ip <IP> -request
3. Extract Ticket Hashes
The requested tickets contain the service account's password hash encrypted with RC4, AES128, or AES256. Extract these from memory or ticket cache.
4. Crack the Hashes Offline
Transfer the hashes to your cracking system and attempt to crack them:
- Use hashcat with mode 13100 (for TGS-REP)
- John the Ripper with the krb5tgs format
- Common command:
hashcat -m 13100 hash.txt wordlist.txt
5. Use Compromised Credentials
If successful, you now have plaintext passwords for service accounts, which often have elevated privileges.
Defense Measures
To protect against kerberoasting:
- Use long, complex passwords (25+ characters) for service accounts
- Implement Managed Service Accounts (MSA) or Group Managed Service Accounts (gMSA)
- Monitor for unusual ticket requests
- Regularly audit accounts with SPNs
- Use AES encryption instead of RC4 where possible
This technique is commonly tested in penetration tests and security assessments to identify weak service account passwords that could lead to privilege escalation.