Every entry has a one-line annotation saying why you would open it. Where a URL is uncertain, the
title and venue are given instead of a guessed link — follow the repository rule that a wrong
identifier is worse than no identifier.
apksig is the library behind the apksigner command line tool, the Android Gradle Plugin, and the
reference for the platform's own verifiers. If you want to know what "verifies" means, this is the
ground truth.
The top-level entry point that decides which schemes to require for a given SDK range and produces the per-scheme verdicts you see in apksigner verify -v.
The APK Signing Block reader/writer: size prefix, ID-value pairs, size suffix, magic, and the chunked digest construction over the three covered regions.
The historical monolithic parser. Still the clearest single file for understanding how a manifest becomes a PackageInfo; deprecated in favour of the package below.
The single most useful header in this chapter: every chunk type constant, every struct layout, Res_value data types, and ResTable_config. On older trees the same file lives at frameworks/base/include/androidfw/ResourceTypes.h.
frameworks/base/libs/androidfw/ResourceTypes.cpp
The implementations of ResStringPool, ResXMLTree/ResXMLParser and ResTable. Read ResXMLParser::next() to see exactly how strictly the device validates chunk sizes.
frameworks/base/libs/androidfw/AssetManager2.cpp
Resource resolution at runtime: package lookup, configuration matching, and overlay precedence.
frameworks/base/libs/androidfw/LoadedArsc.cpp
Loading and validating resources.arsc, including the sparse and 16-bit-offset entry encodings.
frameworks/base/libs/androidfw/ApkAssets.cpp
How an APK is opened and its resources.arsc and AndroidManifest.xml mapped.
frameworks/base/libs/androidfw/Idmap.cpp
Runtime resource overlay ID mapping — the mechanism behind resource shadowing.
frameworks/base/tools/aapt2/
The compiler/linker that produces AXML and resources.arsc; format/binary/ contains the serialisers that mirror ResourceTypes.h.
frameworks/base/tools/aapt2/dump/
The implementation behind aapt2 dump xmltree and aapt2 dump chunks, which is what you compare tool output against.
The native ZIP reader used by the framework and installer: central directory parsing, duplicate-name rejection, and the checks that closed the Master Key class.
The Java ZipFile an app uses; where entry names come from and what is (and is not) validated.
libcore — dalvik/system/ZipPathValidator.java
The Android 14 path-traversal guard applied by default to apps targeting API 34+.
bionic/linker/
How a .so mapped directly out of an APK is loaded when extractNativeLibs="false", and the page-alignment constraints that follow.
system/security/
Keystore and related trust components; relevant when signature checks are chained to hardware-backed keys — see 49-KeyStore.
Browse at https://android.googlesource.com/platform/system/libziparchive/,
https://android.googlesource.com/platform/libcore/ and
https://android.googlesource.com/platform/bionic/.
The normative v2 specification: signing block layout, ID-value pairs, the three covered regions, chunked digest algorithm, and the signature algorithm ID table.
PKWARE .ZIP File Format Specification (APPNOTE.TXT) — https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
The normative ZIP specification. Sections 4.3.7 (local file header), 4.3.12 (central directory header), 4.3.16 (EOCD), 4.3.14 (Zip64 EOCD) and 4.4.4 (general purpose bit flag) are the ones this chapter uses.
Oracle JAR File Specification — https://docs.oracle.com/en/java/javase/17/docs/specs/jar/jar.html
Defines MANIFEST.MF and .SF syntax, the 72-byte line-wrapping rule, and signed JAR semantics that APK v1 signing inherits verbatim.
The certificate format you dump with openssl x509;Android does not build or validate a chain to a trust anchor for app signing — identity continuity is what matters.
The Mobile Application Security Verification Standard (MASVS) states controls; the Mobile
Application Security Testing Guide (MASTG) states how to test them. MASVS v2 replaced the old
MSTG-* requirement numbering with category identifiers, and MASTG v2 renumbered its tests, so both
naming schemes are given where they are stable.
Identifier
Relevance to this chapter
https://mas.owasp.org/MASVS/
MASVS root; start here for the current control identifiers.
https://mas.owasp.org/MASTG/
MASTG root; the test and demo pages.
MASVS-CODE-1
The app requires an up-to-date platform version — ties directly to the "targeting API ≥ 30 requires v2" rule.
MASVS-CODE-3
Only components without known vulnerabilities — covers shipping a bundled ZIP/unarchiving library with a ZipSlip-class bug.
MASVS-CODE-4
Validates and sanitises untrusted input — the control ZipSlip findings belong under, because archive entry names are untrusted input.
MASVS-RESILIENCE-1
Validates the integrity of the platform — root/bootloader checks that are commonly implemented alongside signature checks.
MASVS-RESILIENCE-2
Implements anti-tampering mechanisms — where runtime self-signature verification findings belong. See 38-TamperDetection.
MASVS-RESILIENCE-3
Anti-static-analysis — relevant when parser-confusion or packing is used to defeat tooling. See 40-Obfuscation.
Legacy MSTG-CODE-1
"The app is signed and provisioned with a valid certificate, of which the private key is properly protected." Still the identifier most report templates expect for signing findings.
Legacy MSTG-CODE-2
"The app has been built in release mode, with settings appropriate for a release build (e.g. non-debuggable)." The android:debuggable check.
Legacy MSTG-RESILIENCE-3
"The app detects, and responds to, tampering with executable files and critical data within its own sandbox."
MASTG test — Making Sure That the App Is Properly Signed
The procedure that reduces to apksigner verify -v --print-certs. Referred to by name rather than a numeric ID because MASTG v2 renumbered it.
MASTG test — Testing whether the App is Debuggable
Manifest android:debuggable verification, and the reason the three-way manifest diff in this chapter matters.
Only two CVE identifiers are named in this chapter. Everything else is described as a class.
CVE
One-line summary
Link
CVE-2017-13156 ("Janus")
A DEX file prepended to a v1-only-signed APK still passes JAR signature verification because the ZIP structure is located from the end of the file, while the runtime's code-loading path reads the DEX magic at offset 0 and executes the attacker's classes; fixed by requiring APK Signature Scheme v2, which digests the whole file from offset 0. Affected Android 5.0–8.0.
https://nvd.nist.gov/vuln/detail/CVE-2017-13156
CVE-2013-4787 ("Master Key")
A ZIP archive containing two entries with the same name caused the signature verifier and the code loader to operate on different copies, letting an attacker append a replacement classes.dex to a legitimately signed APK and have it executed; two related variants in the same period abused disagreements over ZIP length-field interpretation rather than duplicate names as such.
https://nvd.nist.gov/vuln/detail/CVE-2013-4787
Both entries are also reachable through https://source.android.com/docs/security/bulletin — the
Android Security Bulletin index is the right place to confirm which builds carry a given fix.
For the ZipSlip class generally, treat it as a pattern rather than a single CVE: it has been
assigned hundreds of identifiers across ecosystems. Cite the specific library version in the app you
are testing, not a generic identifier.
URLs are omitted where they are not certain; the title and venue are enough to find the material.
Work
Venue / author
Why it matters here
Android: One Root to Own Them All
Jeff Forristal (Bluebox Security), Black Hat USA 2013
The original public presentation of the Master Key signature-verification bypass; still the clearest explanation of the "two parsers, one archive" problem.
GuardSquare's disclosure of the Janus vulnerability
GuardSquare, 2017
The write-up that introduced CVE-2017-13156 and the DEX-prepending technique; the vendor blog is the primary source.
Google Android Developers Blog — APK Signature Scheme v2 announcement
Google, 2016
The design rationale for moving from per-entry to whole-file signing, written by the people who did it.
Android Security Bulletins
Google, monthly
The authoritative record of which platform builds fixed which parsing and signing issues.
MASTG chapter — Android Anti-Reversing Defenses
OWASP
Systematic treatment of integrity checks, including the ones that read the app's own signature.
Research on Android manifest and AXML parser divergence
Multiple groups, ongoing
Search terms: "AXML parser confusion", "Android manifest parser differential", "APK tool evasion". Treat individual write-ups carefully — several describe techniques against tool versions that have since been hardened.