You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression: IndexOutOfRangeException on a 5-byte zero-length handshake record #134784
A TLS server that receives 16 03 01 00 00 (a handshake record with no payload) throws IndexOutOfRangeException from SslStream.ReceiveHandshakeFrameAsync, whether the certificate is set directly or chosen by a callback, on both the new and the legacy handshake path.
"Fix SslStream detection of exactly-5-byte TLS frames" (dotnet/runtime#132694, Aug 25) made a 5-byte record count as a complete frame. The server's first-frame checks in SslStream.IO.cs still read EncryptedReadOnlySpan[HandshakeTypeOffsetTls], index 5, of a 5-byte span. That PR's test only covers a 5-byte record after the handshake. On 11.0 RC1 the same input ends in an IOException.
Any unauthenticated client can trigger this, and callers of AuthenticateAsServerAsync don't expect IndexOutOfRangeException.
Reproduction Steps
// Finding (regression on main, not in 11.0 RC1): an SslStream server receiving the 5-byte zero-length TLS handshake record
// 16 03 01 00 00 throws IndexOutOfRangeException from ReceiveHandshakeFrameAsync. Since "Fix SslStream detection of
// exactly-5-byte TLS frames" (#132694) a 5-byte record counts as a complete frame, but the ClientHello checks still
// read the handshake type at offset 5.
// Needs a runtime built from main: see ../FINDINGS.md ("Findings on main only"). On 11.0 RC1 it prints NOT REPRODUCED.
// Run: dotnet run 01-SslStream-ZeroLengthRecord.cs
Activity
dotnet-policy-service commentedon Sep 28, 2026
Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.
Fix SslStream handling of empty TLS handshake records (#134921)