I have been reading about Kerberos, and I understand the messages exchanged, and that it uses symmetric encryption in order to protect some of the messages. But, how does it protect against replay attacks? For example, the first message from client to KDC is not encrypted as long as I know. Even if something is encrypted, we can still replay it later. Plus I read that the clocks in Kerberos can have at most ~5 min difference. So, I guess server also keeps in cache some of the tickets received, in order to prevent from similar attacks, right?
Kerberos uses an 'authenticator' during protocol exchanges that occur between the client and the server. It holds additional authentication data, such as the ticket lifetime, and most important, the client's timestamp.
When Server-Side Kerberos validates an authentication message, it will check the authenticator's timestamp. If the timestamp is earlier or the same as a previous authenticators received within the five minutes, it will reject the packet because it treats it as a replay attack and user authentication will fail.
Server-side Kerberos additionally compares the timestamp in the authenticator to the server time. If the timestamp in the authenticator isn't within five minutes of the time on the server, it will also reject the packet.
The five minutes is the maximum difference it can tolerate between client and server, but you can change this value in windows through group policy.
In a nutshell, the crucial part is the 'authenticator' time validation.