public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "James Bottomley" <jejb@linux.ibm.com>
To: Stefan Berger <stefanb@linux.ibm.com>,
	devel@edk2.groups.io, Gerd Hoffmann <kraxel@redhat.com>
Cc: "Min Xu" <min.m.xu@intel.com>,
	"Jordan Justen" <jordan.l.justen@intel.com>,
	"Erdem Aktas" <erdemaktas@google.com>,
	"Ard Biesheuvel" <ardb+tianocore@kernel.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Jiewen Yao" <jiewen.yao@intel.com>,
	"Tom Lendacky" <thomas.lendacky@amd.com>,
	"Brijesh Singh" <brijesh.singh@amd.com>
Subject: Re: [edk2-devel] [PATCH 4/4] OvmfPkg: add TPM2_SHA1_ENABLE build option
Date: Fri, 22 Oct 2021 11:01:14 -0400	[thread overview]
Message-ID: <5fa198e0c4df2436ebbbe01cc8ebad4062e679b5.camel@linux.ibm.com> (raw)
In-Reply-To: <a551e712-76fd-15f0-0bba-31c1963bddac@linux.ibm.com>

On Fri, 2021-10-22 at 10:52 -0400, Stefan Berger wrote:
> On 10/22/21 10:17 AM, James Bottomley wrote:
> > On Fri, 2021-10-22 at 09:13 -0400, Stefan Berger wrote:
> > > On 10/22/21 8:40 AM, James Bottomley wrote:
> > > 
> > > > On Fri, 2021-10-22 at 07:57 -0400, Stefan Berger wrote:
> > > > > On 10/22/21 7:49 AM, James Bottomley wrote:
> > > > > > On Fri, 2021-10-22 at 06:50 -0400, Stefan Berger wrote:
> > > > > > [...]
> > > > > > > I see this also but when I get into Linux and run
> > > > > > > tpm2_pcrread I see the SHA1 bank active but not having
> > > > > > > received any PCR extensions from the firmware, which is
> > > > > > > not supposed to happen.
> > > > > >  
> > > > > > That's not entirely correct: the TCG firmware profile just
> > > > > > requires us to log through at least one bank; it doesn't
> > > > > > require that all active banks be logged.  I've got several
> > > > > > physical systems with three active banks but only one or
> > > > > > two measured through.
> > > > >    
> > > > > The problem with this is that you can then fake measured boot
> > > > > on that system using it's unused SHA1 bank and extend into it
> > > > > whatever you want and create a fake log along with it and the
> > > > > quote is going to look alright.
> > > > 
> > > > I don't think you can.  The measured boot PCRs in unused banks
> > > > should always be their default values and the measurement
> > > > software should check for this.  So on a system that only uses
> > > > the sha256 bank, the sha1 bank PCR0-7 should be all zeros ...
> > > > if they aren't this should be a measurement failure.
> > > > 
> > > > That means that if you try to replace the sha256 agile log with
> > > > one containing fake sha1 entries, the attestation still fails
> > > > because the sha256 bank doesn't have default entries.
> > >  
> > > You can still pretend that your system only has an active SHA1
> > > bank and serve the fake log.
> >  
> > Which "You" can fake a TPM quote?  The whole design of the TPM
> > system is supposed to be that what goes into the TPM can't be
> > erased, only updated and we can get definitive proof of the values
> > using a quote.
>  
> What I meant is the admin runs TPM2_PCR_Extend on PCRs 0-7 of the
> unused sha1 bank and extends it with known good values and has a log
> that goes with it and presents these to a validator

Yes, I got all that.

>  along with the quote on the  sha1 bank.

The validator shouldn't accept that quote ... it should require a quote
covering all banks.  This is the point: you can't fake the quote and
the quote should cover all banks to assure you that unextended banks
really are.

> > You can fake the log to be sha1 only but you can't make it match
> > the quote that includes the sha256 banks.
> 
> Yes, that's right. The client must insist that the sha256 bank, and
> any other possible bank, is quoted so that the system cannot just
> pretend that it only has a XYZ [sha1] bank (unlikely for TPM 2),

Impossible per the TPM spec.

>  and ABC banks [sha256] doesn't exist there, even though the SHA256
> matches the true log. A quote by itself doesn't quote all the banks.
> You have to select which banks to quote and the client needs to have
> some control over that it seems to for sure see what the true
> firmware did.

Hey, I'm not going to disagree that the TPM system leaves many ways for
people to shoot themselves in the foot.  The only point I'm making is
that if you use it correctly (which I fully accept is somewhat complex)
you quote all banks and thus can't be tricked into accepting a fake log
through a bank unextended by firmware.

James



  reply	other threads:[~2021-10-22 15:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 12:19 [PATCH 0/4] OvmfPkg: rework TPM configuration Gerd Hoffmann
2021-10-21 12:20 ` [PATCH 1/4] OvmfPkg: move tcg configuration to dsc and fdf include files Gerd Hoffmann
2021-10-21 14:12   ` [edk2-devel] " Stefan Berger
2021-10-21 12:20 ` [PATCH 2/4] OvmfPkg: create Tcg2ConfigPeiCompat12.inf Gerd Hoffmann
2021-10-21 14:46   ` [edk2-devel] " Stefan Berger
2021-10-22  6:31     ` Gerd Hoffmann
2021-10-22 13:29       ` Stefan Berger
2021-10-21 12:20 ` [PATCH 3/4] OvmfPkg: rework TPM configuration Gerd Hoffmann
2021-10-21 15:44   ` Stefan Berger
2021-10-22  6:30     ` Gerd Hoffmann
2021-10-21 12:20 ` [PATCH 4/4] OvmfPkg: add TPM2_SHA1_ENABLE build option Gerd Hoffmann
2021-10-21 13:24   ` Stefan Berger
2021-10-22  6:39     ` Gerd Hoffmann
2021-10-22 10:50       ` Stefan Berger
2021-10-22 11:37         ` Gerd Hoffmann
2021-10-22 11:49         ` James Bottomley
2021-10-22 11:57           ` Stefan Berger
2021-10-22 12:40             ` James Bottomley
2021-10-22 13:13               ` Stefan Berger
2021-10-22 14:17                 ` James Bottomley
2021-10-22 14:52                   ` [edk2-devel] " Stefan Berger
2021-10-22 15:01                     ` James Bottomley [this message]
2021-10-22 15:48                       ` Stefan Berger
2021-10-22 16:50                         ` James Bottomley
2021-10-21 16:13 ` [PATCH 0/4] OvmfPkg: rework TPM configuration Stefan Berger
2021-10-22  7:01   ` Gerd Hoffmann
2021-10-22 10:46     ` [edk2-devel] " Stefan Berger

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-list 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=5fa198e0c4df2436ebbbe01cc8ebad4062e679b5.camel@linux.ibm.com \
    --to=devel@edk2.groups.io \
    /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