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.

  1. A user logs in to a web page: the three basic exchanges, AS, TGS, and AP.
  2. The same login with unconstrained delegation: the browser hands the web server its ticket-granting ticket.
  3. S4U2Self: a service gets a ticket in a user's name without the user's password.
  4. 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):

Every ticket comes with a session key, and each ticket is encrypted with a key the client doesn't have:

ItemEncrypted withWho can read it
TGTThe krbtgt account's keyOnly the KDC
Service ticketThe service account's keyThe service and the KDC
Session key, sent to the clientThe user's key (AS) or the TGT session key (TGS)The client
Authenticator: name and timeThe ticket's session keyWhoever 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.

sequenceDiagram accTitle: Kerberos login to a web page accDescr: The client requests a page and the web server answers 401 with WWW-Authenticate Negotiate. The client sends an AS-REQ with an encrypted timestamp to the KDC and receives an AS-REP with a TGT. It sends a TGS-REQ for HTTP/fc4 and receives a TGS-REP with the service ticket. It then repeats the page request with an Authorization header holding the AP-REQ, and the server accepts it. participant K as KDC participant C as Client participant W as Web server C->>W: [4] GET /lxgdoc/ W->>C: [6] 401, WWW-Authenticate Negotiate C->>K: [9] AS-REQ, encrypted timestamp K->>C: [10] AS-REP, TGT and session key C->>K: [11] TGS-REQ for HTTP/fc4, with TGT K->>C: [12] TGS-REP, service ticket C->>W: [20] GET, Authorization Negotiate (AP-REQ) W->>C: [22] SPNEGO accept-completed
Capture 1: the web server asks for Kerberos, and the client runs all three exchanges. Frame numbers are in brackets.

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:

✅ [00004] Frame 10 AS-REP (TGT) 2006-01-24T10:36:36.599912Z 🏛 KDC (Windows 2003 DC) → 🖥 Client (IE on Windows XP)
frame : Frame 10: Packet, 1291 bytes on wire (10328 bits), 1291 bytes captured (10328 bits)
Encapsulation type : Ethernet (1)
Arrival Time : Jan 24, 2006 16:06:36.599912000 India Standard Time
UTC Arrival Time : Jan 24, 2006 10:36:36.599912000 UTC
Epoch Arrival Time : 1138098996.599912000
Time shift for this packet : 0.000000000 seconds
Time delta from previous captured frame : 76.006000 milliseconds
Time delta from previous displayed frame : 76.006000 milliseconds
Time since reference or first frame : 254.379000 milliseconds
Frame Number : 10
Frame Length : 1291 bytes (10328 bits)
Capture Length : 1291 bytes (10328 bits)
Frame is marked : False
Frame is ignored : False
Protocols in frame : eth:ethertype:ip:udp:kerberos
Character encoding : ASCII (0)
eth : Ethernet II, Src: 00:03:ff:a6:ab:0c, Dst: 00:03:ff:a7:ab:0c
Destination : 00:03:ff:a7:ab:0c
Destination (resolved) : 00:03:ff:a7:ab:0c
Destination OUI : 00:03:ff (Microsoft Corporation)
Destination OUI (resolved) : Microsoft Corporation
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Address : 00:03:ff:a7:ab:0c
Address (resolved) : 00:03:ff:a7:ab:0c
Address OUI : 00:03:ff (Microsoft Corporation)
Address OUI (resolved) : Microsoft Corporation
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Source : 00:03:ff:a6:ab:0c
Source (resolved) : 00:03:ff:a6:ab:0c
Source OUI : 00:03:ff (Microsoft Corporation)
Source OUI (resolved) : Microsoft Corporation
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Address : 00:03:ff:a6:ab:0c
Address (resolved) : 00:03:ff:a6:ab:0c
Address OUI : 00:03:ff (Microsoft Corporation)
Address OUI (resolved) : Microsoft Corporation
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Type : IPv4 (0x0800)
Stream index : 1
ip : Internet Protocol Version 4, Src: 10.5.3.1, Dst: 10.5.12.5
0100 .... = Version : 4
.... 0101 = Header Length : 20 bytes (5)
Differentiated Services Field : 0x00 (DSCP: CS0, ECN: Not-ECT)
0000 00.. = Differentiated Services Codepoint : Default (0)
.... ..00 = Explicit Congestion Notification : Not ECN-Capable Transport (0)
Total Length : 1277
Identification : 0x44e6 (17638)
000. .... = Flags : 0x0
0... .... = Reserved bit : Not set
.0.. .... = Don't fragment : Not set
..0. .... = More fragments : Not set
...0 0000 0000 0000 = Fragment Offset : 0
Time to Live : 128
Protocol : UDP (17)
Header Checksum : 0xcdfa [validation disabled]
Header checksum status : Unverified
Source Address : 10.5.3.1
Source or Destination Address : 10.5.3.1
Source Host : 10.5.3.1
Source or Destination Host : 10.5.3.1
Destination Address : 10.5.12.5
Source or Destination Address : 10.5.12.5
Destination Host : 10.5.12.5
Source or Destination Host : 10.5.12.5
Stream index : 1
udp : User Datagram Protocol, Src Port: 88, Dst Port: 2564
Source Port : 88
Destination Port : 2564
Source or Destination Port : 88
Source or Destination Port : 2564
Length : 1257
Checksum : 0xa226 [unverified]
Checksum Status : Unverified
Stream index : 0
Stream Packet Number : 2
Timestamps
Time since first frame : 76.006000 milliseconds
Time since previous frame : 76.006000 milliseconds
UDP payload (1249 bytes)
kerberos : Kerberos
as-rep
pvno : 5
msg-type : krb-as-rep (11)
crealm : DENYDC.COM
cname
name-type : kRB5-NT-PRINCIPAL (1)
cname-string : 1 item
CNameString : u1
ticket
tkt-vno : 5
realm : DENYDC.COM
sname
name-type : kRB5-NT-SRV-INST (2)
sname-string : 2 items
SNameString : krbtgt
SNameString : DENYDC.COM
enc-part
etype : eTYPE-ARCFOUR-HMAC-MD5 (23)
kvno : 2
cipher […] : 16c7253ae263e3d1ffaf34fe8aa6d8b2df6a058d6f7b304145674b9b9f3cf5c9eaecfd90481ab2ac4c24ce92eabb94e2dce7447f6247291b416a0006da706d42229f79c059c14729468369b2682ee9aa946a4c137c0c810f85f604592b13f962a80eb7821e8f924df34adb25fa7e61ed9
Missing keytype 23 usage 2 (id=missing.1)
Expert Info (Warning/Decryption) : Missing keytype 23 usage 2 (id=missing.1)
Missing keytype 23 usage 2 (id=missing.1)
Message : Missing keytype 23 usage 2 (id=missing.1)
Severity level : Warning
Group : Decryption
Expert Info (Warning/Decryption) : Used keymap=all_keys num_keys=1 num_tries=1)
Used keymap=all_keys num_keys=1 num_tries=1)
Message : Used keymap=all_keys num_keys=1 num_tries=1)
Severity level : Warning
Group : Decryption
enc-part
etype : eTYPE-ARCFOUR-HMAC-MD5 (23)
kvno : 10
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…)
Decrypted keytype 23 usage 3 using keytab principal HTTP/fc4.denydc.com@DENYDC.COM (id=keytab.1 same=0) (3dbde697…)
Message : Decrypted keytype 23 usage 3 using keytab principal HTTP/fc4.denydc.com@DENYDC.COM (id=keytab.1 same=0) (3dbde697…)
Severity level : Chat
Group : Security
Expert Info (Chat/Security) : Used keymap=all_keys num_keys=1 num_tries=1)
Used keymap=all_keys num_keys=1 num_tries=1)
Message : Used keymap=all_keys num_keys=1 num_tries=1)
Severity level : Chat
Group : Security
encASRepPart
key
KeyHiddenItem
Learnt encASRepPart_key keytype 23 (id=10.1) (8f9f7cba…)
Expert Info (Chat/Security) : Learnt encASRepPart_key keytype 23 (id=10.1) (8f9f7cba…)
Learnt encASRepPart_key keytype 23 (id=10.1) (8f9f7cba…)
Message : Learnt encASRepPart_key keytype 23 (id=10.1) (8f9f7cba…)
Severity level : Chat
Group : Security
keytype : eTYPE-ARCFOUR-HMAC-MD5 (23)
keyvalue : 8f9f7cba60f4f77d38c6f9b52a0d073b
last-req : 1 item
LastReq item
lr-type : lR-NONE (0)
lr-value : Feb 12, 2006 12:43:05.000000000 India Standard Time
nonce : 1158780760
key-expiration : Sep 14, 2037 08:18:05.000000000 India Standard Time
flags : 40e00000
0... .... = reserved : False
.1.. .... = forwardable : True
..0. .... = forwarded : False
...0 .... = proxiable : False
.... 0... = proxy : False
.... .0.. = may-postdate : False
.... ..0. = postdated : False
.... ...0 = invalid : False
1... .... = renewable : True
.1.. .... = initial : True
..1. .... = pre-authent : True
...0 .... = hw-authent : False
.... 0... = transited-policy-checked : False
.... .0.. = ok-as-delegate : False
.... ..0. = unused : False
.... ...0 = enc-pa-rep : False
0... .... = anonymous : False
authtime : Feb 12, 2006 12:43:05.000000000 India Standard Time
starttime : Feb 12, 2006 12:43:05.000000000 India Standard Time
endtime : Feb 12, 2006 22:43:05.000000000 India Standard Time
renew-till : Feb 19, 2006 12:43:05.000000000 India Standard Time
srealm : DENYDC.COM
sname
name-type : kRB5-NT-SRV-INST (2)
sname-string : 2 items
SNameString : krbtgt
SNameString : DENYDC.COM
caddr : 1 item XP1<20>
HostAddress XP1<20>
addr-type : nETBIOS (20)
NetBIOS Name : XP1<20> (Server service)
Response to : 9
Time from request : 76.006000 milliseconds
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…)
Provides learnt encASRepPart_key in frame 10 keytype 23 (id=10.1 same=0) (8f9f7cba…)
Message : Provides learnt encASRepPart_key in frame 10 keytype 23 (id=10.1 same=0) (8f9f7cba…)
Severity level : Chat
Group : Security
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) ()
Missing keytype 23 usage 2 missing in frame 10 keytype 23 (id=missing.1 same=0) ()
Message : Missing keytype 23 usage 2 missing in frame 10 keytype 23 (id=missing.1 same=0) ()
Severity level : Warning
Group : Decryption
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…)
Used keytab principal HTTP/fc4.denydc.com@DENYDC.COM keytype 23 (id=keytab.1 same=0) (3dbde697…)
Message : Used keytab principal HTTP/fc4.denydc.com@DENYDC.COM keytype 23 (id=keytab.1 same=0) (3dbde697…)
Severity level : Chat
Group : Security
Rendered from a Wireshark PCAP by VisualEther.

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:

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:

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:

KindHow the front end gets tickets as the userWho allows it
UnconstrainedThe user's client forwards its TGTFront-end account trusted for delegation
ConstrainedS4U2Proxy, for listed services onlyFront-end account lists the allowed targets
Resource-based constrained (RBCD)S4U2ProxyTarget 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 18Capture 1 (no delegation)Capture 2 (delegation)
Service ticket flagsforwardable, renewable, pre-authentThose, plus ok-as-delegate
GSS checksum Deleg flag01
Delegation data in the authenticatorNoneA 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.

sequenceDiagram accTitle: S4U2Self protocol transition accDescr: The apache service sends an AS-REQ, gets PREAUTH_REQUIRED, retries with a timestamp, and receives its TGT. It sends an AS-REQ for isaac with no pre-authentication and gets PREAUTH_REQUIRED, which confirms the realm. It then sends a TGS-REQ for a ticket to itself with PA-FOR-USER naming isaac, and receives a ticket for isaac that is not forwardable. participant S as apache (service) participant K as KDC S->>K: [1] AS-REQ for apache K->>S: [2] PREAUTH_REQUIRED S->>K: [3] AS-REQ with timestamp K->>S: [4] AS-REP, apache's TGT S->>K: [5] AS-REQ for isaac, no timestamp K->>S: [6] PREAUTH_REQUIRED, the account is here S->>K: [7] TGS-REQ (S4U2Self) to apache for isaac K->>S: [8] TGS-REP, ticket for isaac, not forwardable
Capture 3: the service authenticates, finds the user's realm, and asks for a ticket in the user's name. Frame numbers are in brackets.

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:

🎫 [00007] Frame 7 TGS-REQ (S4U2Self) 2018-12-03T23:32:32.057107Z 🖥 apache (service, MIT client) → 🏛 KDC (Windows Server 2016)
frame : Frame 7: Packet, 1898 bytes on wire (15184 bits), 1898 bytes captured (15184 bits) on interface -, id 0
Section number : 1
Interface id : 0 (-)
Interface name : -
Encapsulation type : Linux cooked-mode capture v1 (25)
Arrival Time : Dec 4, 2018 05:02:32.057107000 India Standard Time
UTC Arrival Time : Dec 3, 2018 23:32:32.057107000 UTC
Epoch Arrival Time : 1543879952.057107000
Time shift for this packet : 0.000000000 seconds
Time delta from previous captured frame : 4.646000 milliseconds
Time delta from previous displayed frame : 4.646000 milliseconds
Time since reference or first frame : 1.140363000 seconds
Frame Number : 7
Frame Length : 1898 bytes (15184 bits)
Capture Length : 1898 bytes (15184 bits)
Frame is marked : False
Frame is ignored : False
Protocols in frame : sll:ethertype:ip:tcp:kerberos
Character encoding : ASCII (0)
sll : Linux cooked capture v1
Packet type : Sent by us (4)
Link-layer address type : Ethernet (1)
Link-layer address length : 6
Source : 00:0c:29:b7:70:fc
Unused : 0000
Protocol : IPv4 (0x0800)
ip : Internet Protocol Version 4, Src: 192.168.47.100, Dst: 192.168.47.105
0100 .... = Version : 4
.... 0101 = Header Length : 20 bytes (5)
Differentiated Services Field : 0x00 (DSCP: CS0, ECN: Not-ECT)
0000 00.. = Differentiated Services Codepoint : Default (0)
.... ..00 = Explicit Congestion Notification : Not ECN-Capable Transport (0)
Total Length : 1882
Identification : 0x4c90 (19600)
010. .... = Flags : 0x2, Don't fragment
0... .... = Reserved bit : Not set
.1.. .... = Don't fragment : Set
..0. .... = More fragments : Not set
...0 0000 0000 0000 = Fragment Offset : 0
Time to Live : 64
Protocol : TCP (6)
Header Checksum : 0x06f0 [validation disabled]
Header checksum status : Unverified
Source Address : 192.168.47.100
Source or Destination Address : 192.168.47.100
Source Host : 192.168.47.100
Source or Destination Host : 192.168.47.100
Destination Address : 192.168.47.105
Source or Destination Address : 192.168.47.105
Destination Host : 192.168.47.105
Source or Destination Host : 192.168.47.105
Stream index : 0
tcp : Transmission Control Protocol, Src Port: 45034, Dst Port: 88, Seq: 1, Ack: 1, Len: 1830
Source Port : 45034
Destination Port : 88
Source or Destination Port : 45034
Source or Destination Port : 88
Stream index : 0
Stream Packet Number : 1
Conversation completeness : Incomplete (0)
..0. .... = RST : Absent
...0 .... = FIN : Absent
.... 0... = Data : Absent
.... .0.. = ACK : Absent
.... ..0. = SYN-ACK : Absent
.... ...0 = SYN : Absent
Completeness Flags : [ Null ]
TCP Segment Len : 1830
Sequence Number : 1 (relative sequence number)
Sequence Number (raw) : 3903111822
Next Sequence Number : 1831 (relative sequence number)
Acknowledgment Number : 1 (relative ack number)
Acknowledgment number (raw) : 1132480738
1000 .... = Header Length : 32 bytes (8)
Flags : 0x018 (PSH, ACK)
000. .... .... = Reserved : Not set
...0 .... .... = Accurate ECN : Not set
.... 0... .... = Congestion Window Reduced : Not set
.... .0.. .... = ECN-Echo : Not set
.... ..0. .... = Urgent : Not set
.... ...1 .... = Acknowledgment : Set
.... .... 1... = Push : Set
.... .... .0.. = Reset : Not set
.... .... ..0. = Syn : Not set
.... .... ...0 = Fin : Not set
TCP Flags : ·······AP···
Window : 229
Calculated window size : 229
Window size scaling factor : -1 (unknown)
Checksum : 0xe76a [unverified]
Checksum Status : Unverified
Urgent Pointer : 0
Options : (12 bytes), No-Operation (NOP), No-Operation (NOP), Timestamps
TCP Option - No-Operation (NOP)
Kind : No-Operation (1)
TCP Option - No-Operation (NOP)
Kind : No-Operation (1)
TCP Option - Timestamps : TSval 3158225194, TSecr 50916391
Kind : Time Stamp Option (8)
Length : 10
Timestamp value : 3158225194
Timestamp echo reply : 50916391
Timestamps
Time since first frame in this TCP stream : 0.000000000 seconds
Time since previous frame in this TCP stream : 0.000000000 seconds
Client Contiguous Streams : 0
Server Contiguous Streams : 1
TCP payload (1830 bytes)
PDU Size : 1830
kerberos : Kerberos
Record Mark : 1826 bytes
0... .... .... .... .... .... .... .... = Reserved : Not set
.000 0000 0000 0000 0000 0111 0010 0010 = Record Length : 1826
tgs-req
pvno : 5
msg-type : krb-tgs-req (12)
padata : 4 items
PA-DATA pA-TGS-REQ
padata-type : pA-TGS-REQ (1)
padata-value […] : 6e82047730820473a003020105a10302010ea20703050000000000a38203b9618203b5308203b1a003020105a1061b044e442e43a2193017a003020102a110300e1b066b72627467741b044e442e43a382038530820381a003020112a103020102a28203730482036fd69a2d873
ap-req
pvno : 5
msg-type : krb-ap-req (14)
ap-options : 00000000
0... .... = reserved : False
.0.. .... = use-session-key : False
..0. .... = mutual-required : False
ticket
tkt-vno : 5
realm : ND.C
sname
name-type : kRB5-NT-SRV-INST (2)
sname-string : 2 items
SNameString : krbtgt
SNameString : ND.C
enc-part
etype : eTYPE-AES256-CTS-HMAC-SHA1-96 (18)
kvno : 2
cipher […] : d69a2d873dfdb1c4e35ccbfa0cbc5a60a7cbe6d0592931c42050ab1c8ae1341f26198d29d974fb38b8c26fb9c31f1ee7015dd56d761aa5aa786f8e1791f0811ac4aa2ba80b0b0d1012da75d4eec0d9b8a7044e14017ea9a10f38958f71e59480333f3f5eb09d4cc050b0188e42992402e
Missing keytype 18 usage 2 (id=missing.1)
Expert Info (Warning/Decryption) : Missing keytype 18 usage 2 (id=missing.1)
Missing keytype 18 usage 2 (id=missing.1)
Message : Missing keytype 18 usage 2 (id=missing.1)
Severity level : Warning
Group : Decryption
Expert Info (Warning/Decryption) : Used keymap=all_keys num_keys=6 num_tries=1)
Used keymap=all_keys num_keys=6 num_tries=1)
Message : Used keymap=all_keys num_keys=6 num_tries=1)
Severity level : Warning
Group : Decryption
authenticator
etype : eTYPE-ARCFOUR-HMAC-MD5 (23)
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…)
Decrypted keytype 23 usage 7 using learnt encASRepPart_key in frame 4 (id=4.1 same=0) (33b55e47…)
Message : Decrypted keytype 23 usage 7 using learnt encASRepPart_key in frame 4 (id=4.1 same=0) (33b55e47…)
Severity level : Chat
Group : Security
Expert Info (Chat/Security) : Used keymap=all_keys num_keys=6 num_tries=2)
Used keymap=all_keys num_keys=6 num_tries=2)
Message : Used keymap=all_keys num_keys=6 num_tries=2)
Severity level : Chat
Group : Security
authenticator
authenticator-vno : 5
crealm : ND.C
cname
name-type : kRB5-NT-PRINCIPAL (1)
cname-string : 1 item
CNameString : apache
cksum
cksumtype : cKSUMTYPE-RSA-MD5 (7)
checksum : 6165d2b72b26ad3d0f68b299c6531437
cusec : 43781
ctime : Dec 4, 2018 05:02:34.000000000 India Standard Time
subkey
KeyHiddenItem
Learnt authenticator_subkey keytype 23 (id=7.1) (8a11ba9f…)
Expert Info (Chat/Security) : Learnt authenticator_subkey keytype 23 (id=7.1) (8a11ba9f…)
Learnt authenticator_subkey keytype 23 (id=7.1) (8a11ba9f…)
Message : Learnt authenticator_subkey keytype 23 (id=7.1) (8a11ba9f…)
Severity level : Chat
Group : Security
keytype : eTYPE-ARCFOUR-HMAC-MD5 (23)
keyvalue : 8a11ba9f7c358cbe1bbad5d427108f3a
PA-DATA Unknown:222
padata-type : Unknown (222)
padata-value […] : a082016430820160a11c301aa0040202ff76a11204108d569c167d7e9ac58e92800e2d1c2058a282013e3082013aa003020117a28201310482012d3b1b41e4b6e572660bd18bbc9540dbcdf1a484b979107048ceaf10716103723c8e930fd251275e35b57b0b0f64676d8df7432
PA-DATA pA-FOR-USER
padata-type : pA-FOR-USER (129)
padata-value : 3049a0153013a00302010aa10c300a1b086973616163406e64a1061b044e442e43a21c301aa0040202ff76a112041034ac408820c75ae7dfa2f072614107bea30a1b084b65726265726f73
name
name-type : kRB5-NT-ENTERPRISE-PRINCIPAL (10)
name-string : 1 item
KerberosString : isaac@nd
realm : ND.C
cksum
cksumtype : cKSUMTYPE-HMAC-MD5 (-138)
checksum : 34ac408820c75ae7dfa2f072614107be
auth : Kerberos
PA-DATA pA-FOR-X509-USER
padata-type : pA-FOR-X509-USER (130)
padata-value : 3051a0323030a00602044c65c954a1153013a00302010aa10c300a1b086973616163406e64a2061b044e442e43a40703050020000000a11b3019a003020102a1120410e053d4cec74b792a8b74e135b6c0c343
user-id
nonce : 1281739092
cname
name-type : kRB5-NT-ENTERPRISE-PRINCIPAL (10)
name-string : 1 item
KerberosString : isaac@nd
crealm : ND.C
options : 20000000
checksum
cksumtype : cKSUMTYPE-RSA-MD4 (2)
checksum : e053d4cec74b792a8b74e135b6c0c343
req-body
kdc-options : 40810000
0... .... = reserved : False
.1.. .... = forwardable : True
..0. .... = forwarded : False
...0 .... = proxiable : False
.... 0... = proxy : False
.... .0.. = allow-postdate : False
.... ..0. = postdated : False
.... ...0 = unused7 : False
1... .... = renewable : True
.0.. .... = unused9 : False
..0. .... = unused10 : False
...0 .... = opt-hardware-auth : False
.... 0... = unused12 : False
.... .0.. = unused13 : False
.... ..0. = constrained-delegation : False
.... ...1 = canonicalize : True
0... .... = request-anonymous : False
.0.. .... = unused17 : False
..0. .... = unused18 : False
...0 .... = unused19 : False
.... 0... = unused20 : False
.... .0.. = unused21 : False
.... ..0. = unused22 : False
.... ...0 = unused23 : False
0... .... = unused24 : False
.0.. .... = unused25 : False
..0. .... = disable-transited-check : False
...0 .... = renewable-ok : False
.... 0... = enc-tkt-in-skey : False
.... .0.. = unused29 : False
.... ..0. = renew : False
.... ...0 = validate : False
realm : ND.C
sname
name-type : kRB5-NT-PRINCIPAL (1)
sname-string : 1 item
SNameString : apache
till : Dec 4, 2018 15:02:32.000000000 India Standard Time
nonce : 1281739092
etype : 1 item
ENCTYPE : eTYPE-ARCFOUR-HMAC-MD5 (23)
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…)
Provides learnt authenticator_subkey in frame 7 keytype 23 (id=7.1 same=0) (8a11ba9f…)
Message : Provides learnt authenticator_subkey in frame 7 keytype 23 (id=7.1 same=0) (8a11ba9f…)
Severity level : Chat
Group : Security
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) ()
Missing keytype 18 usage 2 missing in frame 7 keytype 18 (id=missing.1 same=0) ()
Message : Missing keytype 18 usage 2 missing in frame 7 keytype 18 (id=missing.1 same=0) ()
Severity level : Warning
Group : Decryption
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…)
Used learnt encASRepPart_key in frame 4 keytype 23 (id=4.1 same=0) (33b55e47…)
Message : Used learnt encASRepPart_key in frame 4 keytype 23 (id=4.1 same=0) (33b55e47…)
Severity level : Chat
Group : Security
Rendered from a Wireshark PCAP by VisualEther.

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:

  1. Frames 1 to 4: realm lookup and S4U2Self for user ayala. Nothing more happens for ayala.
  2. Frames 5 to 6: realm lookup for user hagit, 229 seconds later.
  3. Frames 7 to 10: WINC$ gets a fresh TGT, the AS exchange described in capture 1.
  4. Frames 11 to 12: S4U2Self for hagit. As in capture 3, the ticket is not forwardable.
  5. Frames 13 to 15: S4U2Proxy to cifs/ndc.nd.c, in the same realm.
  6. Frames 16 to 20: S4U2Proxy to cifs/tdc.td.nd.c, in the child realm, which returns referrals.
  7. 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:

sequenceDiagram accTitle: S4U2Self followed by S4U2Proxy accDescr: WINC$ sends a TGS-REQ with PA-FOR-USER naming hagit and receives a ticket to itself for hagit that is not forwardable. It then sends a TGS-REQ for cifs/ndc.nd.c with cname-in-addl-tkt, the S4U2Self ticket as additional ticket, and the RBCD bit in PA-PAC-OPTIONS. The KDC returns a ticket to cifs/ndc.nd.c for hagit, whose PAC names WINC$ as a transited service. participant K as NDC (KDC) participant S as WINC$ S->>K: [11] TGS-REQ (S4U2Self) to WINC$ for hagit K->>S: [12] ticket for hagit, not forwardable S->>K: [13] TGS-REQ (S4U2Proxy) cifs/ndc, evidence ticket, RBCD bit K->>S: [15] ticket to cifs/ndc for hagit
Capture 4, phases 4 and 5: S4U2Self, then S4U2Proxy to a file server in the same realm. Frame numbers are in brackets.

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.

sequenceDiagram accTitle: Cross-realm S4U2Proxy accDescr: WINC$ asks NDC for cifs/tdc for hagit and receives a referral TGT to TD.ND.C carrying hagit's PAC. It asks NDC for cifs/tdc in its own name and receives its own referral TGT. It asks TDC for cifs/tdc for itself and gets that ticket. Finally it sends TDC an S4U2Proxy request with its own referral TGT and hagit's referral as evidence, and receives a ticket to cifs/tdc for hagit. participant N as NDC (KDC, ND.C) participant S as WINC$ participant T as TDC (KDC, TD.ND.C) S->>N: [16] S4U2Proxy cifs/tdc for hagit N->>S: [18] referral TGT, client WINC$, PAC hagit S->>N: [19] TGS-REQ cifs/tdc for WINC$ N->>S: [20] referral TGT for WINC$ S->>T: [21] TGS-REQ cifs/tdc for WINC$ T->>S: [22] ticket to cifs/tdc for WINC$ S->>T: [23] S4U2Proxy, evidence = referral from [18] T->>S: [25] ticket to cifs/tdc for hagit
Capture 4, phases 6 and 7: S4U2Proxy into the child realm through referrals. Frame numbers are in brackets.

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.

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

  1. 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.
  2. 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.
  3. PREAUTH_REQUIRED is normal. It tells the client how to derive its key; PREAUTH_FAILED is the real failure.
  4. The PAC carries the user's groups, copied from the TGT into every service ticket.
  5. Unconstrained delegation hands over the TGT. ok-as-delegate invites it, and a KRB-CRED in the authenticator delivers it.
  6. S4U2Self needs no user password, and its ticket is forwardable only for services trusted for protocol transition.
  7. RBCD is decided by the target, accepts a non-forwardable evidence ticket, and leaves a record of every transited service in the PAC.