🎫Kerberoasting from Linux

πŸ“‹ Overview

Kerberoasting is a powerful lateral movement and privilege escalation technique that targets Service Principal Names (SPNs) in Active Directory environments. This attack exploits the fact that any domain user can request Kerberos tickets for service accounts, and these tickets are encrypted with the service account's NTLM hash, making them susceptible to offline password cracking attacks. Service accounts often have elevated privileges and weak passwords, making Kerberoasting one of the most effective AD attack techniques.

🎯 Attack Theory and Context

πŸ” What are Service Principal Names (SPNs)?

  • SPNs are unique identifiers that Kerberos uses to map service instances to service accounts

  • Service Accounts run services to overcome network authentication limitations of built-in accounts

  • Domain Context allows any domain user to request tickets for any SPN in the same domain

  • Cross-Forest attacks are possible if authentication is permitted across trust boundaries

πŸŽͺ Why Kerberoasting is Effective

  • High Privileges: Service accounts often have local admin or Domain Admin rights

  • Weak Passwords: Services frequently use weak or default passwords for convenience

  • Multiple Systems: Service accounts may have admin rights across multiple servers

  • Group Membership: Often added to privileged groups like Domain Admins (directly or nested)

  • Business Critical: Service accounts rarely have password expiration policies

⚑ Attack Prerequisites

  • Domain User Credentials: Cleartext password, NTLM hash, or Kerberos ticket

  • Domain Context: Shell in domain user context or SYSTEM level access

  • Domain Controller Access: Ability to query DC for SPN information

  • Network Connectivity: Access to domain network and DC (port 88, 389, 445)


πŸ”§ Attack Scenarios and Methods

πŸ“Š Common Attack Vectors

Scenario

Requirements

Method

Non-domain Linux

Valid domain credentials

Impacket GetUserSPNs.py

Domain-joined Linux

Root access, keytab file

Kerberos authentication

Domain-joined Windows

Domain user authentication

PowerView, Rubeus, built-in tools

SYSTEM on Windows

Local SYSTEM privileges

Multiple tool options

runas /netonly

Non-domain Windows host

Credential impersonation

πŸ› οΈ Tool Options for Linux Attacks

  • Impacket GetUserSPNs.py: Primary Linux tool for SPN enumeration and ticket extraction

  • Kerberos Utils: Native Linux Kerberos tools (kinit, klist, etc.)

  • Custom Scripts: Python/Bash scripts leveraging LDAP and Kerberos libraries

  • CrackMapExec: Integrated Kerberoasting functionality

  • Rubeus: Windows tool that can be run through Wine

⚠️ Attack Effectiveness Considerations

  • Strong Passwords: Modern environments may use complex service account passwords

  • Managed Service Accounts: Group Managed Service Accounts (GMSA) resist this attack

  • Detection: Security teams may monitor for unusual TGS ticket requests

  • Cracking Time: TGS tickets take longer to crack than NTLM hashes


πŸ”§ Impacket Installation and Setup

πŸ“¦ Installing Impacket Toolkit

Installation Output:

πŸ” GetUserSPNs.py Help and Options

Key Command Options:


🎯 Complete Kerberoasting Workflow

πŸ” Phase 1: SPN Discovery and Enumeration

Example SPN Enumeration Output:

🎫 Phase 2: TGS Ticket Extraction

Extract All TGS Tickets

Target Specific High-Value Accounts

Example TGS Ticket Output:

πŸ” Phase 3: Offline Password Cracking

Hashcat Cracking Process

Example Successful Crack:

βœ… Phase 4: Credential Validation

Example Validation Output:


🎯 HTB Academy Lab Solutions

πŸ“ Lab Questions & Solutions

🎫 Question 1: "Retrieve the TGS ticket for the SAPService account. Crack the ticket offline and submit the password as your answer."

Solution Process:

Complete Lab Workflow:

Expected Answer Format: [password] (e.g., Password123 or !SAPPassword2022)

πŸ‘₯ Question 2: "What powerful local group on the Domain Controller is the SAPService user a member of?"

Solution Process:

Common Powerful Local Groups:

  • Backup Operators: Can backup and restore files (bypass NTFS permissions)

  • Server Operators: Can manage domain controllers

  • Account Operators: Can modify user accounts

  • Print Operators: Can manage printers and print queues

  • Administrators: Full administrative rights

  • Remote Desktop Users: Can log in via RDP

Expected Answer Format: [Group Name] (e.g., Backup Operators)


πŸ”§ Advanced Kerberoasting Techniques

🎯 Targeted SPN Enumeration

πŸ” Optimized Cracking Strategies

πŸ” Cross-Domain Kerberoasting

πŸ”„ Automation and Scripting


πŸ” Alternative Tools and Methods

πŸ› οΈ Rubeus via Wine (Linux)

πŸ”§ CrackMapExec Integration

🐍 Custom Python Scripts


⚑ Quick Reference Commands

πŸ”§ Essential Kerberoasting Workflow

πŸ“Š Common SPN Patterns

Service

SPN Format

Common Ports

MSSQL

MSSQLSvc/server.domain.com:1433

1433, 1434

HTTP

HTTP/server.domain.com

80, 443, 8080

LDAP

ldap/server.domain.com

389, 636, 3268

CIFS/SMB

cifs/server.domain.com

445, 139

WinRM

WSMAN/server.domain.com

5985, 5986

Exchange

exchangeMDB/server.domain.com

135, 993, 995

Terminal Services

TERMSRV/server.domain.com

3389


πŸ”‘ Key Takeaways

βœ… Attack Success Factors

  • Weak Passwords: Service accounts with dictionary or predictable passwords

  • High Privileges: Accounts with Domain Admin or local admin rights

  • Multiple SPNs: Users with several service registrations increase attack surface

  • Legacy Systems: Older environments often have weaker service account security

🎯 Target Prioritization

  1. Domain Admins: Highest priority - immediate domain compromise

  2. Service Admins: Accounts with admin rights on multiple systems

  3. Database Services: Often have elevated privileges (MSSQL, Oracle, SAP)

  4. Exchange Services: May have high privileges in Exchange environments

  5. Backup Services: Often have backup operator rights

⚠️ Detection and Evasion

  • Unusual TGS Requests: Large numbers of ticket requests may trigger alerts

  • Service Account Monitoring: Some orgs monitor service account authentication

  • Behavioral Analysis: Rapid successive ticket requests are suspicious

  • Time-based Attacks: Spread requests over time to avoid detection

  • Legitimate SPNs: Focus on real service accounts rather than user accounts with SPNs

πŸš€ Post-Exploitation Opportunities

  • SQL Server Access: Use cracked MSSQL service accounts for xp_cmdshell

  • Service Impersonation: Create service tickets for the compromised SPN

  • Privilege Escalation: Use high-privilege service accounts for lateral movement

  • Persistence: Service accounts often don't change passwords frequently


Kerberoasting remains one of the most effective Active Directory attack techniques - by targeting the intersection of service requirements and administrative convenience, it often provides a direct path to high-privilege access in enterprise environments.

Last updated