Hack Notes
GithubTwitterTryHackMeHackTheBox
  • Hack Notes
    • # whoami
  • πŸ•ΈοΈWeb Application Security
    • Web Application Security Notes
      • SQL Injection
        • Basic Microsoft SQL injection Cheatsheet
        • Basic PostgreSQL injection Cheatsheet
        • Basic MySQL Injection Cheatsheet
        • Basic Oracle SQLi Cheatsheet
      • Authentication Vulnerabilities
        • Authentication Flaws Checklist
        • Authentication Vulnerability Practical
      • Directory Travarsal
        • Directory Traversal Lab
      • Command Injection
        • Command Injection Labs
      • Business logic flaws
        • Business Logic Vulnerabilities Labs
      • Information Disclosure
        • Information Disclosure Labs
      • Access Control
        • Broken Access Controls in Practice
      • File Upload Vulnerability
      • Server Side Request Forgery (SSRF)
      • XML External Entity Injections
      • Web Penetration Testing Tools
  • πŸ“–Writeups
    • TryHackMe
      • The advent of Cyber 1 (2019)
      • THM Basic Pen-Testing Machine
      • THM Room CC: Pentesting
      • THM Machine DailyBugle
      • THM Machine Fortress
      • THM Machine Internal
      • THM Room: OWASP Top 10 Answers
      • THM Machine: Overpass
      • THM Machine: Overpass 2 - Hacked
      • THM Machine: Overpass 3 - Hosting
      • THM Room: Pickle Rick CTF
      • THM Machine Relevant
      • THM Machine: SkyNet
      • THM Room: Web Fundamentals
  • ☠️CNWPP
    • CNWPP
      • CNWPP Content
      • Week #1 Introduction to Pentest
      • Week #2 Pentesting Methodologies
      • Week #3 Network Pentesting
      • Week #4 Web Application Pentesting
  • πŸ›οΈActive Directory (AD)
    • Active Directory Attacks
      • LLMNR Poisoning Attack
      • SMB Relay Attack
      • IPv6 Attacks
        • IPv6 Attack In Action
      • Kerberos
        • Kerberos Pre Authentication Attack
        • Kerberoasting
        • DCsync Attack
Powered by GitBook
On this page
  • Rubeus
  • Impacket - GetUserSPN.py

Was this helpful?

  1. Active Directory (AD)
  2. Active Directory Attacks
  3. Kerberos

Kerberoasting

Continuing our exploration of Active Directory Pentesting, our current focus is on Kerberos attacks. Today, we will delve into a widely known and utilized attack name Kerberoasting

PreviousKerberos Pre Authentication AttackNextDCsync Attack

Last updated 1 year ago

Was this helpful?

As we discussed earlier, once the user obtains the Ticket Granting Ticket (TGT) from the Key Distribution Center (KDC), they can utilize it to request a Ticket Granting Service (TGS) for various services. Just like the TGT, which is encrypted with the user's password hash, the TGS is encrypted using the service account's password hash. By acquiring the TGS, we gain the opportunity to perform offline brute force attacks on the service account's password.

To be successful in a Kerberoasting attack, several conditions need to be met:

  1. Service Accounts with SPNs: The target Active Directory environment must have service accounts with Service Principal Names (SPNs) set. These SPNs are associated with specific services running on servers within the domain.

  2. Kerberos Pre-Authentication Disabled: The service accounts with SPNs should have Kerberos pre-authentication disabled. This allows an attacker to request a Ticket Granting Service (TGS) ticket without needing to provide a pre-authentication encrypted timestamp, making the attack feasible.

  3. Ticket-Granting Ticket (TGT) Obtained: The attacker needs to have already obtained a valid Ticket-Granting Ticket (TGT) to request TGS tickets on behalf of service accounts. This can be achieved through various means, such as password spraying, credential theft, or other initial access techniques.

  4. Offline Cracking Capability: After obtaining the TGS ticket for a service account, the attacker must have the capability to perform offline password cracking. This often involves using tools like Hashcat or John the Ripper to brute force or use dictionary attacks to crack the encrypted password hash within the TGS ticket.

  5. Weak Passwords: The success of the Kerberoasting attack depends on the strength and complexity of the passwords used for service accounts. Weak or easily guessable passwords can significantly expedite the offline cracking process.

  6. Detection Evasion: The attacker needs to take measures to avoid detection during the attack. This might involve using techniques to stay stealthy, such as conducting the attack during off-hours, Obfuscate common tools like rubeus.

There are various tools and techniques that can perform request TGS ticket and give us the encrypted cipher that we can use for offline cracking but to make this document and short we are only showing some but interested readers could explore other tools also.

Rubeus

After successful compile you can upload the rubeus.exe binary to your targeted machine then use the following command to get TGS encrypted cipher.

C:\Users\MrRobot\Downloads> rubeus.exe kerberoast

The above command automatically checks for kerberoastable accounts SPN and then request TGS based on it and shows you the output.

After getting the similar output you can copy the hash and put that into a file i.e hash.txt and then use hashcat or johntheripper to crack it.

$ hashcat -m 13100 -a 0 hash.txt Pass.txt

Note: Rubeus used when we have only shell on the target system without any credentials but if you have access using credentials we can use Impacket scripts to get the cipher remotely.

Impacket - GetUserSPN.py

We have used impacket scripts for various attacks before but for Kerberoasting we can use the script name GetUserSPN.py with the following syntax.

$ python3 GetUserSPN.py [DomainName]/[UsernameHere]:[PasswordHere] -dc-ip [DC IP Here] -request

Example

$ python3 ./GetUserSPNs.py za.tryhackme.com/jodie.foster:Aeha9482 -dc-ip 10.200.67.101 -request

After getting the hashes again use hashcat or JohnTheRipper to crack the password.

$ hashcat -m 19700 -a 0 hash.txt Pass.txt

Rubeus is a popular open-source tool used in Active Directory (AD) security assessments, particularly for Kerberos-related attacks. Rubeus can be use for other attacks but for this section we are using it for kerberoasting attack. Rubeus can be downloaded from its official github page but you have to compile it yourself using the instructions given in the github page.

πŸ›οΈ
Rubeus