Raise ValueError when an SCT list is too large to encode - #15658
Merged
Merged
Conversation
encode_scts wrote the RFC 6962 list-length prefix with a truncating `as u16` cast, so an extension whose serialized SCTs totalled more than 65535 bytes was silently encoded with a wrapped length. The result is rejected by our own parser and by OpenSSL. Use u16::try_from for both the list and per-entry lengths and raise ValueError instead. Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-H08T92Y2. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVLJ4Wp5FraEfACovDdSN6
alex
commented
Sep 17, 2026
alex
commented
Sep 17, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVLJ4Wp5FraEfACovDdSN6
alex
commented
Sep 17, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVLJ4Wp5FraEfACovDdSN6
The total-length check already bounds every entry, and the branch could never be hit, which failed the 100% coverage requirement. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVLJ4Wp5FraEfACovDdSN6
alex
commented
Sep 17, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVLJ4Wp5FraEfACovDdSN6
reaperhulk
approved these changes
Sep 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
encode_sctswrote the RFC 6962SignedCertificateTimestampListlength prefix with a truncatinglength as u16cast. An extension whose serialized SCTs total more than 65535 bytes (roughly 550 typical SCTs) was therefore silently encoded with a length wrapped modulo 65536:public_bytes()andCertificateBuilder.sign()succeeded, but the result is rejected by our own parser (ValueError: Invalid SCT length) and by OpenSSL.A list that size has no valid encoding (
sct_list<1..2^16-1>), so the list length now goes throughu16::try_fromand raisesValueError. The per-entry length is bounded by that check and usestry_into().unwrap(). The regression test repeats the SCT frombadssl-sct.pem1000 times and checks thatpublic_bytes()raises for both extension classes.Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-H08T92Y2.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HVLJ4Wp5FraEfACovDdSN6