
Security
https://hmmnm.com/watch-kerberos-in-wireshark-as-req-tgs-req-and-the-packets/
TL;DR: Every Windows domain logon produces a visible, four-step Kerberos exchange — AS-REQ, AS-REP, TGS-REQ, TGS-REP — that you can capture and decode with nothing more than Wireshark and a kerberos display filter. Reading these packets field by field teaches you how tickets, cipher types, and SPNs really work, and makes it obvious why Kerberoasting targets RC4-encrypted service accounts and why AES + gMSA shuts that door.
Authorization note: everything in this tutorial should be performed only on machines you own or are explicitly permitted to test — an isolated lab domain with a domain controller and one workstation. Capturing Kerberos traffic on networks you don’t own is illegal in most jurisdictions.
You need three things running on your lab network:
lab.localCapturing on the workstation is easiest for a first pass: you’ll see both legs of every exchange. Launch Wireshark, select your primary interface, and start the capture before you log on or lock/unlock, because Kerberos traffic happens at logon time, not continuously.
Start the capture, then trigger a fresh Kerberos exchange. Locking and unlocking the workstation (Win+L, then log back in) generates a clean AS-REQ/TGS-REQ sequence. Alternatively, from a command prompt, purge existing tickets and request new ones:
PS C:> klist purge
Current Id: 0:0x3e7
Deleting all tickets:
Tickets purged successfully.
Current Id: 0:0x3e4
Deleting all tickets:
Tickets purged successfully.
PS C:> klist get krbtgt
Current LogonId is 0:0x12a3f7
A ticket to krbtgt has been retrieved successfully.
...
Now stop the Wireshark capture and apply the display filter:
kerberos
You should see roughly this packet list:
| No. | Source | Destination | Info |
|---|---|---|---|
| 1 | 10.0.0.50 | 10.0.0.10 | AS-REQ |
| 2 | 10.0.0.10 | 10.0.0.50 | AS-REP |
| 3 | 10.0.0.50 | 10.0.0.10 | TGS-REQ |
| 4 | 10.0.0.10 | 10.0.0.50 | TGS-REP |
| 5+ | 10.0.0.50 | various | TGS-REQ / TGS-REP / AP-REQ pairs |
All Kerberos traffic rides on TCP/UDP port 88 to the DC. Packet 1–2 is the authentication exchange; packet 3–4 fetches a service ticket; everything after is the workstation requesting tickets for whatever services it touches (SMB, LDAP, DNS usually show up immediately).
Expand packet 1: Keytab 3 (Kerberos) → message-type: krb-as-req (10). The important fields:
etype: 18 (aes256-cts-hmac-sha1-96) or etype: 23 (rc4-hmac) depending on how the account is configured.18, 17, 23 (AES256, AES128, RC4).On modern fully-patched domains you may also see PA-PAC-REQUEST and, if the client is advertising newer features, additional pre-auth padata types for claims or FAST armoring.
Packet 2, message-type: krb-as-rep (11), has two encrypted blobs:
realm: LAB.LOCAL, sname: krbtgt/LAB.LOCAL, and an etype matching the krbtgt account’s configured cipher.Wireshark can decrypt ticket contents if you feed it a keytab (Preferences → Protocols → KRB5 → keytab path). In a lab where you know alice’s password and have a keytab, the ticket decodes to reveal the PAC: group SIDs, logon times, and the user’s privileges. That’s the piece the DC trusts on every subsequent request.
Packet 3 shows the client presenting the TGT:
cifs/dc01.lab.local; for LDAP, ldap/dc01.lab.local. This SPN string is exactly what an attacker enumerates and what Kerberoasting abuses.Packet 4, the TGS-REP, again contains two parts: the outer enc-part encrypted with the logon session key (from the AS-REP), and a ticket for the target service encrypted with the service account’s long-term key. Check the etype on that ticket:
ticket.enc-part.etype: 23 (rc4-hmac)
or, on a properly hardened account:
ticket.enc-part.etype: 18 (aes256-cts-hmac-sha1-96)
After the TGS exchange, every connection to the service begins with an AP-REQ (message-type 14) sent to the service, not the DC. Expand one heading toward the DC on port 445 and you’ll see:
The AP-REP (message-type 15) is optional (mutual authentication) and short — often absent on SMB since mutual auth happens inside the SPNEGO exchange.
Kerberoasting is just a TGS-REQ for an SPN belonging to an account whose password the attacker wants to crack — performed by any authenticated domain user, because the ticket’s enc-part is encrypted with the service account’s key, and the attacker has that ciphertext.
To see it in your lab, request a ticket for a service account from any domain-joined machine:
PS C:> Add-Type -AssemblyName System.IdentityModel
PS C:> New-Object System.IdentityModel.Tokens.KerberosRequestorSecurityToken -ArgumentList "MSSQLSvc/sql01.lab.local:1433"
PS C:> klist
Current LogonId is 0:0x12a3f7
Cached Tickets: (3)
#0> Client: alice @ LAB.LOCAL
Server: MSSQLSvc/sql01.lab.local:1433 @ LAB.LOCAL
KerbTicket Encryption Type: RSADSI RC4 HMAC (NT)
...
In the corresponding TGS-REP packet in Wireshark, the ticket’s enc-part is the exact blob an offline cracking tool extracts:
ticket.enc-part.etype: 23 (rc4-hmac)
ticket.enc-part.cipher: 58 bytes (the crackable blob)
Why RC4 matters: RC4-HMAC’s “encryption key” is just an MD4 hash of the account password — no salt, no key stretching. Tools can dump these blobs straight from the capture or via Rubeus kerberoast equivalent lab tooling and throw GPU wordlists at them at enormous speed. AES256 (etype 18) keys incorporate the account’s sAMAccountName and domain as salt and are dramatically slower to brute-force; combined with a long random password, offline cracking becomes impractical.
Convert a lab service account to a Group Managed Service Account and re-capture:
PS C:> Add-KdsRootKey -EffectiveTime ((Get-Date).AddHours(-10))
PS C:> New-ADServiceAccount -Name svcSQL -DNSHostName sql01.lab.local `
-KerberosEncryptionType AES256
PS C:> Install-ADServiceAccount -Identity svcSQL
Now the same TGS-REP looks different:
ticket.enc-part.etype: 18 (aes256-cts-hmac-sha1-96)
ticket.enc-part.cipher: 100+ bytes (large AES blob)
Three visible differences:
PrincipalsAllowedToRetrieveManagedPassword list, so Kerberoasting from an arbitrary workstation fails.If your capture still shows RC4 tickets after hardening, check the account’s msDS-SupportedEncryptionTypes attribute and whether KerberosEncryptionType was actually set to AES256 — legacy etypes linger on old accounts unless explicitly disabled, and domain policies enforcing “AES only” (via Network security: Configure encryption types allowed for Kerberos) are what finally kill etype 23 on the wire.
| Packet | Key fields | Encrypted with |
|---|---|---|
| AS-REQ | PA-ENC-TIMESTAMP, cname, sname=krbtgt, etype list | Timestamp: user’s key |
| AS-REP | session key, flags, lifetimes, TGT, PAC | Outer: user’s key; ticket: krbtgt’s key |
| TGS-REQ | PA-TGS-REQ (TGT), sname = target SPN | Authenticator: logon session key |
| TGS-REP | service ticket, session key for service | Outer: logon session key; ticket: service account’s key |
| AP-REQ | ticket + authenticator | Session key shared with service |
KerberosEncryptionType to AES256 on all accounts, and enforce AES-only via the “Configure encryption types allowed for Kerberos” GPO after verifying legacy compatibility.