Fixes integer underflow with SSL_trace support#5706
Closed
catenacyber wants to merge 1 commit intoopenssl:masterfrom
Closed
Fixes integer underflow with SSL_trace support#5706catenacyber wants to merge 1 commit intoopenssl:masterfrom
catenacyber wants to merge 1 commit intoopenssl:masterfrom
Conversation
dot-asm
approved these changes
Mar 21, 2018
mattcaswell
approved these changes
Mar 21, 2018
| size_t plen = *ext++; | ||
|
|
||
| if (plen > xlen + 1) | ||
| if (plen + 1 > xlen) |
Member
There was a problem hiding this comment.
Side note: This stuff really needs to be rewritten to use the PACKET stuff. This is a typical example of the kind of issue we used to have before we switched to PACKET everywhere else.
Contributor
Author
There was a problem hiding this comment.
This stuff really needs to be rewritten to use the PACKET stuff
I agree :-)
Contributor
|
??? There is no corresponding case in 1.1.0 (or 1.0.2)... |
Member
Ok, great. I assumed there was, and was just about to go and double check it. It sounds like you already did. |
Member
|
Pushed. Thanks. |
levitte
pushed a commit
that referenced
this pull request
Mar 21, 2018
Reviewed-by: Andy Polyakov <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from #5706)
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.
Since this is a non-default debug option, this doesn't look like a security issue.
Bug is in function ssl_print_extension in file ssl/t1_trce.c
In case TLSEXT_TYPE_application_layer_protocol_negotiation
There is a mistake in adding 1 to xlen instead of plen
So when
xlen -= plen + 1;can underflow and as glen is size_t, it becomes 0xFFFFFFFFFFFFFFFFTo reproduce it, I run
./openssl s_server -trace
Then I run a malicious client which gives n+2 instead of n for the length of the string
And we keep reading the memory until something bad happens (segfault)