-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimal Mdns ResolverDelegateProxy use-after-free #13227
Comments
Set the resolver instance singleton to nullptr when releasing the ResolverDelegateProxy.
Set the resolver instance singleton to nullptr when releasing the ResolverDelegateProxy.
Set the resolver instance singleton to nullptr when releasing the ResolverDelegateProxy.
The suggested fix does fix my problem. However, now things like TestCommissionManager are failing. For now, I am calling this in my code after Shutdown: chip::Dnssd::Resolver::Instance().SetResolverDelegate(nullptr); |
This reverts commit 1b98d6f.
HandleNodeBrowse decrements the ResolverProxy reference count, which will cause the object to be destructed if the counter reaches 0, and then increments the counter and uses the object, which can be a use-after-free. his commit fixes the problem by ordering Release to occur after Retain. Fixes project-chip#13227
This reverts commit 1b98d6f.
HandleNodeBrowse decrements the ResolverProxy reference count, which will cause the object to be destructed if the counter reaches 0, and then increments the counter and uses the object, which can be a use-after-free. his commit fixes the problem by ordering Release to occur after Retain. Fixes project-chip#13227
Shouldn't ~ResolverDelegateProxy be handling the un-registration? Removing "deferral candidate" label, since this is a use-after-free bug, hence likely exploitable. |
@msandstedt Trying to understand if this is still an issue and to understand it in general: this mentiones MinimalMdns but also Discovery_ImplPlatform.cpp ... those two should be mutually exclusive. Is this still an issue? I am unsure how to reproduce. MinMDNS code was updated quite a bit with the usage of address resolver since last year. |
MinMDNS does not currently use ResolverProxy at all. |
Closing: based on discussion with @msandstedt since MinMDNS is not using resolver proxy (anymore - it used to when this bug was reported), this should be fine now. |
Problem
Discovery_ImplPlatform.cpp decrements the reference counter for the ResolverDelegateProxy by calling Release, which eventually causes it to be freed. However, this doesn't necessarily un-register the freed delegate from e.g. Resolver_ImplMinimalMdns.cpp. The result is that if more records are discovered than expected, code like Resolver_ImplMinimalMdns.cpp can execute methods on the freed ResolverDelegateProxy.
Proposed Solution
Something like this might work:
The text was updated successfully, but these errors were encountered: