Android security tags, read closely by Lightrion

CVE-2024-34731 AI-generated analysis

platform/frameworks/av (media/module/libmediatranscoding TranscodingResourcePolicy); platform/hardware/interfaces (health/aidl/default Health/LinkedCallback, neuralnetworks/aidl/utils ProtectCallback DeathMonitor); platform/system/security (keystore2/apc_compat ConfuiAidlCompatSession)

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 (5 corrections). Verify against the commit before relying on it.

Replaces raw object pointers used as libbinder_ndk death-recipient cookies with tracked, validated cookie objects (keyed maps, weak_ptr wrappers, onUnlinked-owned cookies) in libmediatranscoding, the health AIDL HAL default impl, the neuralnetworks AIDL utils and keystore2 apc_compat, so a late binderDied callback no longer dereferences a freed object.

Root cause

In all four components the cookie passed to AIBinder_linkToDeath was a raw pointer to an object: `this` for TranscodingResourcePolicy and ConfuiAidlCompatSession, a raw LinkedCallback* in the health HAL and a raw DeathMonitor* in NNAPI utils. The death callbacks (TranscodingResourcePolicy::BinderDiedCallback, OnCallbackDiedWrapped, DeathMonitor::serviceDied(void*), binderDiedCallbackAidl) cast it back and used it. At most they checked for null; none checked that the object was still alive. The health commit message says an onBinderDied callback can still arrive after AIBinder_unlinkToDeath(). In the health HAL, the LinkedCallback destructor unlinked and then freed the very object that a pending callback would use. Nothing validated that the cookie still referred to a live object, so the callback could operate on freed memory.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to August 2024 · Findings