Jamal Darbo// Security PortfolioPortfolio v1
Portfolio Blog
Back to blog

Identity & Access

How Kerberos recognizes a replayed authentication request

How services detect reused authenticators, why replay history matters, and what replay checks can and cannot establish.

Kerberos series: view the reading order

A Kerberos ticket and a separate glowing key in front of a secured gateway

Imagine Jamal’s computer sending an authentication request to an RDP server. The server accepts it, and the connection continues. A moment later, someone sends an exact copy of that same authentication request.

The ticket has not changed. The encrypted data has not been modified. Even the timestamp might still look recent. Yet the server must distinguish the second request from the first. Otherwise, a message that was valid once could become something an observer repeatedly uses.

In the earlier articles, we established that using a ticket requires its associated session key. Here, we can take that understanding further by examining something that cryptography alone does not provide: a record of what has already happened. How does a service recognize an authentication request it has processed before? What happens when that record disappears? And what can the service conclude when a request has no matching entry?

We will continue with Jamal connecting to rdp01.lab.example, using credentials for TERMSRV/rdp01.lab.example. His computer has already completed the TGS exchange. Our starting point is the client/server authentication exchange described in RFC 4120, section 3.2.

What makes an authentication request a duplicate?

Jamal’s computer constructs a KRB_AP_REQ containing the service ticket and an encrypted authenticator. For this discussion, the relevant authenticator fields are his principal name and realm, together with ctime and cusec. These last two fields represent the timestamp’s seconds and microseconds.

The receiving service performs several checks before accepting the authentication. These include checking that the client identity in the authenticator matches the ticket, that the ticket is valid, and that the authenticator’s timestamp is within the permitted clock difference. Replay detection is an additional check. MIT’s request-processing documentation describes checking the authenticator against a replay cache and storing it when no conflict is found: MIT Kerberos: processing an authentication request.

Suppose Jamal’s authenticator contains a timestamp of 10:00:00.123456. The server receives it, completes its checks, and records its use. Two seconds later, an identical authentication request arrives. Its timestamp could still pass the time check, but the server now has evidence that this authenticator has already appeared.

The replay cache supplies the history that is missing from the incoming message.

The RFC describes recording who authenticated, which service they contacted, and the timestamp down to its microseconds. This matters because a timestamp is not globally unique. Two different users authenticating at the same moment should not automatically be treated as duplicates. The comparison concerns the authentication evidence associated with the relevant identities.

For Jamal’s example, we can distinguish three cases:

RequestAuthenticator timestampReplay-check result
Jamal’s original request10:00:00.123456No previous matching record
An exact copy received two seconds later10:00:00.123456Previously seen authenticator
A newly generated request from Jamal10:00:03.654321A separate authenticator, still subject to all checks

The table illustrates the comparison rather than the exact storage format of every implementation. Modern implementations can use information derived from the encrypted authenticator to distinguish requests. MIT’s file2 format, for example, stores a compact tag derived from the authenticator ciphertext’s checksum, together with a timestamp: MIT Kerberos: replay-cache file format.

There is also a legitimate source of ambiguity here. A computer can produce authentication requests faster than its clock supplies distinct readings, especially when multiple processes authenticate at once. Two requests might therefore have matching timestamp fields without anyone deliberately replaying a message. MIT’s collision-avoidance work (MIT Kerberos: replay-cache collision avoidance) addresses this problem by incorporating additional information about the authenticator. A duplicate indication needs context before we interpret it as evidence of an attacker.

Why replay protection needs reliable memory

A replay cache participates in the authentication decision. Losing an entry can change whether a request is accepted, even when the request itself remains identical.

Consider a hypothetical sequence. Jamal authenticates successfully, and the service records his authenticator. Shortly afterwards, a failure removes the relevant replay history. An observer then submits the original request again while its timestamp remains acceptable. If the service simply starts with an empty cache, the previously processed request could appear unseen.

A previously accepted authenticator can appear unseen after replay history is lost; the diagram also states the required rejection interval
A hypothetical unsafe scenario.

RFC 4120 explicitly addresses this situation: a server that loses track of authenticators within the allowable clock-skew interval must reject requests until that interval has passed. This requirement concerns lost replay history; it does not mean every service restart automatically requires a waiting period.

The same issue can appear across multiple instances of a service. Imagine two instances, A and B, configured to accept authentication for the same service principal. Instance A processes Jamal’s request, but B maintains an independent history. A copy sent to B could look new to B even though the service identity has already accepted it elsewhere. This is a hypothetical shared-service deployment, rather than an assumption about how RDP servers are normally configured.

For servers sharing a service principal, RFC 4120 requires a shared replay cache or an application protocol that provides suitable replay protection without one.

There is a smaller version of this coordination problem inside a single server. Suppose two worker processes receive the same authenticator almost simultaneously. Both check the cache before either has recorded the request. Without coordination, both could conclude that the authenticator is new. Checking and recording therefore need to work together reliably under concurrent access.

MIT’s file2 implementation uses an exclusive file lock while accessing the replay-cache file. Its documented processing searches for an existing match before writing a new entry.

What the replay cache cannot tell you

A matching entry means the service has evidence of earlier use. An absent entry establishes much less.

Imagine an attacker intercepting an authentication message and preventing it from reaching its intended recipient. The message has been created, but the recipient has never recorded it. If that authenticator can be presented to another compatible service, a cache lookup alone cannot identify it as previously used.

An attacker blocks the original authentication request and presents it to another compatible service, where no previous replay record exists
An intercepted authenticator may still appear unseen if its original delivery was prevented.

Whether it produces a useful attack depends on the application protocol and what receiving the authentication message causes the service to do. An unseen authenticator is not, by itself, proof that the current connection belongs to the intended client.

A replay cache helps a service recognize previously used authentication messages. It does not prevent every interception or relay scenario, so the application’s other protections still matter.

A repeated request does not automatically mean an attack. A client might retry after receiving no response. A replay rejection tells us that the service detected a duplicate, not why it happened. Understanding the cause requires looking at the surrounding activity.

Jamal’s second request may still contain valid encrypted data and an acceptable timestamp. The service rejects it because it remembers the first request. That history is part of the protection.

Sources