Android security tags, read closely by Lightrion

CVE-2024-0033 AI-generated analysis

platform/frameworks/native (libs/binder MemoryHeapBase) and platform/system/core (libcutils ashmem-dev memfd backend)

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.

Adds F_SEAL_GROW | F_SEAL_SHRINK to memfd-backed shared memory created by libbinder MemoryHeapBase(FORCE_MEMFD) and by the libcutils ashmem-dev memfd backend (which also now adds F_SEAL_SEAL when a region is made read-only), so a remote process holding the fd can no longer change the size of the shared region.

Root cause

Neither memfd creation path applied F_SEAL_GROW/F_SEAL_SHRINK. In libs/binder/MemoryHeapBase.cpp the FORCE_MEMFD path creates the memfd (memfd_create + ftruncate), maps it with mapfd(), and then only applied F_SEAL_FUTURE_WRITE when READ_ONLY and F_SEAL_SEAL unless MEMFD_ALLOW_SEALING_FLAG was set. A default region therefore had no size seal, and SEAL_FLAGS could be 0, in which case sealing was skipped. In libcutils/ashmem-dev.cpp, memfd_create_region did not add size seals, and memfd_set_prot_region only added F_SEAL_FUTURE_WRITE (without F_SEAL_SEAL) for read-only requests and returned 0 for a later PROT_WRITE request on an already write-protected fd. Because the fd is handed to other processes, a recipient could ftruncate the memfd and shrink the region mapped by the originating process. Per the commit messages this crashes the originating process (DoS). The bulletin rates it High/EoP.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to February 2024 · Findings