Skip to content

crypto/tls: TLS 1.3 ticket_age_add accepts partial random reads #79853

Description

@jvdprng

Description

TLS 1.3 session-ticket generation uses a single Read call to fill the four-byte ticket_age_add field and checks only the returned error. A custom Config.Rand can legally return a short read with a nil error, leaving part of the value as zero bytes.

This does not expose key material. The impact is limited to weakening ticket-age obfuscation when an application configures a short-reading random source.

Specification

RFC 8446 Section 4.6.1 defines ticket_age_add as a securely generated random 32-bit value generated by the server.

Code references

  • go/src/crypto/tls/handshake_server_tls13.go:1006 notes the RFC 8446 requirement.
  • go/src/crypto/tls/handshake_server_tls13.go:1009 allocates the four-byte buffer.
  • go/src/crypto/tls/handshake_server_tls13.go:1010 calls Read once and does not check whether all four bytes were filled.
  • go/src/crypto/tls/handshake_server_tls13.go:1013 serializes the possibly partially initialized value.

Test case

This is best as a Go unit test using a custom Config.Rand that returns one byte per successful read. The test should assert that session-ticket generation uses io.ReadFull-style behavior and consumes exactly four bytes or returns an error.

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