Android security tags, read closely by Lightrion

CVE-2024-49746 AI-generated analysis

platform/frameworks/native, libs/binder (Parcel)

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

Parcel::continueWrite in libbinder no longer closes every file descriptor of a parcel with an mOwner buffer when the parcel is resized. It closes only FDs in the truncated region, drops objects that straddle the new size, and marks retained kernel FDs as owned. The fix also adds bounds checks to the RPC object truncation paths.

Root cause

In libs/binder/Parcel.cpp, Parcel::continueWrite handles the case where the parcel data is owned by a release callback (mOwner). The new tests exercise this with replies received through the kernel binder driver. When the parcel is resized (appending data or truncating with setDataSize), the code copies the data and object table into a new buffer. It then called closeFileDescriptors(), which closes every FD in the parcel, including FDs in the retained part of the data. The code carried a TODO(b/239222407) noting this was wrong. Also, the object-table truncation compared only the object start offset against the new size (mObjects[i] < desired). An object partially cut by the truncation was therefore kept and not properly freed. The RPC-parcel loop did the same with mObjectPositions. Parcel::truncateRpcObjects read the object type and fd index from mData at positions taken from mObjectPositions without checking them against mDataSize. The commit message says this could have resulted in an OOB access.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to February 2025 · Findings