Kerberoasting

Overview

Kerberoasting is an attack technique that targets service accounts in Active Directory environments. The goal is to request Ticket Granting Service (TGS) tickets for service accounts with Service Principal Names (SPNs) and then crack the encrypted portion offline to obtain the service account password.

What is Kerberoasting?

Key Concepts

  • Service Principal Names (SPNs): Unique identifiers for services running on servers

  • TGS (Ticket Granting Service): Part of Kerberos that issues service tickets

  • Service Accounts: Accounts used to run services, often with elevated privileges

  • Offline Cracking: Attacking the encrypted ticket without network interaction

Attack Flow

  1. Request TGS ticket for service account with SPN

  2. Extract encrypted portion of the ticket (encrypted with service account password)

  3. Crack the hash offline using tools like Hashcat or John the Ripper

  4. Obtain plaintext password for lateral movement or privilege escalation

Why Kerberoasting Works

  • Any authenticated domain user can request TGS tickets for any SPN

  • Service accounts often have weak passwords

  • Service accounts frequently have elevated privileges

  • Cracking happens offline, avoiding detection

Kerberos Authentication Flow

Normal Kerberos Process

Kerberoasting Exploitation

Discovery and Enumeration

Finding SPNs with PowerShell

LDAP Enumeration

BloodHound Enumeration

Attack Tools and Techniques

GetUserSPNs.py (Impacket)

Rubeus (Windows)

PowerShell Empire/PowerSploit

CrackMapExec Integration

Hash Cracking

Hash Formats

Hashcat Cracking

John the Ripper

Custom Wordlists

Post-Exploitation

Using Cracked Credentials

Lateral Movement

Token Impersonation

Overview

Token impersonation is a post-exploitation technique that allows attackers to impersonate other users by stealing and using their access tokens. This is particularly effective after successful Kerberoasting when you have service account credentials.

What are Tokens?

  • Definition: Temporary keys that allow access to a system/network without providing credentials each time

  • Function: Think of them as "cookies for computers"

  • Purpose: Enable seamless access to resources without repeated authentication

Token Types

Delegate Tokens

  • Purpose: Created for logging into a machine or using Remote Desktop

  • Characteristics:

    • Interactive logon sessions

    • Full user privileges

    • Can be used for network authentication

    • Higher privilege level

Impersonate Tokens

  • Purpose: "Non-interactive" operations

  • Use Cases:

    • Attaching network drives

    • Domain logon scripts

    • Automated services

  • Characteristics:

    • Limited functionality

    • Cannot be used for interactive logons

    • Lower privilege level

Token Impersonation Techniques

Using Incognito (Metasploit)

Using Invoke-TokenManipulation (PowerShell)

Manual Token Manipulation

Token Impersonation After Kerberoasting

Scenario: Service Account to Domain Admin

Post-Impersonation Actions and Limitations

Understanding Token Impersonation Limitations

Next Steps After Token Impersonation

Advanced Techniques

Targeted Kerberoasting

ASREPRoasting Integration

Golden/Silver Ticket Preparation

Defense and Detection

Preventive Measures

Detection Strategies

Honeypot Service Accounts

Practical Attack Scenarios

Scenario 1: SQL Server Service Account

Scenario 2: Web Application Service Account

Scenario 3: Exchange Service Account

Automation and Scripting

Automated Kerberoasting Script

Python Integration

Mitigation Best Practices

Service Account Security

Monitoring Implementation

Network Segmentation


Note: Always ensure proper authorization before conducting Kerberoasting attacks. These techniques should only be used in authorized penetration testing scenarios or controlled lab environments.

Last updated