Skip to content

crypto/tls: SetSessionTicketKeys can race with automatic ticket-key rotation state #79862

Description

@jvdprng

Description

The built-in session-ticket key path has a narrow concurrency window between automatic key rotation and an application call to SetSessionTicketKeys. A handshake can continue using stale automatic rotation state after manual keys have been installed.

This is not a Go data race and does not disclose ticket keys. The plausible impact is at most one stale or unusable ticket around the transition.

Specification or documentation

This is a Go API consistency issue. Config.SetSessionTicketKeys is documented as updating the keys used by the built-in session-ticket mechanism. New ticket encryption after the call should consistently reflect the manual key set.

Code references

  • go/src/crypto/tls/handshake_server_tls13.go:999 encrypts TLS 1.3 session ticket state with c.config.encryptTicket.
  • go/src/crypto/tls/common.go:1085 through go/src/crypto/tls/common.go:1138 implements Config.ticketKeys, including automatic key rotation and the lock upgrade path.
  • go/src/crypto/tls/common.go:1141 through go/src/crypto/tls/common.go:1166 implements SetSessionTicketKeys and documents that calling it turns off automatic session ticket key rotation.
  • go/src/crypto/tls/handshake_server_test.go:1672 has existing coverage around SetSessionTicketKeys.

Test case

This should be a deterministic Go unit test with a hook at the internal read-lock-to-write-lock transition in the automatic ticket-key rotation path. The hook can call SetSessionTicketKeys and then assert that the ticket-key path returns manual keys rather than continuing with automatic rotation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions