Description
The TLS weak certificate cache keys parsed certificates by the DER byte string but stores and returns the parsed *x509.Certificate. If the parsed certificate contains Raw slices that alias caller-owned input, caller mutation after parsing can become visible through later cache hits for the same DER key.
This requires local caller mutation of certificate bytes. It is a fragile API aliasing issue, not a remote attack by itself.
Specification or documentation
This is a Go API/cache behavior issue rather than an external specification violation. Callers generally expect parsed certificate state returned from a cache to be stable for the cached DER value.
Code references
go/src/crypto/tls/cache.go:14 defines the weak certificate cache.
go/src/crypto/tls/cache.go:19 keys the cache by string(der).
go/src/crypto/tls/cache.go:26 parses the certificate.
go/src/crypto/tls/cache.go:31 through go/src/crypto/tls/cache.go:39 stores and returns weak pointers to parsed certificate objects.
Test case
This should be a Go unit test only. It can parse through the cache with mutable DER input, mutate the returned certificate's raw bytes or the caller-owned input if aliased, and then assert that a later cache hit returns stable data.
Description
The TLS weak certificate cache keys parsed certificates by the DER byte string but stores and returns the parsed
*x509.Certificate. If the parsed certificate containsRawslices that alias caller-owned input, caller mutation after parsing can become visible through later cache hits for the same DER key.This requires local caller mutation of certificate bytes. It is a fragile API aliasing issue, not a remote attack by itself.
Specification or documentation
This is a Go API/cache behavior issue rather than an external specification violation. Callers generally expect parsed certificate state returned from a cache to be stable for the cached DER value.
Code references
go/src/crypto/tls/cache.go:14defines the weak certificate cache.go/src/crypto/tls/cache.go:19keys the cache bystring(der).go/src/crypto/tls/cache.go:26parses the certificate.go/src/crypto/tls/cache.go:31throughgo/src/crypto/tls/cache.go:39stores and returns weak pointers to parsed certificate objects.Test case
This should be a Go unit test only. It can parse through the cache with mutable DER input, mutate the returned certificate's raw bytes or the caller-owned input if aliased, and then assert that a later cache hit returns stable data.