Using Linux

Checking if Linux is Domain Joined

$ realm list
$ ps -ef | grep -i "winbind\|sssd"

Finding Kerberos Tickets

Finding Keytab Files

Keytab are allow scripts to authenticate automatically using kerberos without password intercation or storing pass in plaintext file

To use keytab file, we need to have rw permissions on the file

Default Location: /etc/krb5.keytab

$ find / -name *keytab* -ls 2>/dev/null

Identifying Keytab Files in cronjobs

$ crontab -l

# m h  dom mon dow   command
*5/ * * * * /home/carlos@inlanefreight.htb/.scripts/kerberos_script_test.sh

$ cat /home/carlos@inlanefreight.htb/.scripts/kerberos_script_test.sh
#!/bin/bash

kinit svc_workstations@INLANEFREIGHT.HTB -k -t /home/carlos@inlanefreight.htb/.scripts/svc_workstations.kt
smbclient //dc01.inlanefreight.htb/svc_workstations -c 'ls'  -k -no-pass > /home/carlos@inlanefreight.htb/script-test-results.txt

Finding ccache files

Linux stores kerberos tickets in ccache files

Searching Environment Variables

Searching /tmp

Exploitation

Abusing keytab files

Listing keytab file information

Impersonating a user

Connecting to SMB Share as carlos

Keytab Extract

KeyTabExtractarrow-up-right

NTLM -> pass the hash

AES -> Forge tickets using Rubeus

Abusing Keytab ccache

Looking for ccache files

Identifying group membership

Importing ccache file to our current session

Using Linux Attack Tools with Kerberos

If we do not have direct connection from our attacker machine to the KDC/Domain Controller, we need to proxy using Chisel/Proxychains

Host File Modified

Proxy Chains Configuration File

Download Chisel to our attack host

Execute Chisel from our victim host

Download ccache

Using impacket with proxychains

Using Evil-Winrm

If krb5-user is already installed, change the config

Miscellaneous

If we want to use a ccache file in Windows or a kirbi file in a Linux machine, we can use impacket-ticketConverterarrow-up-right to convert them

Linikatz

Last updated