Android security tags, read closely by Lightrion

CVE-2024-40673 AI-generated analysis

platform/libcore, ojluni native zip support (java.util.ZipFile, zip_util.c)

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

libcore's native ZipFile open path (ZIP_Put_In_Cache0 in ojluni/src/main/native/zip_util.c) now rejects any zip file whose first 4 bytes are neither a local file header signature (LOCSIG) nor an end-of-central-directory signature (ENDSIG). This aligns java.util.ZipFile with libziparchive except for empty archives.

Root cause

In ZIP_Put_In_Cache0, the code read the first 4 bytes of the file only to record whether a local file header signature was present (zip->locsig = LOCSIG_AT(errbuf)). It then kept opening the archive whatever the result. The commit message cites the zip specification (APPNOTE 4.3.6 / 4.3.1): a non-empty zip must begin with a local file header, and an empty one with the end-of-central-directory record. According to the commit, libziparchive enforces this but ZipFile's native parser (zip_util.c) did not. So files with an invalid header at offset zero were accepted by ZipFile and rejected by libziparchive.

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to October 2024 · Findings