[PATCH] OpenSSL: Clear cached peer X509 pointers on TLS shutdown

Jouni Malinen j at w1.fi
Thu Dec 3 10:55:07 PST 2026


On Thu, Dec 03, 2026 at 02:13:14PM +0000, Andrzej Ostruszka wrote:
> tls_verify_cb() caches borrowed, un-refcounted X509 pointers from the
> verification context into struct tls_connection (peer_cert, peer_issuer,
> and peer_issuer_issuer).
> 
> tls_connection_shutdown() resets the SSL object via SSL_clear() for EAP
> fast re-authentication without clearing these pointers. If the peer
> subsequently rejects session resumption, the TLS library frees the prior
> SSL_SESSION and its certificate chain, leaving the cached pointers
> dangling. When the new handshake uses a shallower certificate chain and
> includes a stapled OCSP response, peer_issuer_issuer is not overwritten
> and OCSP verification can dereference the freed X509 object via
> X509_dup().
> 
> Clear conn->peer_cert, conn->peer_issuer, and conn->peer_issuer_issuer
> in tls_connection_shutdown() before resetting the SSL state.

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list