Skip to content

feat: FaceMatch Android app-id structural parse - #166

Merged
Sarkoxed merged 7 commits into
mainfrom
as/facematch-app-id-parse
Oct 20, 2026
Merged

Sarkoxed merged 7 commits into
mainfrom
as/facematch-app-id-parse

Conversation

@Sarkoxed

@Sarkoxed Sarkoxed commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Hardens the Android Keystore attestation parser so the attestationApplicationId is read from a structurally located position rather than a hinted forward scan.

  • Strict OID anchor + a structural walk: SEQUENCE -> ... -> softwareEnforced SET, reading the app-id only from there.
  • New enter_element / skip_element DER helpers.
  • Re-enabled pub mod tests; and added real-fixture coverage.

@Sarkoxed
Sarkoxed changed the base branch from main to as/read-der-length October 19, 2026 12:46
Comment on lines +132 to +140
// NOTE: like the pre-hardening `get_app_id_from_credential_tbs`, this still uses the
// non-strict `find_subarray_index` plus a flat forward scan, so the BF 85 3E key-origin
// tag is searched over a window that includes the attacker-controlled
// attestationChallenge. It is NOT currently exploitable because no circuit `main` calls
// this function (the `// TODO: Only accept GENERATED` in android/constants.nr is unwired),
// and any use would additionally be gated by the app-id / Play-Integrity path. If this
// is ever wired into an acceptance path, harden it the same way as `get_app_id`: strict
// OID anchor + structural walk into softwareEnforced/teeEnforced (skip attestationChallenge
// and uniqueId by length) before searching for the tag.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove long comments like this unless they are actually required to explain a complex code below. All self explanatory code should not need any comments

@Sarkoxed
Sarkoxed changed the base branch from as/read-der-length to main October 20, 2026 14:41
@Sarkoxed
Sarkoxed merged commit 89746a5 into main Oct 20, 2026
1 check passed
@mverzilli mverzilli mentioned this pull request Oct 21, 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.

2 participants