Skip to content

openssl: Fix use-after-free in TLS session remove callback - #25132

Closed
bukka wants to merge 1 commit into
php:PHP-8.6from
bukka:openssl_tls_session_fix_remove_cb_uaf
Closed

bukka wants to merge 1 commit into
php:PHP-8.6from
bukka:openssl_tls_session_fix_remove_cb_uaf

Conversation

@bukka

@bukka bukka commented Nov 1, 2026

Copy link
Copy Markdown
Member

The session remove callback reads the listener stream from the SSL_CTX ex_data, but the context is shared with accepted connections and can outlive the listener. Closing the listener left a dangling pointer that the callback later dereferenced. Clear it on close when it refers to the stream being freed.

The added test reproduces it via a TCP proxy and crashes under ASan without the fix.

The session remove callback reads the listener stream from the SSL_CTX
ex_data, but the context is shared with accepted connections and can
outlive the listener. Closing the listener left a dangling pointer that
the callback later dereferenced. Clear it on close when it refers to the
stream being freed.

The added test reproduces it via a TCP proxy and crashes under ASan
without the fix.
@bukka

bukka commented Nov 1, 2026

Copy link
Copy Markdown
Member Author

I should note that this was reported by @cx-joao-cunhadasilva as a security issue but because it's not released yet, it's just a public fix.

@bukka bukka closed this in 7e86f2c Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants