Kerberos Authentication and Delegation, Decrypted, Packet by Packet
This walkthrough uses four captures from the Wireshark wiki's SampleCaptures page, where each one is published together with a keytab that decrypts it: nodelegation.cap and delegation.cap from kerberos-Delegation.zip, s4u2self_client_mit_server_win2k16.pcapng from s4u2self_with_keys.tgz, and rbcd_win_with_keys.pcapng from rbcd_win_with_keys.tgz. Download them there. We decoded them with VisualEther, which turns a Wireshark PCAP into a sequence diagram with a plain-English caption on every message.
Kerberos is the login protocol of Windows domains, and of many Linux and macOS networks too. Its messages are mostly encrypted, so a normal capture shows names and message types but not what the tickets actually say.
These captures come with keytabs: files holding the long-term keys of some of the accounts involved. Given a keytab, Wireshark decrypts every ticket and encrypted part it has a key for, and then the session keys it finds inside unlock the rest. So we can read what normally stays hidden: ticket flags, lifetimes, session keys, the user's group list, and the record a service leaves when it acts for a user.
- A user logs in to a web page: the three basic exchanges, AS, TGS, and AP.
- The same login with unconstrained delegation: the browser hands the web server its ticket-granting ticket.
- S4U2Self: a service gets a ticket in a user's name without the user's password.
- Resource-based constrained delegation: a service uses that ticket to reach file servers as the user, in two realms.
Each capture is drawn as an annotated sequence diagram, in three forms: an interactive viewer, an HTML page, and a printable PDF. In the viewer and the HTML page, clicking any message opens its full decrypted Wireshark field tree.
This article explains what delegation does and what defenders look for. It is not a guide to abusing it.
💡 Read the walkthrough and a diagram side by side: open the interactive diagram in a split-screen window, or open the HTML version in a new tab and snap the two windows side by side. Each section below links its own diagram.
How does Kerberos authentication work?
A client proves its identity to a trusted server, the KDC (Key Distribution Center), once, and gets a ticket it can exchange for tickets to other services. The password never crosses the network, and services check tickets without contacting the KDC. Three exchanges do the work (RFC 4120 section 3):
- AS exchange (Authentication Service). The client asks for a ticket-granting ticket (TGT), proving it knows the password. In Windows the KDC runs on every domain controller.
- TGS exchange (Ticket-Granting Service). The client shows the TGT and asks for a service ticket for one service, such as
HTTP/fc4.denyDC.com. - AP exchange (Application). The client shows the service ticket to the service itself.
Every ticket comes with a session key, and each ticket is encrypted with a key the client doesn't have:
| Item | Encrypted with | Who can read it |
|---|---|---|
| TGT | The krbtgt account's key | Only the KDC |
| Service ticket | The service account's key | The service and the KDC |
| Session key, sent to the client | The user's key (AS) or the TGT session key (TGS) | The client |
| Authenticator: name and time | The ticket's session key | Whoever holds the ticket's session key |
A ticket alone proves nothing, because anyone could replay a copied one. Each request therefore adds an authenticator, a fresh timestamp encrypted with the session key. Only the real client knows that key, so a valid authenticator proves the sender is the client named in the ticket.
A realm is Kerberos's name for an administrative domain, written in capitals: DENYDC.COM, ND.C. A principal is a named account: user u1, or a service such as HTTP/fc4.denyDC.com.
Capture 1: a user logs in to a web page
User u1, on Windows XP, opens a page on an Apache server that accepts Kerberos through mod_auth_kerb. The KDC is a Windows Server 2003 domain controller for the realm DENYDC.COM. The keytab holds the web service's key.
The web server starts it. Its 401 reply carries WWW-Authenticate: Negotiate, which asks the browser to authenticate with SPNEGO, a wrapper that carries Kerberos inside HTTP headers (RFC 4559).
What does the client send in an AS-REQ?
The client's name, u1, the service it wants, krbtgt/DENYDC.COM (the KDC's own ticket-granting service), the encryption types it supports, and proof that it knows the password. That proof, PA-ENC-TIMESTAMP, is the current time encrypted with a key derived from the password (RFC 4120 section 5.2.7.2). Decrypted, it reads 12 February 2006, 12:43:04.
The capture file's own timestamps say 24 January: the sniffer's clock was wrong. Kerberos only needs the client and the KDC to agree, by default within 5 minutes.
The PA-PAC-REQUEST field asks for a PAC (Privilege Attribute Certificate): Microsoft's addition to the ticket listing the user's security identifiers and groups (MS-PAC).
What does the KDC send back in the AS-REP?
Two encrypted parts. The TGT is encrypted with the krbtgt key, which only KDCs know, so the client stores it unread; our keytab can't open it either. The second part is encrypted with u1's key, and the keytab opens it. Here is frame 10 decoded; open the enc-part of the reply:
frame : Frame 10: Packet, 1291 bytes on wire (10328 bits), 1291 bytes captured (10328 bits)
eth : Ethernet II, Src: 00:03:ff:a6:ab:0c, Dst: 00:03:ff:a7:ab:0c
Destination : 00:03:ff:a7:ab:0c
Source : 00:03:ff:a6:ab:0c
ip : Internet Protocol Version 4, Src: 10.5.3.1, Dst: 10.5.12.5
Differentiated Services Field : 0x00 (DSCP: CS0, ECN: Not-ECT)
000. .... = Flags : 0x0
udp : User Datagram Protocol, Src Port: 88, Dst Port: 2564
Timestamps
kerberos : Kerberos
as-rep
cname
cname-string : 1 item
ticket
sname
sname-string : 2 items
enc-part
cipher […] : 16c7253ae263e3d1ffaf34fe8aa6d8b2df6a058d6f7b304145674b9b9f3cf5c9eaecfd90481ab2ac4c24ce92eabb94e2dce7447f6247291b416a0006da706d42229f79c059c14729468369b2682ee9aa946a4c137c0c810f85f604592b13f962a80eb7821e8f924df34adb25fa7e61ed9
Missing keytype 23 usage 2 (id=missing.1)
Expert Info (Warning/Decryption) : Missing keytype 23 usage 2 (id=missing.1)
Expert Info (Warning/Decryption) : Used keymap=all_keys num_keys=1 num_tries=1)
enc-part
cipher […] : 0418be397e3b2323063af0a674e9510983536c4558c0fba8f0c2cab3302c84ea79159cd03a9d5f1be08b1bf0a1806e23e40bc1250f1ab03b0fe2d5f2aa4a48a32a8c8026f9da8925ca19def561f3150520670a7ab1638d05b47edcf56dde3c8782778f480bf6b64dc07f906e718198222
Decrypted keytype 23 usage 3 using keytab principal HTTP/fc4.denydc.com@DENYDC.COM (id=keytab.1 same=0) (3dbde697…)
Expert Info (Chat/Security) : Decrypted keytype 23 usage 3 using keytab principal HTTP/fc4.denydc.com@DENYDC.COM (id=keytab.1 same=0) (3dbde697…)
Expert Info (Chat/Security) : Used keymap=all_keys num_keys=1 num_tries=1)
encASRepPart
key
Learnt encASRepPart_key keytype 23 (id=10.1) (8f9f7cba…)
Expert Info (Chat/Security) : Learnt encASRepPart_key keytype 23 (id=10.1) (8f9f7cba…)
last-req : 1 item
LastReq item
flags : 40e00000
sname
sname-string : 2 items
caddr : 1 item XP1<20>
HostAddress XP1<20>
Provides learnt encASRepPart_key in frame 10 keytype 23 (id=10.1 same=0) (8f9f7cba…)
Expert Info (Chat/Security) : Provides learnt encASRepPart_key in frame 10 keytype 23 (id=10.1 same=0) (8f9f7cba…)
Missing keytype 23 usage 2 missing in frame 10 keytype 23 (id=missing.1 same=0) ()
Expert Info (Warning/Decryption) : Missing keytype 23 usage 2 missing in frame 10 keytype 23 (id=missing.1 same=0) ()
Used keytab principal HTTP/fc4.denydc.com@DENYDC.COM keytype 23 (id=keytab.1 same=0) (3dbde697…)
Expert Info (Chat/Security) : Used keytab principal HTTP/fc4.denydc.com@DENYDC.COM keytype 23 (id=keytab.1 same=0) (3dbde697…)
Inside are the session key that goes with the TGT, an RC4 key, and the TGT's flags: forwardable, renewable, initial (issued by the AS exchange, not the TGS), and pre-authent (the client proved its password first). The TGT is valid for 10 hours and renewable for 7 days, the Windows defaults.
The keytab here holds only the web service's key, yet it opens u1's part too, so in this lab u1 and the web service share a key. RC4 keys are an unsalted hash of the password, so two accounts with the same password have the same key.
What is pre-authentication, and why does a KDC reject the first AS-REQ?
Pre-authentication is the encrypted timestamp. Without it, anyone could ask the KDC for a user's AS-REP and try to guess the password offline from it, an attack known as AS-REP roasting. Active Directory therefore requires it by default.
A client that doesn't know which key type to use sends its first AS-REQ without it and lets the KDC say what it wants. The RBCD capture (capture 4) shows that round trip in frames 7 to 10:
- Frame 7: AS-REQ for the computer account
WINC$, no pre-authentication. - Frame 8:
KRB-ERRORPREAUTH_REQUIRED(error 25). ItsETYPE-INFO2hint names AES-256 and the saltND.Chostwinc.nd.c, the realm plushostplus the hostname, which the client needs to derive its AES key. - Frame 9: the AS-REQ again, now with the timestamp.
- Frame 10: the AS-REP.
A PREAUTH_REQUIRED error is therefore normal, not a failed login. A failed login is PREAUTH_FAILED (error 24), sent when the timestamp doesn't decrypt.
What is inside a service ticket?
In frame 11 the client sends its TGT back to the KDC, with an authenticator, and asks for HTTP/fc4.denyDC.com. The service ticket in frame 12 is encrypted with the web service's key, so the keytab opens it:
- client
u1and realmDENYDC.COM, - a new session key, for the client and the web server,
- flags
forwardable,renewable,pre-authent, - the same end time as the TGT,
- the PAC: user RID 1111, groups 513 (Domain Users) and 512 (Domain Admins), and a signature from the KDC.
The KDC copied the PAC from the TGT into the service ticket. The web server learns u1's groups from the ticket, without querying the directory.
How does the web server check the ticket without asking the KDC?
It decrypts the ticket with its own key and takes out the session key. With that it decrypts the authenticator the client sent alongside (frame 20). The name in the authenticator matches the ticket, and the time is current. So the sender holds the session key and must be u1.
The authenticator in frame 20 carries a GSS-API checksum (type 0x8003, RFC 4121 section 4.1.1) with flags. The client asks for mutual authentication and sets Deleg to 0: it gives the server nothing beyond proof of identity. Capture 2 changes that one flag.
The server answers with SPNEGO accept-completed: authentication succeeded. The page then fails with a 500 error from the application, which is not a Kerberos problem; the delegation capture ends the same way.
What is Kerberos delegation?
Delegation lets a service act as the user toward a second service: a web front end reading the user's files from a file server, for example. The second service then sees the user, not the front end. Kerberos has three ways to do this:
| Kind | How the front end gets tickets as the user | Who allows it |
|---|---|---|
| Unconstrained | The user's client forwards its TGT | Front-end account trusted for delegation |
| Constrained | S4U2Proxy, for listed services only | Front-end account lists the allowed targets |
| Resource-based constrained (RBCD) | S4U2Proxy | Target account lists the allowed front ends |
S4U (Service for User) is Microsoft's pair of Kerberos extensions for this, defined in MS-SFU. S4U2Self gets a ticket to the front end itself in the user's name. S4U2Proxy turns such a ticket into a ticket for the back-end service. MIT Kerberos implements both as well.
Capture 2: unconstrained delegation forwards the TGT
The same client and web server, with the web service's account trusted for delegation. The user this time is Administrator. The client already holds its tickets, so the capture has no AS or TGS exchange: just the 401 and one authenticated request.
How does the client know it may forward its TGT?
The service ticket tells it. Decrypted with the web service's key, the ticket in frame 18 carries one flag the ticket in capture 1 lacked: ok-as-delegate. The KDC sets it when the service account is trusted for delegation (MS-KILE section 3.3.5.1), and a client configured to honor it then forwards the user's TGT.
| Field in frame 18 | Capture 1 (no delegation) | Capture 2 (delegation) |
|---|---|---|
| Service ticket flags | forwardable, renewable, pre-authent | Those, plus ok-as-delegate |
GSS checksum Deleg flag | 0 | 1 |
| Delegation data in the authenticator | None | A 1,232-byte KRB-CRED |
What does a forwarded TGT look like on the wire?
It rides inside the authenticator. The KRB-CRED message holds Administrator's TGT, still encrypted with the krbtgt key, plus its session key, encrypted with the session key of the web service ticket. The web server can open that part, and so can we. An excerpt of Wireshark's decode of frame 18:
authenticator (decrypted with the HTTP/fc4 ticket's session key)
cksumtype: cKSUMTYPE-GSSAPI (32771)
.... ...1 = Deleg: Delegate credentials to remote peer
DlgOpt: 1
DlgLen: 1232
krb-cred
tickets: krbtgt/DENYDC.COM (TGT, krbtgt key: not decrypted)
enc-part (decrypted with the same session key)
key: eTYPE-ARCFOUR-HMAC-MD5 (the TGT's session key)
flags: 60a00000 forwardable, forwarded, renewable, pre-authent
endtime: Feb 10, 2006 04:16:52
renew-till: Feb 16, 2006 18:16:52
sname: krbtgt/DENYDC.COM
With the TGT and its session key, the web server can request tickets to any service in the domain as Administrator, until the ticket expires and for as long as it can renew it. Nothing in the ticket limits which services.
Why is unconstrained delegation risky?
Because the server ends up holding every visiting user's TGT. The PAC in this capture shows what one visit handed over: user RID 500, the built-in Administrator, in Domain Admins (512), Schema Admins (518), Enterprise Admins (519), and Group Policy Creator Owners (520). Anyone who gains control of that web server can use the TGTs cached there.
One account setting would have stopped the forwarding, and the decrypted PAC shows it was off. Marking an account "sensitive and cannot be delegated" (the NOT_DELEGATED flag) tells the KDC not to issue it forwardable tickets (MS-KILE 3.3.5.1); here the PAC's account flags show it clear. Since Windows Server 2012 R2, members of the Protected Users group get the same treatment.
Capture 3: S4U2Self gets a ticket in a user's name
Unconstrained delegation needs the user to arrive with Kerberos. Often the user doesn't: they sign in to a website with a form, a token, or a certificate. S4U2Self, also called protocol transition, lets the service get a Kerberos ticket for such a user anyway.
Here an MIT Kerberos client runs as the service account apache and talks to a Windows Server 2016 KDC in realm ND.C. The user is isaac. The keytab holds apache's key.
Frames 1 to 4 are apache's own AS exchange, with the same PREAUTH_REQUIRED round trip as above.
How does a service find the user's realm?
By asking for a TGT in the user's name, without pre-authentication. In frame 5 apache sends an AS-REQ for isaac@nd, an enterprise name (a user principal name rather than a bare account name). It can't log in as isaac and doesn't try.
MS-SFU section 3.1.5.1.1.2 describes this lookup: the KDC that holds the account answers PREAUTH_REQUIRED, and any other KDC answers with a referral to the right realm. Frame 6 is PREAUTH_REQUIRED, so isaac's account is in ND.C. Windows does the same: the RBCD capture opens with this lookup for two users.
What does an S4U2Self request contain?
A TGS-REQ for a ticket to the service itself, sname = apache, authenticated with apache's own TGT, plus the user's name in two padata fields: PA-FOR-USER (type 129) and its newer form PA-S4U-X509-USER (type 130) (MS-SFU sections 2.2.1 and 2.2.2). PA-FOR-USER carries a checksum keyed with the TGT's session key, so the KDC knows the service itself chose the name. Here is frame 7; open the padata entries:
frame : Frame 7: Packet, 1898 bytes on wire (15184 bits), 1898 bytes captured (15184 bits) on interface -, id 0
Interface id : 0 (-)
sll : Linux cooked capture v1
ip : Internet Protocol Version 4, Src: 192.168.47.100, Dst: 192.168.47.105
Differentiated Services Field : 0x00 (DSCP: CS0, ECN: Not-ECT)
010. .... = Flags : 0x2, Don't fragment
tcp : Transmission Control Protocol, Src Port: 45034, Dst Port: 88, Seq: 1, Ack: 1, Len: 1830
Conversation completeness : Incomplete (0)
Flags : 0x018 (PSH, ACK)
Options : (12 bytes), No-Operation (NOP), No-Operation (NOP), Timestamps
TCP Option - No-Operation (NOP)
TCP Option - No-Operation (NOP)
TCP Option - Timestamps : TSval 3158225194, TSecr 50916391
Timestamps
kerberos : Kerberos
Record Mark : 1826 bytes
tgs-req
padata : 4 items
PA-DATA pA-TGS-REQ
padata-type : pA-TGS-REQ (1)
padata-value […] : 6e82047730820473a003020105a10302010ea20703050000000000a38203b9618203b5308203b1a003020105a1061b044e442e43a2193017a003020102a110300e1b066b72627467741b044e442e43a382038530820381a003020112a103020102a28203730482036fd69a2d873
ap-req
ap-options : 00000000
ticket
sname
sname-string : 2 items
enc-part
cipher […] : d69a2d873dfdb1c4e35ccbfa0cbc5a60a7cbe6d0592931c42050ab1c8ae1341f26198d29d974fb38b8c26fb9c31f1ee7015dd56d761aa5aa786f8e1791f0811ac4aa2ba80b0b0d1012da75d4eec0d9b8a7044e14017ea9a10f38958f71e59480333f3f5eb09d4cc050b0188e42992402e
Missing keytype 18 usage 2 (id=missing.1)
Expert Info (Warning/Decryption) : Missing keytype 18 usage 2 (id=missing.1)
Expert Info (Warning/Decryption) : Used keymap=all_keys num_keys=6 num_tries=1)
authenticator
cipher […] : 93b7cdf6748b16e6c549077a0df28159d5b3d663d184a32d14adf6e0f9413313616328493c464197ad7aee02d6be9872e72248dd3f175aa929ed0f374bb9898d752e73eb05bf27de9d7a4b56dac70486fb947c6f2144a7d8a40bd3eca5aeb31db26b93a1b9a85b951746aaf2891ac62d0
Decrypted keytype 23 usage 7 using learnt encASRepPart_key in frame 4 (id=4.1 same=0) (33b55e47…)
Expert Info (Chat/Security) : Decrypted keytype 23 usage 7 using learnt encASRepPart_key in frame 4 (id=4.1 same=0) (33b55e47…)
Expert Info (Chat/Security) : Used keymap=all_keys num_keys=6 num_tries=2)
authenticator
cname
cname-string : 1 item
cksum
subkey
Learnt authenticator_subkey keytype 23 (id=7.1) (8a11ba9f…)
Expert Info (Chat/Security) : Learnt authenticator_subkey keytype 23 (id=7.1) (8a11ba9f…)
PA-DATA Unknown:222
padata-type : Unknown (222)
PA-DATA pA-FOR-USER
padata-type : pA-FOR-USER (129)
padata-value : 3049a0153013a00302010aa10c300a1b086973616163406e64a1061b044e442e43a21c301aa0040202ff76a112041034ac408820c75ae7dfa2f072614107bea30a1b084b65726265726f73
name
name-string : 1 item
cksum
PA-DATA pA-FOR-X509-USER
padata-type : pA-FOR-X509-USER (130)
padata-value : 3051a0323030a00602044c65c954a1153013a00302010aa10c300a1b086973616163406e64a2061b044e442e43a40703050020000000a11b3019a003020102a1120410e053d4cec74b792a8b74e135b6c0c343
user-id
cname
name-string : 1 item
checksum
req-body
kdc-options : 40810000
sname
sname-string : 1 item
etype : 1 item
Provides learnt authenticator_subkey in frame 7 keytype 23 (id=7.1 same=0) (8a11ba9f…)
Expert Info (Chat/Security) : Provides learnt authenticator_subkey in frame 7 keytype 23 (id=7.1 same=0) (8a11ba9f…)
Missing keytype 18 usage 2 missing in frame 7 keytype 18 (id=missing.1 same=0) ()
Expert Info (Warning/Decryption) : Missing keytype 18 usage 2 missing in frame 7 keytype 18 (id=missing.1 same=0) ()
Used learnt encASRepPart_key in frame 4 keytype 23 (id=4.1 same=0) (33b55e47…)
Expert Info (Chat/Security) : Used learnt encASRepPart_key in frame 4 keytype 23 (id=4.1 same=0) (33b55e47…)
What does the KDC return, and why isn't it forwardable?
A ticket to apache for client isaac@nd, with a PAC describing isaac: user RID 1103, group 513, user principal name isaac@nd.c, and a logon count of 0. The account has never logged on at this domain controller, yet the service now holds a ticket with its groups. That is the purpose of S4U2Self: the service can authorize the user locally.
The request asked for forwardable, but the ticket isn't. MS-SFU section 3.2.5.1.2 ties that flag to whether the service account is trusted to authenticate for delegation, and this KDC left it off. Classic constrained delegation refuses non-forwardable evidence tickets, so apache can't use this ticket with it. Resource-based delegation can, as the next capture shows.
Capture 4: resource-based constrained delegation (S4U2Proxy)
This is the richest capture. WINC$, the computer account of a Windows server, acts for domain users toward file shares (cifs/… services) on two domain controllers: NDC in the realm ND.C, and TDC in its child realm TD.ND.C. The keytab holds the krbtgt, trust, WINC$, and NDC$ keys, so even the TGTs open.
The capture has 22 Kerberos messages in seven phases:
- Frames 1 to 4: realm lookup and S4U2Self for user
ayala. Nothing more happens for ayala. - Frames 5 to 6: realm lookup for user
hagit, 229 seconds later. - Frames 7 to 10: WINC$ gets a fresh TGT, the AS exchange described in capture 1.
- Frames 11 to 12: S4U2Self for hagit. As in capture 3, the ticket is not forwardable.
- Frames 13 to 15: S4U2Proxy to
cifs/ndc.nd.c, in the same realm. - Frames 16 to 20: S4U2Proxy to
cifs/tdc.td.nd.c, in the child realm, which returns referrals. - Frames 21 to 25: the child realm's KDC issues the final ticket.
How does S4U2Proxy work?
The service presents the user's ticket to itself as evidence and asks for a ticket to another service in the user's name. Frame 13 is that request, for cifs/ndc.nd.c, and three things mark it:
- the
kdc-optionsbitcname-in-addl-tkt(bit 14; Wireshark labels itconstrained-delegation): take the client name from the additional ticket, not from the TGT (MS-SFU 2.2.3), - the additional ticket is hagit's S4U2Self ticket from frame 12, decrypted here with WINC$'s key: client
hagit@nd, not forwardable, PA-PAC-OPTIONS(type 167) with theresource-based-constrained-delegationbit set (MS-SFU 2.2.5).
What does the KDC check for resource-based constrained delegation?
The target, not the front end. In classic constrained delegation, the front end's account lists the services it may delegate to (msDS-AllowedToDelegateTo in Active Directory), and a non-forwardable evidence ticket is refused. With the RBCD bit set, that refusal doesn't apply (MS-SFU 3.2.5.2.1). The KDC instead checks the target account's list of services allowed to act on behalf of other identities, msDS-AllowedToActOnBehalfOfOtherIdentity (MS-SFU 3.2.5.2.3).
Frame 15 shows the KDC granted it: a ticket to cifs/ndc.nd.c for client hagit@nd, flags forwardable and ok-as-delegate. So the target's account lists WINC$.
What does a delegated ticket record?
The services that delegated it. The keytab holds NDC$'s key, so the ticket in frame 15 opens, and its PAC has a buffer the user's own tickets lack, S4U delegation info (MS-SFU 2.2.4 and 3.2.5.2.4):
encTicketPart (decrypted with NDC$'s key)
cname: hagit@nd
flags: 40a50000 forwardable, renewable, pre-authent, ok-as-delegate, enc-pa-rep
PAC
Logon Info (1) hagit's account and groups
S4U Delegation Info (11)
S4U2proxyTarget: cifs/ndc.nd.c
TransitedListSize: 1
Transited Service: winc$@ND.C
The file server sees hagit's identity and groups, and that WINC$ obtained the ticket on hagit's behalf. In this capture, hagit sent no password and no ticket to anyone.
How does delegation cross into another realm?
Through referrals, with the user's identity carried in the PAC. NDC can't issue tickets for services in TD.ND.C, so when WINC$ asks for cifs/tdc.td.nd.c in frame 16, NDC returns a referral TGT for krbtgt/TD.ND.C in frame 18, encrypted with the inter-realm trust key. Decrypted, the referral names WINC$ as its client but carries hagit's PAC, with client name hagit@nd@ND.C, and its delegation info already names the target. MS-SFU 3.2.5.1.1 describes exactly this: the service as client, the user in the PAC.
To talk to TDC, WINC$ also needs a TGT of its own that TD.ND.C accepts; it gets one in frames 19 and 20. In frames 21 and 22 it also fetches a ticket to cifs/tdc.td.nd.c in its own name, which the final request doesn't use.
Frame 23 is the S4U2Proxy request TDC decides on: WINC$'s referral TGT authenticates the request, and hagit's referral from frame 18 is the evidence ticket. TDC checks the target's own msDS-AllowedToActOnBehalfOfOtherIdentity and, in frame 25, issues a ticket to cifs/tdc.td.nd.c for client hagit@nd of realm ND.C.
What do defenders look for?
Delegation is a normal part of many deployments, so the questions are which accounts may delegate, to what, and whether that changed. Each capture points at one setting.
- Accounts trusted for unconstrained delegation. They receive the TGT of every user who authenticates to them, as capture 2 showed. Domain controllers have this setting by default; few other servers need it. Service tickets to such accounts carry the
ok-as-delegateflag. - Accounts allowed to use protocol transition. A service trusted to authenticate for delegation gets forwardable S4U2Self tickets for almost any user, without that user's password. Keep the list short and its targets specific.
- Changes to
msDS-AllowedToActOnBehalfOfOtherIdentity. In RBCD, whoever can write this attribute on a target account decides who may delegate to it. Audit changes to it (directory-change auditing, Windows event 5136). - Privileged users protected from delegation. "Sensitive and cannot be delegated" or Protected Users membership keeps an admin's tickets non-forwardable. Capture 2's Administrator was not marked sensitive.
- Who delegated what. The S4U delegation info in a delegated ticket names each transited service, and Windows records it in the "Transited Services" field of service-ticket event 4769. A service ticket naming an unexpected front end is worth a look.
For the matching textbook diagram, see our Kerberos sequence diagram. For a capture-based look at detecting AS-REP roasting and Kerberoasting, see the Kerberos AS, TGS, and AP case study.
Frequently asked questions
What is the difference between AS-REQ and TGS-REQ? An AS-REQ asks for a TGT and proves the password, with an encrypted timestamp. A TGS-REQ asks for a ticket to one service and proves identity with the TGT and an authenticator; no password is involved.
What is a TGT in Kerberos? A ticket-granting ticket: a ticket to the KDC's own ticket-granting service, encrypted with the krbtgt key. The client presents it to get service tickets for the rest of the day without entering a password again.
Why does Kerberos return PREAUTH_REQUIRED? The client's first AS-REQ didn't include the encrypted timestamp. The error tells the client which key type and salt to use, and the client retries. It is a normal step, not a failed login.
What is the PAC? The Privilege Attribute Certificate, Microsoft's addition to tickets. It lists the user's security identifier and groups, signed by the KDC, so services can authorize the user without querying Active Directory.
What is the difference between S4U2Self and S4U2Proxy? S4U2Self gets a ticket to the service itself in a user's name. S4U2Proxy uses such a ticket as evidence to get a ticket to another service in the user's name.
What is the difference between constrained and resource-based constrained delegation? In constrained delegation, the front-end service's account lists where it may delegate. In resource-based constrained delegation, the target service's account lists who may delegate to it, and a non-forwardable S4U2Self ticket is accepted as evidence.
Can you decrypt Kerberos traffic in Wireshark? Yes, with a keytab for the accounts whose keys encrypt the tickets: set the KRB5 preferences "Try to decrypt Kerberos blobs" and the keytab file, or pass -o kerberos.decrypt:TRUE -K <keytab> to tshark. Session keys found in decrypted parts then unlock the rest.
Takeaways
- Three exchanges do the work. AS gets a TGT with the password, TGS trades the TGT for service tickets, and AP presents a ticket to the service.
- Every ticket travels with a session key and is checked with an authenticator. The service decrypts the ticket with its own key and never asks the KDC.
PREAUTH_REQUIREDis normal. It tells the client how to derive its key;PREAUTH_FAILEDis the real failure.- The PAC carries the user's groups, copied from the TGT into every service ticket.
- Unconstrained delegation hands over the TGT.
ok-as-delegateinvites it, and aKRB-CREDin the authenticator delivers it. - S4U2Self needs no user password, and its ticket is forwardable only for services trusted for protocol transition.
- RBCD is decided by the target, accepts a non-forwardable evidence ticket, and leaves a record of every transited service in the PAC.