Android security tags, read closely by Lightrion

CVE-2024-40660 AI-generated analysis

platform/frameworks/native, SurfaceFlinger transaction handling (services/surfaceflinger/SurfaceFlinger.cpp, libs/gui ISurfaceComposer)

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

Makes SurfaceFlinger::setTransactionState sanitize the DisplayState entries in place (iterate by reference over a non-const Vector<DisplayState>) so that permission-stripping applies to the display states actually used, instead of to discarded copies.

Root cause

In SurfaceFlinger::setTransactionState the per-caller permissions computed by LayerStatePermissions::getTransactionPermissions were applied to display states with `for (DisplayState display : displays) { display.sanitize(permissions); }`. The loop variable is a by-value copy and the `displays` parameter was `const Vector<DisplayState>&`, so sanitize() changed a temporary and the original, unsanitized DisplayState entries stayed in the vector. Composer states were handled correctly (`for (auto& composerState : states)`); only the display loop was wrong. As the new test shows, a caller without the required permission could therefore have display-level changes such as a setDisplayProjection orientation change applied.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to November 2024 · Findings