Skip to content

Switch to semantic resources.arsc comparison in apkdiff reproducible script#14828

Closed
BarbossHack wants to merge 1 commit into
signalapp:mainfrom
BarbossHack:reproducible-use-aapt2
Closed

Switch to semantic resources.arsc comparison in apkdiff reproducible script#14828
BarbossHack wants to merge 1 commit into
signalapp:mainfrom
BarbossHack:reproducible-use-aapt2

Conversation

@BarbossHack

@BarbossHack BarbossHack commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Contributor checklist

  • Fedora 44
  • Ubuntu 24.04
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit using the Fixes #1234 syntax

Description

Context

Currently, apkdiff relies on a binary-level comparison of the resources.arsc file using Androguard. While this worked historically, it has become increasingly brittle. The Google Play Store's post-processing may modifies the internal structure of the resource table (reordering string pools, modifying header sizes, and shifting data offsets) without changing the actual resource content.

Problem

These structural optimizations trigger massive, "false positive" diffs in apkdiff. We are currently seeing errors like ARSCResTypeSpec/ARSCResTableEntry/ARSCHeader inconsistencies (see #14809), which are artifacts of binary repackaging rather than actual application discrepancies. Attempting to filter these individual binary fields using Androguard is unsustainable.

Also, currently apkdiff has 2 flaws in its resources.arsc comparison:

Solution

Instead of comparing the binary structure, this PR proposes moving to a semantic comparison using aapt2 dump resources. By using aapt2 (the official Android build tool), we verify the resolved values of the resources. This method is completely immune to the structural optimizations performed by the Play Store, as aapt2 parses the logical content rather than the raw file layout.

We are still verifying content integrity. If a malicious actor modified a string in the resource table, aapt2 dump would catch it. The only thing we are ignoring is the 'the storage layout'.

Note that androguard is still needed to parse other binary XML files. I've updated it to v4.1.4 as explained here #14817 (comment)

@BarbossHack BarbossHack changed the title Switch to semantic resources.arsc comparison in apkdiff Switch to semantic resources.arsc comparison in apkdiff reproducible script Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant