Brazil - SMB3overKerberos (network)

When we investigate the PCAP, we notice many AS-REQ packets which is indicative of an AS-REP Roasting Attack.
The rough outline of kerberos authentication is:
The client requests a TGT from the Authentication Server (AS) with an AS-REQ.
The AS returns a message containing the TGT to the client in an AS-REP.
The client saves the obtained TGT in the LSASS memory of the terminal.
Because the cached TGT in memory proves that the client has been authenticated, the client sends a TGS-REQ to the server, including the information of the service to be used.
The server returns data including the service session key to the client in a TGS-REP.
The client uses the service session key and service session ID obtained from the TGSREP to access the desired service (e.g., SMB).
I used https://github.com/jalvarezz13/Krb5RoastParser to parse AS-REQ packets using the command
and cracked the hash via hashcat using
this allows us to find that the password for Charles@LAB.LOCAL is Passw0rd!
Now using Charles' credentials, we need to obtain the TGT session key from the AS-REP Packet (packet 103). The ciphertext is shown here:

Details on this encryption can be found at the following links: https://datatracker.ietf.org/doc/html/rfc3962 https://blog.redforce.io/windows-authentication-attacks-part-2-kerberos
Now we can use impacket for the decryption of the cipher, which gives us the session key:
The result is:
So the session key is 0x09325be3bd041fe8a26024d029b46c80376ed00c42a5e54611d4126e109a4e7d.
Now we need to obtain the service session key for from the TGS-REP packet which is packet 113.

We can decrypt this using the TGS Session Key we just obtained as follows:
The session key we get is fa1a501f6828025cc5feb7dfe1968de4. Recall that we need both service session key and service session id to decrypt the encrypted SMB3 packets. We can get the service session id from packet 119 where the SMB session was established.

To decrypt the smb traffic, in Wireshark, go to Edit > Preference > Protocols > SMB2, select Edit in Secret session keys for decryption, and enter the service session ID and service session key. Note that the Session ID obtained above was 0x0000bc000000003d, but endian conversion is required when entering it from Wireshark settings. Service Session ID: 3d00000000bc0000 Service Session Key: fa1a501f6828025cc5feb7dfe1968de4
Now we can go to the read response to the read request for flag.txt and view the decrypted smb response, thus obtaining the flag: CSG_FLAG{Nothing_escapes_my_sight!}

Last updated