Skip to content

Fix input data checks for azure attestation#138

Merged
ameba23 merged 1 commit intomainfrom
peg/fix-azure-attestation-verification
Feb 25, 2026
Merged

Fix input data checks for azure attestation#138
ameba23 merged 1 commit intomainfrom
peg/fix-azure-attestation-verification

Conversation

@ameba23
Copy link
Collaborator

@ameba23 ameba23 commented Feb 24, 2026

This PR hardens Azure attestation verification by enforcing full 64-byte input binding (cert_hash || tls_exporter) on the verifier side.

Previously, Azure verification validated internal evidence consistency and vTPM nonce binding for only the first 32 bytes. This change adds an explicit check that HCL runtime claims user-data exactly matches the local expected_input_data (64 bytes), preventing cross-session replay where exporter bytes differ.

Security impact

  • Restores session-freshness semantics in Azure path to match the intended 64-byte attestation input model.
  • Converts ambiguous/missing user-data into hard verification failures.
  • Prevents accepting Azure attestations whose embedded input is not equal to verifier-local expected input.

Code changes

  • In Azure verifier (verify_azure_attestation_with_given_timestamp):
    • Parse user-data from HCL claims.
    • Hex-decode and require exact 64-byte length.
    • Compare against expected_input_data; return error on mismatch.
  • Updated HclRuntimeClaims.user_data type to Option.
  • Added MaaError variants:
    • Hex(#[from] hex::FromHexError)
    • ClaimsMissingUserData
    • ClaimsUserDataBadLength
    • ClaimsUserDataInputMismatch

Tests

  • Updated positive test to derive the expected input directly from the fixture’s HCL user-data.
  • Added negative test test_verify_fails_on_input_mismatch:
    • Mutates one byte in expected input.
    • Asserts verifier returns MaaError::ClaimsUserDataInputMismatch.

Backward compatibility

  • No public API signature changes.
  • Behavior is stricter by design: malformed/missing/mismatched HCL user-data now fails verification.

@ameba23 ameba23 merged commit b5ff02f into main Feb 25, 2026
2 checks passed
@ameba23 ameba23 deleted the peg/fix-azure-attestation-verification branch February 25, 2026 08:29
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