public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "David Gstir" <david@sigma-star.at>,
	"sigma star Kernel Team" <upstream+dcp@sigma-star.at>,
	"James Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Mimi Zohar" <zohar@linux.ibm.com>,
	"David Howells" <dhowells@redhat.com>,
	"Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	"David Oberhollenzer" <david.oberhollenzer@sigma-star.at>,
	"Richard Weinberger" <richard@nod.at>
Cc: <linux-integrity@vger.kernel.org>, <keyrings@vger.kernel.org>,
	<linux-security-module@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] KEYS: trusted: dcp: fix leak of blob encryption key
Date: Wed, 17 Jul 2024 13:32:42 +0300	[thread overview]
Message-ID: <D2RQUZCAHOJY.1KTAFTZ818GJ6@kernel.org> (raw)
In-Reply-To: <20240703125353.46115-2-david@sigma-star.at>

On Wed Jul 3, 2024 at 3:53 PM EEST, David Gstir wrote:
> Trusted keys unseal the key blob on load, but keep the sealed payload in
> the blob field so that every subsequent read (export) will simply
> convert this field to hex and send it to userspace.
>
> With DCP-based trusted keys, we decrypt the blob encryption key (BEK)
> in the Kernel due hardware limitations and then decrypt the blob payload.
> BEK decryption is done in-place which means that the trusted key blob
> field is modified and it consequently holds the BEK in plain text.
> Every subsequent read of that key thus send the plain text BEK instead
> of the encrypted BEK to userspace.
>
> This issue only occurs when importing a trusted DCP-based key and
> then exporting it again. This should rarely happen as the common use cases
> are to either create a new trusted key and export it, or import a key
> blob and then just use it without exporting it again.
>
> Fix this by performing BEK decryption and encryption in a dedicated
> buffer. Further always wipe the plain text BEK buffer to prevent leaking
> the key via uninitialized memory.
>
> Signed-off-by: David Gstir <david@sigma-star.at>
> Fixes: 2e8a0f40a39c ("KEYS: trusted: Introduce NXP DCP-backed trusted keys")

Similar comments, fixes before sob etc and CC to stable with "# v6.10+"

BR, Jarkko

  reply	other threads:[~2024-07-17 10:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03 12:53 [PATCH 1/2] KEYS: trusted: fix DCP blob payload length assignment David Gstir
2024-07-03 12:53 ` [PATCH 2/2] KEYS: trusted: dcp: fix leak of blob encryption key David Gstir
2024-07-17 10:32   ` Jarkko Sakkinen [this message]
2024-07-17 10:07 ` [PATCH 1/2] KEYS: trusted: fix DCP blob payload length assignment Jarkko Sakkinen
2024-07-17 10:19   ` Richard Weinberger
2024-07-17 11:26     ` Jarkko Sakkinen
2024-07-17 11:03   ` David Gstir
2024-07-17 11:27     ` Jarkko Sakkinen

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=D2RQUZCAHOJY.1KTAFTZ818GJ6@kernel.org \
    --to=jarkko@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=david.oberhollenzer@sigma-star.at \
    --cc=david@sigma-star.at \
    --cc=dhowells@redhat.com \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=richard@nod.at \
    --cc=serge@hallyn.com \
    --cc=upstream+dcp@sigma-star.at \
    --cc=zohar@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox