aboutsummaryrefslogtreecommitdiffstats
path: root/ssl/s3_pkt.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2014-05-16 12:49:48 +0100
committerDr. Stephen Henson <steve@openssl.org>2014-06-05 13:22:42 +0100
commita91be10833e61bcdc9002de28489405101c52650 (patch)
treec5d8d3629e733447f7ea76bad1b05f9460862cbf /ssl/s3_pkt.c
parenta7c682fb6f692c9a3868777a7ff305784714c131 (diff)
downloadopenssl-a91be10833e61bcdc9002de28489405101c52650.tar.gz
Fix for CVE-2014-0224
Only accept change cipher spec when it is expected instead of at any time. This prevents premature setting of session keys before the master secret is determined which an attacker could use as a MITM attack. Thanks to KIKUCHI Masashi (Lepidum Co. Ltd.) for reporting this issue and providing the initial fix this patch is based on. (cherry picked from commit bc8923b1ec9c467755cd86f7848c50ee8812e441)
Diffstat (limited to 'ssl/s3_pkt.c')
-rw-r--r--ssl/s3_pkt.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c
index 34eb2b4423..fb9720f41d 100644
--- a/ssl/s3_pkt.c
+++ b/ssl/s3_pkt.c
@@ -1593,6 +1593,15 @@ start:
goto f_err;
}
+ if (!(s->s3->flags & SSL3_FLAGS_CCS_OK))
+ {
+ al=SSL_AD_UNEXPECTED_MESSAGE;
+ SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_CCS_RECEIVED_EARLY);
+ goto f_err;
+ }
+
+ s->s3->flags &= ~SSL3_FLAGS_CCS_OK;
+
rr->length=0;
if (s->msg_callback)