Skip to content

fix(tpm-qvl,nsm-qvl): bound collateral fetching from untrusted URLs - #1238

Merged
kvinwang merged 1 commit into
nextfrom
fix/tpm-qvl-collateral-bounds
Sep 24, 2026
Merged

kvinwang merged 1 commit into
nextfrom
fix/tpm-qvl-collateral-bounds

Conversation

@kvinwang

@kvinwang kvinwang commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

tpm-qvl and nsm-qvl fetch collateral before the quote is verified, from URLs in certificates the caller supplies: the TPM AK certificate's AIA and CRL distribution points, and every certificate in an NSM document's cabundle. Nothing bounded that work:

  • tpm-qvl followed AIA links in an unconditional loop, so an endless chain never returns.
  • Both tried every CRL distribution point and read response bodies without a size limit.
  • nsm-qvl's async reqwest::get had no timeout at all: one hanging distribution point stalls a Nitro verification forever.

The duplicated CRL download code moves into a new pki-fetch crate. Its Fetcher gives each collateral fetch one budget: 60s total, 16 requests, 4 MiB of bodies, with each request also capped at 30s so a hanging endpoint falls through to the next. Bounding requests, rather than chain depth or distribution points per certificate, covers the AIA loop, long distribution-point lists and an arbitrarily long cabundle alike. Real fetches use a fraction of it: GCP makes 3 requests (2 AIA hops, one 765-byte CRL), AWS Nitro 2.

tpm-qvl moves from blocking to async reqwest: capping the body means streaming it, and the blocking client's Read restarts its timeout on every read. This also drops the spawn_blocking hop and the nested runtime the mock-attestation test needed.

No host allowlist: everything these endpoints serve still has to chain to the pinned platform root CA, so pinning hosts adds no attestation security. The verifier can still be made to GET attacker-chosen (including internal) addresses before the quote is verified; restricting which networks it may reach is an operator-side egress control.

Note: TEST_FETCH_CRL=1 in nsm-qvl fails on next too — the fixture's regional CRL URL now returns 403.

@kvinwang
kvinwang force-pushed the fix/tpm-qvl-collateral-bounds branch from df1b3ad to 6d697c0 Compare September 23, 2026 07:06
@kvinwang kvinwang changed the title fix(tpm-qvl): bound collateral fetching from untrusted URLs, and bind the GCP image identity to an attested PCR fix(tpm-qvl): bound collateral fetching from untrusted AIA and CRL URLs Sep 23, 2026
@kvinwang
kvinwang force-pushed the fix/tpm-qvl-collateral-bounds branch 5 times, most recently from 91a4080 to e8cbd99 Compare September 23, 2026 09:51
@kvinwang kvinwang changed the title fix(tpm-qvl): bound collateral fetching from untrusted AIA and CRL URLs fix(tpm-qvl,nsm-qvl): bound collateral fetching from untrusted URLs Sep 23, 2026
tpm-qvl and nsm-qvl fetch collateral before the quote is verified, from URLs
in certificates the caller supplies: the TPM AK certificate's AIA and CRL
distribution points, and every certificate in an NSM document's cabundle.
Nothing bounded that work. tpm-qvl followed AIA links in an unconditional
loop; both tried every CRL distribution point and read bodies without a size
limit; nsm-qvl's async `reqwest::get` had no timeout at all, so one hanging
distribution point stalled a Nitro verification forever.

Move the duplicated CRL download code into a new `pki-fetch` crate whose
`Fetcher` gives each collateral fetch one budget: 60s in total, 16 requests
and 4 MiB of response bodies, with each request also capped at 30s so a
hanging endpoint falls through to the next one. Bounding requests rather
than chain depth or distribution points per certificate covers the AIA loop,
long distribution point lists and an arbitrarily long cabundle alike. Real
fetches use a fraction of it: GCP makes 3 requests (2 AIA hops, one 765-byte
CRL), AWS Nitro 2.

tpm-qvl moves from blocking to async reqwest: capping the body means
streaming it, and the blocking client's `Read` restarts its timeout on every
read. This also drops the `spawn_blocking` hop, and the nested runtime the
mock-attestation test used to call the blocking fetch.

No host allowlist: everything these endpoints serve still has to chain to
the pinned platform root CA, so pinning hosts adds no attestation security.
Restricting which networks the verifier may reach is an operator-side
egress control.
@kvinwang
kvinwang force-pushed the fix/tpm-qvl-collateral-bounds branch from e8cbd99 to 832b5f0 Compare September 24, 2026 01:05
@kvinwang
kvinwang merged commit 9d353c1 into next Sep 24, 2026
14 checks passed
@kvinwang
kvinwang deleted the fix/tpm-qvl-collateral-bounds branch September 24, 2026 01:32
kvinwang added a commit that referenced this pull request Sep 25, 2026
…ted hosts

tpm-qvl and nsm-qvl follow AIA and CRL distribution point URLs from
certificates that are only verified after the fetch. In the verifier this
runs for any unauthenticated /verify caller, so the caller chose which hosts
the verifier connected to, internal ones included. #1238 bounded how much
work that does; this bounds where it goes.

Fetcher now takes an AllowedHosts list and checks every URL against it,
redirect hops included. A `*` matches within one DNS label. The default
covers where the vendors publish this collateral:
privateca-content-*.storage.googleapis.com for the GCP vTPM chain (the
pinned GCP root and its CRL are served there) and the two AWS Nitro CRL
host shapes. KMS, gateway and verifier can replace it with
`attestation.allowed_collateral_hosts`.

The list lives in AttestationVerifierConfig, not CollateralUrls: the latter
is also read from the host-supplied sys_config, which must not widen it.
A guest verifying against TEE-simulator roots allows the hosts of its
collateral URLs, since the simulator's collateral service serves both.
kvinwang added a commit that referenced this pull request Sep 25, 2026
Extend the SEV-SNP case with the certificate-table, empty-report, guest
feature, rootfs-hash and page-budget tests (#1248, #1279, #1275, #1252),
and the cloud TPM case with the PCR bank, duplicate index, quoted event
log, collateral budget and host allowlist tests (#1275, #1267, #1338,

Signed-off-by: Kevin Wang <wy721@qq.com>
#1238, #1404).
kvinwang added a commit that referenced this pull request Nov 8, 2026
Extend the SEV-SNP case with the certificate-table, empty-report, guest
feature, rootfs-hash and page-budget tests (#1248, #1279, #1275, #1252),
and the cloud TPM case with the PCR bank, duplicate index, quoted event
log, collateral budget and host allowlist tests (#1275, #1267, #1338,

Signed-off-by: Kevin Wang <wy721@qq.com>
#1238, #1404).
kvinwang added a commit that referenced this pull request Nov 8, 2026
Extend the SEV-SNP case with the certificate-table, empty-report, guest
feature, rootfs-hash and page-budget tests (#1248, #1279, #1275, #1252),
and the cloud TPM case with the PCR bank, duplicate index, quoted event
log, collateral budget and host allowlist tests (#1275, #1267, #1338,

Signed-off-by: Kevin Wang <wy721@qq.com>
#1238, #1404).
kvinwang added a commit that referenced this pull request Nov 10, 2026
Extend the SEV-SNP case with the certificate-table, empty-report, guest
feature, rootfs-hash and page-budget tests (#1248, #1279, #1275, #1252),
and the cloud TPM case with the PCR bank, duplicate index, quoted event
log, collateral budget and host allowlist tests (#1275, #1267, #1338,

Signed-off-by: Kevin Wang <wy721@qq.com>
#1238, #1404).
kvinwang added a commit that referenced this pull request Nov 11, 2026
Extend the SEV-SNP case with the certificate-table, empty-report, guest
feature, rootfs-hash and page-budget tests (#1248, #1279, #1275, #1252),
and the cloud TPM case with the PCR bank, duplicate index, quoted event
log, collateral budget and host allowlist tests (#1275, #1267, #1338,

Signed-off-by: Kevin Wang <wy721@qq.com>
#1238, #1404).
kvinwang added a commit that referenced this pull request Nov 11, 2026
Extend the SEV-SNP case with the certificate-table, empty-report, guest
feature, rootfs-hash and page-budget tests (#1248, #1279, #1275, #1252),
and the cloud TPM case with the PCR bank, duplicate index, quoted event
log, collateral budget and host allowlist tests (#1275, #1267, #1338,

Signed-off-by: Kevin Wang <wy721@qq.com>
#1238, #1404).
kvinwang added a commit that referenced this pull request Nov 16, 2026
Extend the SEV-SNP case with the certificate-table, empty-report, guest
feature, rootfs-hash and page-budget tests (#1248, #1279, #1275, #1252),
and the cloud TPM case with the PCR bank, duplicate index, quoted event
log, collateral budget and host allowlist tests (#1275, #1267, #1338,

Signed-off-by: Kevin Wang <wy721@qq.com>
#1238, #1404).
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