U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal via U-Boot <u-boot@lists.u-boot-project.org>
To: shj <shahriyar@byteray.co.uk>
Cc: u-boot@lists.u-boot-project.org,
	 Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	 Simon Glass <sjg@chromium.org>,
	u-boot@lists.denx.de,  Andy Fleming <afleming@freescale.com>,
	 Reinhard Pfau <pfau@gdsys.de>,
	 Che-Liang Chiou <clchiou@chromium.org>,
	 Dirk Eibach <dirk.eibach@gdsys.cc>,
	 Tom Rini <trini@konsulko.com>,  Argus <argus@byteray.co.uk>
Subject: Re: [PATCH 0/2] tpm: bounds-check device-reported response lengths
Date: Fri, 24 Jul 2026 11:47:51 +0200	[thread overview]
Message-ID: <87pl0cra60.fsf@bootlin.com> (raw)
In-Reply-To: <20260723-tpm-trunc-resp-v1-0-72a54ac30f4f@byteray.co.uk> (shj's message of "Thu, 23 Jul 2026 16:01:27 +0200")

Hello,

On 23/07/2026 at 16:01:27 +02, shj <shahriyar@byteray.co.uk> wrote:

> A TPM reply's length is taken from the device and only upper-capped, then
> several callers use it unchecked: the TPM1 OIAP helpers and the TPM2
> GetCapability parser subtract a fixed header length from it, so a reply too
> short underflows the subtraction into a huge memcpy; the GetCapability
> parser then copies that many bytes into the caller's buffer, so a reply
> longer than the buffer overruns it. Because a TPM sits on a physically
> accessible bus, a cheap bus interposer (the kind used to sniff
> disk-encryption keys) can inject such a reply, and on the TPM2 path this
> parsing runs during measured boot, which is exactly the physical attacker
> that measured boot is meant to resist.
>
> Patch 1 bounds the reported length against the header and, for a properties
> query, the caller's buffer. Patch 2 adds regression tests driving the TPM2
> parser with a truncated and an over-long reply through the sandbox emulator.
>
> Based on v2026.07 (fdfe2ec48d5c). A reproducer is available on request.
>
> Signed-off-by: shj <shahriyar@byteray.co.uk>

Thanks for the contribution. Unfortunately, this is not a proper SoB
line, you must put your real identity there.

With this fixed, I am fine with the approach,

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

  parent reply	other threads:[~2026-07-24 14:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 14:01 [PATCH 0/2] tpm: bounds-check device-reported response lengths shj
2026-07-23 14:01 ` [PATCH 1/2] tpm: bounds-check the device-controlled response length shj
2026-07-23 14:01 ` [PATCH 2/2] test: tpm: check malformed capability responses are rejected shj
2026-07-24  9:47 ` Miquel Raynal via U-Boot [this message]
2026-07-24 10:41   ` [PATCH 0/2] tpm: bounds-check device-reported response lengths shj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pl0cra60.fsf@bootlin.com \
    --to=u-boot@lists.u-boot-project.org \
    --cc=afleming@freescale.com \
    --cc=argus@byteray.co.uk \
    --cc=clchiou@chromium.org \
    --cc=dirk.eibach@gdsys.cc \
    --cc=ilias.apalodimas@linaro.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pfau@gdsys.de \
    --cc=shahriyar@byteray.co.uk \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox