Repository navigation
fix(tpm-qvl,nsm-qvl): bound collateral fetching from untrusted URLs - #1238
Merged
Merged
Conversation
This was referenced Sep 20, 2026
kvinwang
force-pushed
the
fix/tpm-qvl-collateral-bounds
branch
from
September 23, 2026 07:06
df1b3ad to
6d697c0
Compare
kvinwang
force-pushed
the
fix/tpm-qvl-collateral-bounds
branch
5 times, most recently
from
September 23, 2026 09:51
91a4080 to
e8cbd99
Compare
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
force-pushed
the
fix/tpm-qvl-collateral-bounds
branch
from
September 24, 2026 01:05
e8cbd99 to
832b5f0
Compare
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:reqwest::gethad no timeout at all: one hanging distribution point stalls a Nitro verification forever.The duplicated CRL download code moves into a new
pki-fetchcrate. ItsFetchergives 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 longcabundlealike. 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
Readrestarts its timeout on every read. This also drops thespawn_blockinghop 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=1in nsm-qvl fails onnexttoo — the fixture's regional CRL URL now returns 403.