Repository navigation
kerberos: check the AP-REP timestamp in KerberosSSP initiator - #5305
Open
musthaf-bughunter wants to merge 1 commit into
Open
musthaf-bughunter wants to merge 1 commit into
musthaf-bughunter wants to merge 1 commit into
Conversation
RFC4120 sect 3.2.5 requires the client to check that the AP-REP ctime and cusec match the authenticator it sent. Without this, an AP-REP recorded for an earlier AP-REQ made with the same ticket completes mutual authentication. AI-Assisted: yes (Claude Opus 5.5)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5305 +/- ##
=======================================
Coverage 78.99% 78.99%
=======================================
Files 375 375
Lines 98802 98807 +5
=======================================
+ Hits 78044 78050 +6
+ Misses 20758 20757 -1
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
KerberosSSP.GSS_Init_sec_contextdecrypts the AP-REP with the ticket session key and accepts it without comparing itsctime/cusecto the authenticator it sent (kerberos.py#L5838-L5845), which RFC4120 sect 3.2.5 requires. The ticket session key is the same for every AP-REQ made with a given service ticket (ST=/KEY=, ccache,Ticketer), so an AP-REP recorded from an earlier exchange completes mutual authentication of a later one. The client then uses the old subkey and sequence number, so a man-in-the-middle can impersonate the server and replay its old signed or sealed messages.The patch stores the authenticator time in the context and returns
GSS_S_DEFECTIVE_TOKENwhen the AP-REP does not match, except in passive mode. The IAKERB test fed a captured AP-REP to an AP-REQ built with the mocked 2024 date, so that step now mocks the capture time. A regression test is added tokerberos.uts.