Repository navigation
Merged
Conversation
… the certificate lengths inside the message (#1062) Root cause: tls_recv_server_handshake (lib/std/tls.w) decoded each message's 3-byte length from the server and checked only that its 4-byte header fit the record; tls_hs_hash_update, the ServerHello parse, the certificate copy and the SKE reads then used it as given. A server that claims a 16 MiB ServerHello in a 4-byte record made the client read far past the 16640-byte record buffer: lldb on the test binary stops at EXC_BAD_ACCESS in sha256_update(data="\x02\xff\xff\xff"), the handshake hash of that header. A message longer than the rest of the record fails the handshake; the first certificate's length must fit its message; cert_len is the bytes copied. Test: test/behavior/behav_1062_tls_handshake_length_past_record.w (a loopback server sends the record; before the fix the client exits 139).
Contributor
Author
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.
Root cause: tls_recv_server_handshake (lib/std/tls.w) decoded each
message's 3-byte length from the server and checked only that its 4-byte
header fit the record; tls_hs_hash_update, the ServerHello parse, the
certificate copy and the SKE reads then used it as given. A server that
claims a 16 MiB ServerHello in a 4-byte record made the client read far
past the 16640-byte record buffer: lldb on the test binary stops at
EXC_BAD_ACCESS in sha256_update(data="\x02\xff\xff\xff"), the handshake
hash of that header.
A message longer than the rest of the record fails the handshake; the first
certificate's length must fit its message; cert_len is the bytes copied.
Test: test/behavior/behav_1062_tls_handshake_length_past_record.w (a
loopback server sends the record; before the fix the client exits 139).
Closes #1062