Skip to content

Fix missing ref count in SSL_listen_ex #1766

@nhorman

Description

@nhorman

Based on report from:
https://groups.google.com/a/openssl.org/g/openssl-security/c/Vgx2uNUwc0I

If the listener object from which a new connection is fetched via SSL_listen_ex is freed prior to the connection returned from SSL_listen_ex, we get heap-use-after-free conditions in asan.

The problem is that, unlike SSL_new_from_listener, SSL_listen_ex (ne ossl_quic_peeloff_conn) never increases the refcount on the listener SSL object, and so resources held by the listener can be freed prior to freing the connection SSL object, which makes use of those resources.

Fix should be to do what SSL_new_from_listener does, i.e. up the refcount of the listener object, and ensure that the connection points to the listener properly, so that the refcount is dropped again when the child connection is freed.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions