Android security tags, read closely by Lightrion

CVE-2023-40084 AI-generated analysis

platform/system/netd, server/MDnsSdListener (mDNS service monitor thread)

AI-generated: written from the bulletin and the fixing diffs by claude-fable-5-1, then checked against the code by claude-opus-5-5 (8 corrections). Verify against the commit before relying on it.

Replaces the netdutils::threadLaunch-started monitor thread in netd's MDnsSdListener::Monitor with a stored std::thread. A new Monitor destructor interrupts this thread by closing one end of the control socketpair and then joins it, so Monitor::run can no longer run on a destroyed Monitor instance.

Root cause

MDnsSdListener::Monitor::Monitor() started the monitor thread with ::android::netdutils::threadLaunch(this) and kept no thread handle. The destructor was an empty `virtual ~Monitor() {}`. When a Monitor (embedded as MDnsSdListener::mMonitor) was destroyed, nothing stopped or waited for the thread running Monitor::run(), which uses members such as mPollFds, mPollRefs and mCtrlSocketPair. In the shown old code, the control socket revents were handled by a switch with only a POLLIN case, so there was no exit path on hangup. The commit message describes this as a heap-use-after-free in MDnsSdListener::Monitor::run, found with mdns_service_fuzzer after about 500 rounds.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to December 2023 · Findings