Skip to content

Android attestation: best practice, knowledge, tests and demos - #3953

Open
Diolor wants to merge 3 commits into
OWASP:masterfrom
Diolor:android-attestation
Open

Diolor wants to merge 3 commits into
OWASP:masterfrom
Diolor:android-attestation

Conversation

@Diolor

@Diolor Diolor commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

This PR closes #3505

Description

Split out of #3756, which mixed attestation and hardcoded secrets across both platforms. This is the Android attestation part and stands on its own.

A backend cannot trust anything a mobile client claims about itself. Attestation is how it gets cryptographic evidence instead, and it is the precondition for every other client-side control. MASTG had the pieces but not the guidance: Key Attestation was a single storage-oriented knowledge page, the device and app attestation pages were placeholders, and nothing said what a server should actually verify.

  • Best practice MASTG-BEST-0x01: server-side verification of hardware-backed Key Attestation (challenge freshness, chain and revocation checks, rootOfTrust and attestationApplicationId evaluation, key properties, failure handling). Play Integrity is presented as the default starting point.
  • Knowledge: MASTG-KNOW-0044 (Key Attestation) reworked and moved to MASVS-RESILIENCE. The move is its own commit so the rewrite shows as a real diff. MASTG-KNOW-0119/0120 placeholders filled in; MASTG-KNOW-0035 (Play Integrity) and MASTG-KNOW-0118 (RASP) cleaned up and cross-linked.
  • Tests: MASTG-TEST-0x01 (app attestation, MASWE-0056) and MASTG-TEST-0x05 (device attestation, MASWE-0054, first coverage).
  • Demos: MASTG-DEMO-0x01/0x03 (key attestation without and with a server-issued challenge) and 0x07 (retrieving device integrity signals), each with a semgrep rule and generated output. Run on an emulator; the decompiled Java matches a real build.

Fake IDs are kept as they were in #3756 so the three split PRs stay collision-free when stacked and earlier review comments still map.

Siblings: #3954 (iOS attestation, independent of this one) and #3955 (hardcoded secrets, stacked on both). The cross-link from MASTG-KNOW-0035 to Firebase App Check lives in the stacked PR because that knowledge page is introduced in the iOS one.

Known gap

No best practice covers the Play Integrity API itself. BEST-0x01 recommends it as the starting point but only documents the manual Key Attestation path, and the nonce guidance that used to live in KNOW-0035 was removed with the rewrite. Worth a follow-up.

TODO:

  • Allocate IDs before merge

AI Tool Disclosure

Check exactly one option.

  • This contribution does not include AI-generated content.
  • This contribution includes AI-generated content.

If AI tools were used to generate or substantially modify code or text, complete the following.

  • AI tools used: Claude Code
  • Models and versions: Claude Opus 5, Claude Fable 5.1
  • Prompt summary: Grammar, feedback and reading cohesion throughout. Later used to review the branch for gaps and broken cross-references, to draft TEST-0x05 and the device-attestation demo, to build and verify the demos against a local emulator, and finally to split Attestation & Hardcoded Secrets (Android+ iOS): Best Practises, Know, Tests, Demos #3756 into three PRs and run a content quality pass over the result.

Undisclosed use of AI tools will result in the PR being closed. Large rewrites or bulk changes generated by AI require explicit prior approval from the maintainers. Learn more in "Use of AI tools in contributions".


Contributor Checklist

  • I have read and understood the contributing guidelines.
  • I followed the project style guide.
  • I validated the technical correctness of my changes and understand the topic.
  • This PR adds clear value and is not spam or low-effort content.

Relevant documentation.

Contributors are expected to understand basic git and GitHub workflows, including forks, branches, commits, and pull requests. The project does not provide training. Pull requests that do not meet these minimum requirements may be closed without review.

🤖 Generated with Claude Code

Diolor and others added 2 commits September 5, 2026 19:47
…SILIENCE

Pure move with no content changes so the rewrite in the next commit shows as a real diff.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Split out of OWASP#3756. Covers hardware-backed Key Attestation and Play Integrity:
server-side verification guidance (MASTG-BEST-0x01), the reworked Key Attestation
knowledge with device and app attestation pages filled in, app and device attestation
tests (MASTG-TEST-0x01, MASTG-TEST-0x05) and three semgrep-backed demos.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- **`signatureDigests` do not match**: The SHA-256 digests of the app's signing certificates differ from the legitimate app's known digests at the time of release. This is the primary indicator that the APK has been repackaged or signed with a different key (e.g., a malicious clone or a patched version of the app).
- **`version` is below the minimum acceptable version**: The app version recorded at key generation time is too old, indicating a version with known vulnerabilities or one that predates a security-relevant update.

## Enforce Key Properties

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

so that I don't forget: add a session to align app risk with device security and patch level

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create new Android BEST practice: device, app attestation with hardware backed keys

1 participant