Skip to content

Commit 0b754c6

Browse files
JuergenReppSITAndreasFuchsTPM
authored andcommitted
tpm2_checkquote: Fix check of magic number.
It was not checked whether the magic number in the attest is equal to TPM2_GENERATED_VALUE. So an malicious attacker could generate arbitrary quote data which was not detected by tpm2 checkquote. Fixes: CVE-2024-29038 Signed-off-by: Juergen Repp <juergen_repp@web.de>
1 parent 2d07610 commit 0b754c6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tools/misc/tpm2_checkquote.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ static bool verify(void) {
159159
goto err;
160160
}
161161

162+
// check magic
163+
if (ctx.attest.magic != TPM2_GENERATED_VALUE) {
164+
LOG_ERR("Bad magic, got: 0x%x, expected: 0x%x",
165+
ctx.attest.magic, TPM2_GENERATED_VALUE);
166+
return false;
167+
}
168+
162169
// Also ensure digest from quote matches PCR digest
163170
if (ctx.flags.pcr) {
164171
if (!tpm2_util_verify_digests(&ctx.attest.attested.quote.pcrDigest,

0 commit comments

Comments
 (0)