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.
Description
TLS 1.3 session-ticket generation uses a single
Readcall to fill the four-byteticket_age_addfield and checks only the returned error. A customConfig.Randcan 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_addas a securely generated random 32-bit value generated by the server.Code references
go/src/crypto/tls/handshake_server_tls13.go:1006notes the RFC 8446 requirement.go/src/crypto/tls/handshake_server_tls13.go:1009allocates the four-byte buffer.go/src/crypto/tls/handshake_server_tls13.go:1010callsReadonce and does not check whether all four bytes were filled.go/src/crypto/tls/handshake_server_tls13.go:1013serializes the possibly partially initialized value.Test case
This is best as a Go unit test using a custom
Config.Randthat returns one byte per successful read. The test should assert that session-ticket generation usesio.ReadFull-style behavior and consumes exactly four bytes or returns an error.