[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D2RQUZCAHOJY.1KTAFTZ818GJ6@kernel.org>
Date: Wed, 17 Jul 2024 13:32:42 +0300
From: "Jarkko Sakkinen" <jarkko@...nel.org>
To: "David Gstir" <david@...ma-star.at>, "sigma star Kernel Team"
<upstream+dcp@...ma-star.at>, "James Bottomley"
<James.Bottomley@...senPartnership.com>, "Mimi Zohar"
<zohar@...ux.ibm.com>, "David Howells" <dhowells@...hat.com>, "Paul Moore"
<paul@...l-moore.com>, "James Morris" <jmorris@...ei.org>, "Serge E.
Hallyn" <serge@...lyn.com>, "David Oberhollenzer"
<david.oberhollenzer@...ma-star.at>, "Richard Weinberger" <richard@....at>
Cc: <linux-integrity@...r.kernel.org>, <keyrings@...r.kernel.org>,
<linux-security-module@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] KEYS: trusted: dcp: fix leak of blob encryption key
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@...ma-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
Powered by blists - more mailing lists