Port TlsFrameHelper bounds-check fixes from dotnet/runtime#3028
Merged
Conversation
Agent-Logs-Url: https://github.com/dotnet/yarp/sessions/90a30830-2b93-4c65-baa5-92b0ab9ed17d Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
MihaZupan
May 14, 2026 18:11
View session
MihaZupan
approved these changes
May 14, 2026
rzikm
approved these changes
May 14, 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.
TlsFrameHelper.csis a fork of the runtime's implementation. The only behavior-changing upstream commit since the YARP copy is dotnet/runtime#126352, which fixes 4 out-of-bounds reads found bySslStreamClientHelloFuzzeragainst crafted/truncated TLS frames. This PR ports those fixes.Bounds checks added
TryParseClientHello/TryParseServerHello— guardp.Length < sizeof(ushort)beforeReadUInt16BigEndian(p)for the extension list length. Truncated input with 1 byte remaining after compression methods previously threwArgumentOutOfRangeException.GetSniFromHostNameStruct— guardhostNameStruct.Length < HostNameOffsetbefore reading the host name length.TryGetSupportedVersionsFromExtension— guardextensionData.IsEmptybefore indexingextensionData[VersionListLengthOffset].Not ported
helloLength < ProtocolVersionSizecheck inTryParseHelloFrameis already subsumed by YARP's stricterhelloLength < MinimalHandshakeLength(44 > 2).== false→!,usingreordering) and fixes already present in YARP (typosInsufficientSecurity/MaximumFragmentLength, TLS 1.0/1.1 obsoletion pragmas, unified SSL2 framing,ParsingStatus, cipher suite parsing).Example