Rare, but sometimes Linux machine is on Active Directory environment. This exposes several security risks, so it is not recommended.
Kerberos tickets are saved in /tmp
as the ccache files.
If we don’t know where Kerberos tickets are stored, we can check the environment variable KRB5CCNAME
.
Kerberos principals and encrypted keys are stored in keytab
files.
Let’s identify if Linux machine is already on the domain.
Linux usually uses realm
, sssd
, or winbind
to join AD environment.
If realm is not available, check for sssd and winbind.
Find Kerberos Ticket
find
When Kerberos ticket is created with a script, extension is usually .keytab
.
cronjobs
Cronjob might be used to run Kerberos.
Find ccache File
ccache holds Kerberos credentials whil they remain valid.
When user authenticates to the domain, ccache file is created.
We can find the find the file from KRB5CCNAME
environment variable.
Abuse KeyTab
We can impersonate user using kinit
klist
can be used to interact with Kerberos on Linux.
Let’s first find out to which user the ticket belongs to:
Now that we know the ticket belongs to carlos, we can impersonate the user using kinit
:
Let’s verify our access as such:
We can extract secrets from a keytab file.
We can attempt to crack the target account’s password getting the hash from keytab file.
KeyTabExtractcould be used for this.
Now that we have the NTLM hahs, we can do PtH.
With AES256 or ES128 hash, we can fake the ticket using Rubeus or crack it.
Tunneling for Kerberos
Let’s say scenario is like this:
Attacker → MS01 → Linux01 → KDC
We need to tunnel network from Linux01 to Attacker.
Tools such as Chisel and Proxychains can be used for this.
proxychains
Let’s first modify the host file:
Now modify proxychains configuration file to use socks5 and port 1080:
Start Chisel server on attacker machine:
Now on MS01, execute chisel client: