]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Check for excess data in CertificateVerify
authorViktor Dukhovni <openssl-users@dukhovni.org>
Wed, 28 Aug 2024 10:36:09 +0000 (20:36 +1000)
committerTomas Mraz <tomas@openssl.org>
Thu, 29 Aug 2024 17:32:31 +0000 (19:32 +0200)
As reported by Alicja Kario, we ignored excess bytes after the
signature payload in TLS CertificateVerify Messages.  These
should not be present.

Fixes: #25298
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25302)

(cherry picked from commit b4e4bf29ba3c67662c60ceed9afa2dd301e93273)

ssl/statem/statem_lib.c

index 25055df15c3c44de04f56de3e9df65faa98ccc20..b5ca9d2f71fea9d63fd21888178b0977847a38ae 100644 (file)
@@ -474,6 +474,10 @@ MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
         SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_LENGTH_MISMATCH);
         goto err;
     }
+    if (PACKET_remaining(pkt) != 0) {
+        SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_LENGTH_MISMATCH);
+        goto err;
+    }
 
     if (!get_cert_verify_tbs_data(s, tls13tbs, &hdata, &hdatalen)) {
         /* SSLfatal() already called */