Skip to content

kerberos: check ticket and authenticator times in KerberosSSP acceptor - #5240

Open
musthaf-bughunter wants to merge 1 commit into
secdev:masterfrom
musthaf-bughunter:kerberos-acceptor-ticket-times
Open

musthaf-bughunter wants to merge 1 commit into
secdev:masterfrom
musthaf-bughunter:kerberos-acceptor-ticket-times

Conversation

@musthaf-bughunter

Copy link
Copy Markdown

Description

KerberosSSP.GSS_Accept_sec_context decrypts the ticket and the authenticator but never checks the ticket starttime/endtime or the authenticator ctime (kerberos.py#L5903-L5931). A server using KerberosSSP (SMB, LDAP, DCE/RPC) therefore accepts expired tickets, and an AP-REQ captured on the wire can be replayed at any later time.

# ticket encrypted with the server key, endtime 2 years ago
server = KerberosSSP(SPN="cifs/dc1", KEY=SKEY)
_, _, status = server.GSS_Accept_sec_context(None, ap_req)
assert status == GSS_S_COMPLETE  # before this patch

The patch applies the RFC4120 sect 3.2.3 checks with a 5 minute skew and returns KRB_AP_ERR_TKT_NYV / KRB_AP_ERR_TKT_EXPIRED / KRB_AP_ERR_SKEW. Passive mode (pcap decryption) skips them. The dcerpc.uts KerberosSSP functional test used a captured, expired ticket, so it now refreshes its times with Ticketer. A regression test is added to kerberos.uts.

GSS_Accept_sec_context never checked the ticket validity period or the
authenticator timestamp (RFC4120 sect 3.2.3), so expired tickets and
replayed AP-REQs were accepted.

AI-Assisted: yes (Claude Opus 5.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants