Skip to content

Select the attestation extension nearest the root - #2

Merged
SloMR merged 2 commits into
mainfrom
attestExtensionSelection
Oct 22, 2026
Merged

SloMR merged 2 commits into
mainfrom
attestExtensionSelection

Conversation

@SloMR

@SloMR SloMR commented Oct 22, 2026

Copy link
Copy Markdown
Owner

What

HardwareAttestation.parseChain now reads the attestation extension from the
certificate nearest the root in the leaf-first chain and commits to it — instead
of reading the leaf's and rejecting any chain where another cert also carries one.

Why

Android returns the chain leaf-first, so a prepended descendant certificate can carry
an attacker-added extension; reading the leaf would trust it. Taking the root-most
extension resists that substitution, and a malformed ancestor now fails closed rather
than silently falling back to the leaf.

This is the local, unauthenticated parse — it feeds ENVIRONMENT posture signals
that never reach isRooted, and the server round-trip stays authoritative. It hardens
parsing; it does not authenticate the chain.

Also

  • Bounds the chain to 1..8 certificates and the extension to 64 KB (MAX_EXTENSION_BYTES).
  • Extracts parseChainExtensions as a tested seam. Four new unit tests cover the
    leaf-absent, descendant-cannot-override-ancestor, malformed-ancestor-no-fallback,
    and wrong-challenge / missing / empty / oversized cases — all green.
  • Bumps the library to 1.2.0.

SloMR added 2 commits October 22, 2026 03:03
- `parseChainExtensions` reads the root-most extension in the leaf-first chain and commits to it, so a prepended descendant cert cannot substitute a forged extension and a malformed ancestor fails closed instead of falling back to the leaf

- Bound the chain to 1..8 certs and the extension to `MAX_EXTENSION_BYTES`; this hardens the unauthenticated local parse, it does not authenticate the chain
@SloMR SloMR self-assigned this Oct 22, 2026
@SloMR
SloMR merged commit 34a5fcd into main Oct 22, 2026
2 checks passed
@SloMR
SloMR deleted the attestExtensionSelection branch October 22, 2026 00:10
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