Fix dangling secure_renegotiation pointer after TLSX_FreeAll#10210
Draft
ColtonWilley wants to merge 1 commit intowolfSSL:masterfrom
Draft
Fix dangling secure_renegotiation pointer after TLSX_FreeAll#10210ColtonWilley wants to merge 1 commit intowolfSSL:masterfrom
ColtonWilley wants to merge 1 commit intowolfSSL:masterfrom
Conversation
ssl->secure_renegotiation caches a pointer into extension data owned by the ssl->extensions list. Three call sites free that list via TLSX_FreeAll without NULLing the cached pointer, leaving it dangling: - wolfSSL_clear() - FreeHandshakeResources() (TLSX_FreeAll branch) - wolfSSL_ResourceFree() After wolfSSL_clear(), calling wolfSSL_SSL_get_secure_renegotiation_support() reads the freed SecureRenegotiation struct. Confirmed heap-use-after-free under ASan with nginx, haproxy, and openssl-compat build profiles. NULL the pointer at all three sites. Add regression test covering the wolfSSL_clear path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ssl->secure_renegotiationcaches a pointer into extension data owned by thessl->extensionslist. Three call sites free that list viaTLSX_FreeAllwithout NULLing the cached pointer, leaving it dangling:wolfSSL_clear(),FreeHandshakeResources(), andwolfSSL_ResourceFree().wolfSSL_clear(), callingwolfSSL_SSL_get_secure_renegotiation_support()reads the freedSecureRenegotiationstruct. Confirmed heap-use-after-free under ASan with nginx, haproxy, and openssl-compat build profiles.wolfSSL_clearpath.Test plan
test_wolfSSL_clear_secure_renegotiationpasses