From: Matt Caswell Date: Fri, 5 Jan 2018 10:12:29 +0000 (+0000) Subject: Tolerate DTLS alerts with an incorrect version number X-Git-Tag: OpenSSL_1_0_2o~51 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=da9ed72576a6b21a44df5eb913727838e99ff7c8;p=oweals%2Fopenssl.git Tolerate DTLS alerts with an incorrect version number In the case of a protocol version alert being sent by a peer the record version number may not be what we are expecting. In DTLS records with an unexpected version number are silently discarded. This probably isn't appropriate for alerts, so we tolerate a mismatch in the minor version number. This resolves an issue reported on openssl-users where an OpenSSL server chose DTLS1.0 but the client was DTLS1.2 only and sent a protocol_version alert with a 1.2 record number. This was silently ignored by the server. Reviewed-by: Viktor Dukhovni (Merged from https://github.com/openssl/openssl/pull/5019) --- diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c index f196b8fb2d..685d50a4f1 100644 --- a/ssl/d1_pkt.c +++ b/ssl/d1_pkt.c @@ -706,8 +706,11 @@ int dtls1_get_record(SSL *s) n2s(p, rr->length); - /* Lets check version */ - if (!s->first_packet) { + /* + * Lets check the version. We tolerate alerts that don't have the exact + * version number (e.g. because of protocol version errors) + */ + if (!s->first_packet && rr->type != SSL3_RT_ALERT) { if (version != s->version) { /* unexpected version, silently discard */ rr->length = 0;