Skip to content

Commit bc15131

Browse files
authored
Merge pull request #10338 from gasbytes/cert-ext-offered-list-fix
reject extensions in a TLS 1.3 Certificate message that were not offered in the prior ClientHello/CertificateRequest
2 parents 403f0fe + 8d9af25 commit bc15131

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/tls.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17319,6 +17319,20 @@ int TLSX_Parse(WOLFSSL* ssl, const byte* input, word16 length, byte msgType,
1731917319
break;
1732017320
}
1732117321

17322+
#ifdef WOLFSSL_TLS13
17323+
/* RFC 8446 4.4.2: extensions in a Certificate message MUST
17324+
* correspond to ones offered in our prior ClientHello (client) or
17325+
* CertificateRequest (server). Reject anything we did not offer. */
17326+
if (msgType == certificate &&
17327+
IsAtLeastTLSv1_3(ssl->version) &&
17328+
TLSX_Find(ssl->extensions, (TLSX_Type)type) == NULL) {
17329+
WOLFSSL_MSG("Cert-msg extension not offered in CH/CR");
17330+
SendAlert(ssl, alert_fatal, unsupported_extension);
17331+
WOLFSSL_ERROR_VERBOSE(UNSUPPORTED_EXTENSION);
17332+
return UNSUPPORTED_EXTENSION;
17333+
}
17334+
#endif
17335+
1732217336
switch (type) {
1732317337
#ifdef HAVE_SNI
1732417338
case TLSX_SERVER_NAME:

0 commit comments

Comments
 (0)