π«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
Domain Admins: Highest priority - immediate domain compromise
Service Admins: Accounts with admin rights on multiple systems
Database Services: Often have elevated privileges (MSSQL, Oracle, SAP)
Exchange Services: May have high privileges in Exchange environments
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_cmdshellService 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