Skip to content

During Azure vTPM attestation verification, parse potentially several intermediaries from AK cert chain#48

Closed
ameba23 wants to merge 1 commit into
mainfrom
peg/fix-azure-cert-chain-validation
Closed

During Azure vTPM attestation verification, parse potentially several intermediaries from AK cert chain#48
ameba23 wants to merge 1 commit into
mainfrom
peg/fix-azure-cert-chain-validation

Conversation

@ameba23
Copy link
Copy Markdown
Collaborator

@ameba23 ameba23 commented Jun 5, 2026

This [hopefully] fixes an issue with verifying AK certificate chain during Azure attestation.

In some cases Azure attestation have failed to verify due to AK certificate chain verification, but our hardcoded root certificate still matches what Microsoft publicly publishes.

My hunch is that the issue is because we currently only parse a single certificate from the AK chain given in the attestation, and use a hard coded intermediaries. But we should be parsing intermediaries given in the payload. This PR fixes that.

See this Q&A thread which i think discusses a similar issue:
https://learn.microsoft.com/en-us/answers/questions/5897616/download-intermediate-ca-cert-for-azure-cloud-virt

This is not yet tested on an Azure deployment, but tests pass against our existing fixtures.

return Err(MaaError::AkFromClaimsNotEqualAkFromCertificate);
}

// Strip trailing data from AK certificate
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.

This was (i think) the issue - here we are potentially discarding intermediary certs which are needed for verification.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Don't think you are discarding them. Afaict they aren't there in the first place. At least they weren't in my NV reponse. That's why in your link they mention "The AIA mechanism is the supported and expected way to validate the certificate hierarchy." They want you to fetch the certs dynamically from the URLs embedded in the leaf AK cert.

let end_entity_cert = EndEntityCert::try_from(&ak_cert_der)?;

let mut intermediates = DOCUMENTED_AZURE_INTERMEDIATES.clone();
intermediates.extend(parse_trailing_der_certificates(remaining_bytes)?);
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.

Im not sure if we should still be always adding this hard coded intermediary.

@ameba23
Copy link
Copy Markdown
Collaborator Author

ameba23 commented Jun 5, 2026

Will close this as it does not fix the issue.

@ameba23 ameba23 closed this Jun 5, 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