changeset 1512:b024f9695782 fuzz

limit rsa->e size to 64 bits
author Matt Johnston <matt@ucc.asn.au>
date Sat, 17 Feb 2018 19:41:44 +0800
parents 5916af64acd4
children b9e4fd5a0e72
files rsa.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rsa.c	Sat Feb 17 19:29:51 2018 +0800
+++ b/rsa.c	Sat Feb 17 19:41:44 2018 +0800
@@ -68,6 +68,12 @@
 		goto out;
 	}
 
+	/* 64 bit is limit used by openssl, so we won't block any keys in the wild */
+	if (mp_count_bits(key->e) > 64) {
+		dropbear_log(LOG_WARNING, "RSA key bad e");
+		goto out;
+	}
+
 	TRACE(("leave buf_get_rsa_pub_key: success"))
 	ret = DROPBEAR_SUCCESS;
 out: