Android security tags, read closely by Lightrion

CVE-2023-40103 AI-generated analysis

platform/frameworks/base, libs/androidfw AssetManager2 and core/jni/android_util_AssetManager.cpp plus android.content.res Java wrappers (AssetManager, StringBlock, XmlBlock)

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

Two frameworks/base commits make AssetManager2 hold promoted (strong) ApkAssets references for the whole duration of a scoped "operation" instead of re-promoting weak pointers per access, and make the Java StringBlock/XmlBlock/AssetManager wrappers null out native pointers after destruction and reject calls on a gone native object.

Root cause

On the Java side, StringBlock.mNative and XmlBlock.mNative were final and kept the freed native address after nativeDestroy(), XmlBlock did not close its StringBlock when its open count reached zero, and AssetManager.getAttributeResolutionStack() did not call ensureValidLocked(); per the commit message, a racing call could reach an already freed native object instead of getting a null. On the native side, AssetManager2 stored its ApkAssets only as weak pointers (std::vector<ApkAssetsWPtr> apk_assets_) and each method (FindEntry, GetStringPoolForCookie, OpenDir, OpenNonAsset, GetNonSystemOverlays, GetLastResourceResolution, Theme::SetTo, JNI NativeGetResourceStringArray, ...) promoted the weak pointer locally for each access, so no strong reference was held across a whole JNI call. The native commit itself is described as a performance change; its exact security contribution is not stated in the material.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to December 2023 · Findings