New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not crash on unknown hash and signature algorithms #767
Conversation
Patch has passed first testings and has been assigned to be reviewed I am a script, I am not human |
I think the following patch would solve the problem, in a good way. I am not sure why they send an invalid value instead of no value, but this way invalid values will be ignored and ssl will fallback to default values if there are no valid values in the extension. diff --git a/lib/ssl/src/ssl_cipher.erl b/lib/ssl/src/ssl_cipher.erl -hash_algorithm(?SHA512) -> sha512.+hash_algorithm(?SHA512) -> sha512;
|
The comment "ignore invalid extension values", should be rephrased as "ignore unknown extension values". See also RFC5246, Sect. 7.4.1.4.1 (http://tools.ietf.org/html/rfc5246#section-7.4.1.4.1). Section 7.4.4 defines the Certificate Request, but omits the handling of unknown hash and signature values, but I think applying section 7.4.1.4.1 to it is appropriate. |
Humm, well I take the patch back, I was a little to quick there. And the server code |
Ok, the following patch should take away the crash and hopefully make it possible negotiate a valid connection (without making things unsafe), diff --git a/lib/ssl/src/ssl_cipher.erl b/lib/ssl/src/ssl_cipher.erl -hash_algorithm(Other) when is_integer(Other) -> Other.+hash_algorithm(Other) when is_integer(Other) andalso ((Other >= 224) and (Other =< 255)) -> Other. hash_size(null) -> |
The summary line of the commit message is too long and/or ends with a "." Bad message: Revert "Do not crash on unknown hash and signature algorithms" I am a script, I am not human |
I will merge my own branch with this patch for 18 and I will probably have it look like this: @ -1574,6 +1574,7 @@ hash_algorithm(?SHA224) -> sha224; sign_algorithm(anon) -> ?ANON; hash_size(null) -> |
Thanks, @IngelaAndin ! |
Do not merge as is.
Hi @IngelaAndin,
Here is a workaround for a crash on SSL when trying to connect on a server for which Erlang does not yet know hash / signature algorithm.
The crash is:
You can reproduce it by using any random .pem with the following command (against Apple Server, be careful):
Our fix is certainly not the final one, as you probably have a better idea on how to integrate it to your test in Erlang code base. Instead of reporting unknown hash or signature as anon/none, it is better to report them as unknown and have them ignore at a later stage in the negotiation process.
Anyway, we thought this patch and test case could help you understand the issue.