aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2003-03-19 19:20:30 +0000
committerBodo Möller <bodo@openssl.org>2003-03-19 19:20:30 +0000
commitef42d6a4eda7af66fcd8168bfb8f11f160f22913 (patch)
tree6f5a56d0b641969fc7a2bd1bb3f1513b33509562
parent00223b969de93dcf7ecfd4a63fb6d151d589dc57 (diff)
downloadopenssl-ef42d6a4eda7af66fcd8168bfb8f11f160f22913.tar.gz
countermeasure against new Klima-Pokorny-Rosa atack
-rw-r--r--CHANGES6
-rw-r--r--ssl/s3_srvr.c24
2 files changed, 16 insertions, 14 deletions
diff --git a/CHANGES b/CHANGES
index b3f3ffb4d0..46916103b9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,7 +4,11 @@
Changes between 0.9.6i and 0.9.6j [xx XXX 2003]
- *)
+ *) Countermeasure against the Klima-Pokorny-Rosa extension of
+ Bleichbacher's attack on PKCS #1 v1.5 padding: treat
+ a protocol version number mismatch like a decryption error
+ in ssl3_get_client_key_exchange (ssl/s3_srvr.c).
+ [Bodo Moeller]
Changes between 0.9.6h and 0.9.6i [19 Feb 2003]
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index 6b414cfa5c..3f4818e888 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -1425,7 +1425,7 @@ static int ssl3_get_client_key_exchange(SSL *s)
if (i != SSL_MAX_MASTER_KEY_LENGTH)
{
al=SSL_AD_DECODE_ERROR;
- SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_RSA_DECRYPT);
+ /* SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_RSA_DECRYPT); */
}
if ((al == -1) && !((p[0] == (s->client_version>>8)) && (p[1] == (s->client_version & 0xff))))
@@ -1441,30 +1441,28 @@ static int ssl3_get_client_key_exchange(SSL *s)
(p[0] == (s->version>>8)) && (p[1] == (s->version & 0xff))))
{
al=SSL_AD_DECODE_ERROR;
- SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_PROTOCOL_VERSION_NUMBER);
- goto f_err;
+ /* SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_PROTOCOL_VERSION_NUMBER); */
+
+ /* The Klima-Pokorny-Rosa extension of Bleichenbacher's attack
+ * (http://eprint.iacr.org/2003/052/) exploits the version
+ * number check as a "bad version oracle" -- an alert would
+ * reveal that the plaintext corresponding to some ciphertext
+ * made up by the adversary is properly formatted except
+ * that the version number is wrong. To avoid such attacks,
+ * we should treat this just like any other decryption error. */
}
}
if (al != -1)
{
-#if 0
- goto f_err;
-#else
/* Some decryption failure -- use random value instead as countermeasure
* against Bleichenbacher's attack on PKCS #1 v1.5 RSA padding
- * (see RFC 2246, section 7.4.7.1).
- * But note that due to length and protocol version checking, the
- * attack is impractical anyway (see section 5 in D. Bleichenbacher:
- * "Chosen Ciphertext Attacks Against Protocols Based on the RSA
- * Encryption Standard PKCS #1", CRYPTO '98, LNCS 1462, pp. 1-12).
- */
+ * (see RFC 2246, section 7.4.7.1). */
ERR_clear_error();
i = SSL_MAX_MASTER_KEY_LENGTH;
p[0] = s->client_version >> 8;
p[1] = s->client_version & 0xff;
RAND_pseudo_bytes(p+2, i-2); /* should be RAND_bytes, but we cannot work around a failure */
-#endif
}
s->session->master_key_length=