Skip to content

Full support for Azure Confidential VM (CVM) attestation flow #116

@hyperfinitism

Description

@hyperfinitism

Architecture of Azure CVM

On Azure CVMs, (hardware) remote attestation is facilitated by a vTPM with two reserved NV indices:

  • 0x01400001: This index stores the full Azure Attestation Report. This is a custom Azure format that wraps the underlying hardware report (e.g., SEV-SNP or TDX report).
  • 0x01400002: This is a 64-byte area for the guest OS.

Boot time

The paravisor requests the attestation report (AR) from the AMD-SP using the SHA digest of the Runtime Claims as the REPORT_DATA. The Runtime Claims is a JSON consisting of AK Pub (signing public key for vTPM Quote), EK Pub, VM config, and zero-filled user-data (64 bytes HEX string). The paravisor wraps AR + JSON + other metadata into the Azure Attestation Report format and (re)writes the complete blob to the vTPM NV index 0x01400001.

This initial AR cannot bind any guest-provided data such as nonce. Therefore, there are vulnerabilities to replay attacks.

Runtime Attestation

The attestation flow for Azure CVMs is as follows:

  1. The guest OS (the "Relying Party") generates 64-byte data for the attestation challenge.
  2. The guest (initialises and) writes these 64 bytes to the vTPM NV index 0x01400002.
  3. The Azure paravisor detects this write operation. It then constructs a new Runtime Claims JSON object, embedding the 64 bytes from the guest into the user-data field.
  4. The paravisor requests a new SNP report from the AMD-SP using the SHA digest of the new Runtime Claims as the REPORT_DATA.
  5. The paravisor wraps the new SNP report + JSON into the Azure report and (re)writes it to the vTPM NV index 0x01400001.
  6. The guest OS reads the updated Azure report from 0x01400001. This report is cryptographically bound to the guest-provided data.
  7. The guest sends the Azure report to a verifier, which can validate the signature and check that the REPORT_DATA matches the hash of the Runtime Claims JSON (incl. the guest-provided data).
# (1)
openssl rand 64 > user-data.bin
# (2)
sudo tpm2_nvdefine -C o 0x01400002 -s 64
sudo tpm2_nvwrite -C o 0x01400002 -i user-data.bin
# (3)-(5) automatically
# (6)
sudo snpguest report report.bin request-data.bin --platform
# signature verification part of (7)
snpguest fetch ca pem . -r report.bin -e vcek
snpguest fetch vcek pem . report.bin
snpguest verify attestation . report.bin

Problems

Currently, snpguest can only fetch the initial SNP report and Runtime Claims digest, and can only perform a part of step 6-7. To provide full support for Azure CVMs, snpguest should be enhanced to orchestrate this entire workflow.

Also, the current --platform flag is somewhat ambiguous. To make the tool's usage clearer, we propose renaming --platform to a more explicit name, such as --azure-cvm. This makes it evident that the flag enables a workflow specific to Azure's CVM implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions