diff rsa.c @ 1526:36ab6b091ad3

limit rsa->e size to 64 bits
author Matt Johnston <matt@ucc.asn.au>
date Sat, 17 Feb 2018 19:41:44 +0800
parents 06d52bcb8094
children bb8eaa26bc93
line wrap: on
line diff
--- a/rsa.c	Tue Feb 20 19:30:34 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: