linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Jörg Rödel" <jroedel@suse.de>
Cc: linux-coco@lists.linux.dev, amd-sev-snp@lists.suse.com
Subject: Re: SVSM initiated early attestation / guest secrets injection
Date: Fri, 13 Jan 2023 18:28:32 +0000	[thread overview]
Message-ID: <Y8Gi0KLj5JbhCqBE@redhat.com> (raw)
In-Reply-To: <Y8GTXpfqlOe53cEr@suse.de>

On Fri, Jan 13, 2023 at 06:22:38PM +0100, Jörg Rödel wrote:
> Hi Daniel,
> 
> On Thu, Jan 12, 2023 at 02:39:24PM +0000, Daniel P. Berrangé wrote:
> >  4. SVSM requests an attestation report from SEV-SNP firmware, embedding a
> >     hash of the attestation server public key and its own public key.
> > 
> >  5. SVSM transmits the attestation report and the two public keys on the ISA
> >     serial port
> 
> This basically emulates the secret injection mechanism that was
> implemented for SEV and SEV-ES by the firmware, right?
> 
> I see a problem here which allows a potential host owner to steal
> the secrets from the attestation server. Maybe I am wrong, but I think
> the following is possible with the above sequence:
> 
> 	1. Host owner sets up a CVM like the guest owner would do, with
> 	   the same SVSM and Firmware binaries, same initial state and
> 	   so on, so that the initial measurement is the same as if the
> 	   VM was setup by the guest owner.
> 
> 	2. Host owner attaches a different disk image with malicious
> 	   content, e.g. a boot loader that sends the secrets to the host
> 	   owner.
> 
> 	3. SVSM and attestation server have no way of detecting this,
> 	   because the disk image is not part of the initial measurement
> 	   from the SNP firmware. So above sequence would complete and
> 	   SVSM gets the secrets from the attestation server.
> 
> 	4. The malicious software loaded from the disk image gets access
> 	   to the secrets and sends them to the host owner.
> 
> 	4. Host owner can use the guest owners secrets to steal data
> 	   from the encrypted disk image the guest owner provided.
> 
> To prevent this it is necessary that the measurement sent to the
> attestation server includes all software and data which is
> executed/loaded from unencrypted storage. For example, in a common boot
> flow it needs to include the Grub binary and Grub configuration.
> 
> But these parts are not included in the initial measurement that the
> SVSM gets from the SNP firmware.

Aside from what James' says, one option is to lockdown the OVMF and
secureboot chain. eg OVMF built with SecureBoot=on, and instead of
having the generic Microsoft keys enrolled, have a distro specific
key enrolled. That distro key would have to be one that is only
used for signing UKIs (Unified Kernel Images), and the initrd embedded
in the UKI would need to be designed abort if it finds the disk is
not encrypted.

The main challenge here is that you don't have a single OVMF anymore.
You have many OVMFs, one for each distinct set of distro SecureBoot
keys, and the attestation server has to decide which one it wants
based on the distro the VM is expected to use.

If we don't do any of this, then the early attestation and secret
fetch would have to be limited to /only/ the secret for unlocking
the vTPM state, and not injected into the guest OS. The OS would
have to do everything else with the vTPM and PCR sealed data to
achieve the same end results of only getting access to secrets if
the vTPM sees the set of PCR values corresponding to the desired
UKI secureboot keys.

Ultimately the latter is probably the more common case and more
flexible.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


  parent reply	other threads:[~2023-01-13 18:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12 14:39 SVSM initiated early attestation / guest secrets injection Daniel P. Berrangé
2023-01-13 17:22 ` Jörg Rödel
2023-01-13 18:02   ` James Bottomley
2023-01-14 16:57     ` Jörg Rödel
2023-01-19 14:05     ` Christophe de Dinechin Dupont de Dinechin
2023-01-19 14:10       ` James Bottomley
2023-01-19 21:18         ` Jörg Rödel
2023-01-19 21:29           ` James Bottomley
2023-01-20  8:37             ` Jörg Rödel
2023-01-20  8:57               ` Daniel P. Berrangé
2023-01-20 12:39                 ` James Bottomley
2023-01-20 12:51                   ` Daniel P. Berrangé
2023-01-20 17:10                     ` James Bottomley
2023-01-20 12:32               ` James Bottomley
2023-01-13 18:28   ` Daniel P. Berrangé [this message]
2023-01-13 18:52     ` Dionna Amalie Glaze
2023-01-16  9:36       ` Daniel P. Berrangé
2023-01-14 17:08     ` Jörg Rödel
2023-01-14 18:22       ` James Bottomley
2023-01-16 16:55         ` Jörg Rödel
2023-01-16 16:59           ` James Bottomley
2023-01-17 16:47             ` Jörg Rödel
2023-01-16 17:13           ` Daniel P. Berrangé
2023-01-17 16:53             ` Jörg Rödel

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=Y8Gi0KLj5JbhCqBE@redhat.com \
    --to=berrange@redhat.com \
    --cc=amd-sev-snp@lists.suse.com \
    --cc=jroedel@suse.de \
    --cc=linux-coco@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).