TLS session-ticket keys released without cleansing in ssl_sock_destroy_bind_conf()
In src/ssl_sock.c, ssl_sock_destroy_bind_conf() frees a listener's TLS session-ticket key ring with a plain free(), leaving raw ticket-encryption key material in freed heap memory:
if (bind_conf->keys_ref && !--bind_conf->keys_ref->refcount) {
free(bind_conf->keys_ref->filename);
free(bind_conf->keys_ref->tlskeys); /* <-- raw AES ticket keys, never wiped */
LIST_DELETE(&bind_conf->keys_ref->list);
free(bind_conf->keys_ref);
}tlskeys is a ring buffer of TLS_TICKETS_NO union tls_sess_key entries — the AES-128/AES-256 ticket encryption keys plus HMAC keys consulted by the session-ticket callback (ssl_sock_tlsext_ticket_key_cb) on every ticket encrypt/decrypt, and rotated at runtime via set ssl tls-key. This path runs on ordinary listener teardown and reload, i.e. routine operations, and the freed chunk can linger in the allocator's freelists for the rest of the process.
Severity note, stated plainly: this is defense-in-depth hardening (CWE-226), not a standalone vulnerability — recovering the residue requires an independent memory-read primitive (core dump, swap, Heartbleed-class bug). But these particular keys are high-value residue: anyone who recovers them can decrypt captured session tickets, which encapsulate session secrets.
Suggested fix — wipe with a DSE-resistant primitive before release:
OPENSSL_cleanse(bind_conf->keys_ref->tlskeys,
sizeof(*bind_conf->keys_ref->tlskeys) * TLS_TICKETS_NO);
free(bind_conf->keys_ref->tlskeys);Found by a Clang-based static analysis check for missing zeroization; confirmed by reading the free path above. Happy to shape the patch to whatever primitive the project prefers.
Source: haproxy/haproxy