Skip to content

fix(tpm-qvl): reject duplicate PCR indices before the event-log replay - #1267

Merged
kvinwang merged 1 commit into
nextfrom
fix/tpm-replay-and-diagnose
Sep 24, 2026
Merged

kvinwang merged 1 commit into
nextfrom
fix/tpm-replay-and-diagnose

Conversation

@kvinwang

@kvinwang kvinwang commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

verify_quote_with_ca replays the event log before the AK certificate or signature is checked, and verify_event_log rescans the whole log once per entry in pcr_values. Nothing required the PCR indices to be distinct: a TPMS_ATTEST with 5 000 selections all naming PCR 0 (20 KB) plus a matching pcr_values passes both pre-signature gates (the selection list is unsigned, pcr_digest is a plain SHA-256). With 5 000 events that is 25 M extends, measured at 4.66 s of one core per request in release. Reachable via GCP TDX attestations (a replayed public TDX quote plus an attacker-supplied tpm_quote).

Fix

  • Reject a quote whose pcr_values repeat an index (a real TPM never produces one).
  • Bucket the event log by quoted PCR in one pass, so replay cost is linear in the log size.

Verification

@kvinwang kvinwang changed the title fix(tpm-qvl): 20 KB of duplicate PCR selections buys 4.7 seconds of CPU before any signature is checked fix(tpm-qvl): reject duplicate PCR indices before the event-log replay Sep 24, 2026
@kvinwang
kvinwang force-pushed the fix/tpm-replay-and-diagnose branch from db0fa7a to 444e502 Compare September 24, 2026 09:01
@kvinwang
kvinwang merged commit e41dfdc into next Sep 24, 2026
12 checks passed
@kvinwang
kvinwang deleted the fix/tpm-replay-and-diagnose branch September 24, 2026 14:20
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