Skip to content

Commit 51d0090

Browse files
Andy Polyakovmattcaswell
authored andcommitted
crypto/evp: harden RC4_MD5 cipher.
Originally a crash in 32-bit build was reported CHACHA20-POLY1305 cipher. The crash is triggered by truncated packet and is result of excessive hashing to the edge of accessible memory (or bogus MAC value is produced if x86 MD5 assembly module is involved). Since hash operation is read-only it is not considered to be exploitable beyond a DoS condition. Thanks to Robert Święcki for report. CVE-2017-3731 Reviewed-by: Rich Salz <rsalz@openssl.org>
1 parent 8957add commit 51d0090

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crypto/evp/e_rc4_hmac_md5.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ static int rc4_hmac_md5_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
269269
len = p[arg - 2] << 8 | p[arg - 1];
270270

271271
if (!ctx->encrypt) {
272+
if (len < MD5_DIGEST_LENGTH)
273+
return -1;
272274
len -= MD5_DIGEST_LENGTH;
273275
p[arg - 2] = len >> 8;
274276
p[arg - 1] = len;

0 commit comments

Comments
 (0)