All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolai Stange <nstange@suse.de>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Nicolai Stange <nstange@suse.de>,
	 Tyler Fanelli <tfanelli@redhat.com>,
	Oliver Steffen <osteffen@redhat.com>,
	 Stefano Garzarella <sgarzare@redhat.com>,
	 coconut-svsm@lists.linux.dev
Subject: Re: [DISCUSSION] svsm: attestation: if and how to authenticate the provided secret
Date: Tue, 14 Oct 2025 22:56:03 +0200	[thread overview]
Message-ID: <87o6q96w4c.fsf@> (raw)
In-Reply-To: <a6188e4c2eb11ac6fef4eab605666d15c3f604c4.camel@HansenPartnership.com> (James Bottomley's message of "Tue, 14 Oct 2025 15:23:51 -0400")

James Bottomley <James.Bottomley@HansenPartnership.com> writes:

> On Tue, 2025-10-14 at 10:45 +0200, Nicolai Stange wrote:
>>
>> as I don't want to hijack Tyler's recent attestation PR, I'd like to
>> continue a discussion started there and best summarized in the
>> comment at [1] here.
>> 
>> The question is whether or not to have the KBS authenticate the
>> secret returned to the SVSM upon a successful attestation.
>> 
>> The current state is that authenticated encryption is being used in
>> the protocol (AES-KW + AES-GCM), but that's only bound to an
>> ephemeral ECDH key, hence doesn't link to any root of trust.
>
> Could we wind back a bit?  This discussion seems to be starting in the
> middle.  Where does the encrypted state actually come from?

Sorry for being unclear -- this is one of the open questions, see below.


> The threat being that if an attacker can supply the TPM state to your
> confidential VM, they know all the TPM parameters, including the
> private keys, and can fake any attestation.   In the non-CVM world, the
> state is usually part of the VM image (encrypted), but this happens
> because the TPM is running outside the VM envelope and suspend or
> shutdown can pull the encrypted state as part of the device state of
> the VM image.  In the CVM world the state is stored inside CVM in the
> SVSM and has to be inaccessible to the guest.  It is possible for the
> SVSM to encrypt the TPM state and pass it to the guest which then saves
> it in the VM image.  In that case, proof of correctness can simply be
> supplying a key capable of decrypting the image.

The current plan is to not involve the guest at all. Instead
- a (small) block device will get attached to the SVSM, via virtio
  currently,
- there will be a filesystem on that block device, which is encrypted +
  authenticated with a (symmetric) "filesystem root key" known only to
  the SVSM and
- that filesystem root key will get revealed by the KBS to the SVSM upon
  successful attestation.

The TPM state will be stored in a file on that filesystem. UEFI data in
another and so on.

For more context, there's a SVSM-PR from myself pending to use the
"CocoonFs" format specifically designed for this purpose, c.f. [1], or
[2] on the format itself. More FS formats may get introduced to the SVSM
in the future in case there's a demand.

Where the filesystem gets formatted and the TPM (, UEFI, ...) state
stored thereon manufactured respectively is subject of the discussion
here, I think. That is, AFAICS it depends on whether and how the
filesystem root key obtained from the KBS can get authenticated.

FTR, I'm trying to make a point for formatting and manufacturing
everything from within the SVSM upon first use, and to bind the received
filesystem root key to an ECDSA key associated with the KBS, via:
- KBS signs its ephemeral ECDH public key with that ECDSA key,
- the shared key from ECDH is used for authenticated encryption of
  the secret, which includes the filesystem root key.

That on its own is quite useless of course (unless the expected KBS
ECDSA key would somehow get embedded into e.g. the IGVM), but the SVSM
could then subsequently present the KBS ECDSA key to relying parties, as
a confirmation that it's using a filesystem root key supplied by that
particular KBS.

Thanks!

Nicolai

[1] https://github.com/coconut-svsm/svsm/pull/806
[2] https://coconut-svsm.github.io/cocoon-tpm/cocoonfs/cocoonfs-format.html

>
> However, in a container (or immutable VM) world, there's no image
> update to save and the TPM state has to be saved somewhere separately
> (and at a location under the control of untrusted entities) so there
> has to be a strong binding between the encrypted TPM state and the CVM
> to prevent a state substitution attack (i.e. the CVM has to validate
> it's pulling the correct TPM state before using it).
>
> Regards,
>
> James
>

-- 
SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nürnberg, Germany
GF: Ivo Totev, Andrew McDonald, Werner Knoblich
(HRB 36809, AG Nürnberg)

  reply	other threads:[~2025-10-14 20:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14  8:45 [DISCUSSION] svsm: attestation: if and how to authenticate the provided secret Nicolai Stange
2025-10-14 19:23 ` James Bottomley
2025-10-14 20:56   ` Nicolai Stange [this message]
2025-10-14 21:40     ` James Bottomley
2025-10-15  1:33       ` Tyler Fanelli
2025-10-17 11:31         ` Nicolai Stange
2025-10-17 13:25         ` James Bottomley
2025-10-17 13:47           ` Daniel P. Berrangé
2025-10-17 19:48             ` James Bottomley
2025-10-24 12:17               ` Daniel P. Berrangé
     [not found]         ` <91799.125101707314800421@us-mta-315.us.mimecast.lan>
2025-10-17 16:16           ` Tyler Fanelli
2025-10-17 12:30       ` Nicolai Stange

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=87o6q96w4c.fsf@ \
    --to=nstange@suse.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=coconut-svsm@lists.linux.dev \
    --cc=osteffen@redhat.com \
    --cc=sgarzare@redhat.com \
    --cc=tfanelli@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.