Commit 49442b4e35 for openssl.org
commit 49442b4e3572367cd5b94e4106e6f7030be7b680
Author: Daniel Kubec <kubec@openssl.foundation>
Date: Fri Nov 13 14:57:29 2026 +0000
TLS1.3: Ignore a CertificateRequest received after close_notify
A TLSv1.3 client with post-handshake authentication enabled is meant to ignore
a CertificateRequest that arrives after it has sent close_notify. The read
transition had already switched the PHA state to SSL_PHA_REQUESTED by the time
tls_process_certificate_request() decided to ignore the message, so the write
transition for TLS_ST_CR_CERT_REQ never reached its "after close_notify" branch
and moved on to TLS_ST_CW_CERT instead. The client then wrote Certificate and
Finished after its own close_notify, and did so without calling
tls_prepare_client_certificate(), which means the application's cert_cb was not
consulted.
- RFC 8446 6.1: The client and the server must share knowledge that the
connection is ending in order to avoid a truncation attack. This alert
notifies the recipient that the sender will not send any more messages on this
connection. Any data received after a closure alert has been received MUST be
ignored.
Discovered by Anthropic's OSS Scanner (finding ANT-2026-AOH3FCZ3).
Assisted-by: Claude:claude-dable-5-2
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Merge-date: Mon Nov 23 17:09:28 2026
Merged-from: https://github.com/openssl/openssl/pull/33723
diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c
index a80ede9a52..6834c891b0 100644
--- a/ssl/statem/statem_clnt.c
+++ b/ssl/statem/statem_clnt.c
@@ -3239,8 +3239,11 @@ MSG_PROCESS_RETURN tls_process_certificate_request(SSL_CONNECTION *s,
/*
* We already sent close_notify. This can only happen in TLSv1.3
* post-handshake messages. We can't reasonably respond to this, so
- * we just ignore it
+ * we just ignore it. The read transition already moved us to
+ * SSL_PHA_REQUESTED; undo that so that the write transition does
+ * not go on to send a Certificate.
*/
+ s->post_handshake_auth = SSL_PHA_EXT_SENT;
return MSG_PROCESS_FINISHED_READING;
}