From: Jarkko Sakkinen <jarkko@kernel.org>
To: Dan Carpenter <dan@pereq.eu>
Cc: "David Howells" <dhowells@redhat.com>,
"Lukas Wunner" <lukas@wunner.de>,
"Ignat Korchagin" <ignat@linux.win>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"David Woodhouse" <dwmw2@infradead.org>,
"Eric Snowberg" <eric.snowberg@oracle.com>,
"Karthik Bhargavan" <karthik@pereq.eu>,
"Clément Blaudeau" <clement@cryspen.com>,
keyrings@vger.kernel.org, linux-crypto@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 1/5] pkcs7: Don't trust a blacklisted certificate
Date: Tue, 1 Dec 2026 17:42:27 +0200 [thread overview]
Message-ID: <aw7q46YRjkhm9KAH@kernel.org> (raw)
In-Reply-To: <20261201-pkcs7-v1-1-ace9edcd1a53@pereq.eu>
On Tue, Dec 01, 2026 at 11:22:27AM +0300, Dan Carpenter wrote:
> If you have a signed module but the signature is blacklisted then it
> shouldn't load unless you have a second valid signature. The bug
> here is that an attacker can load the module by adding a SignerInfo
> that names a certificate which isn't in the message, with random bytes
> as the signature.
>
> The problem is that pkcs7_verify() checks for the blacklist but it
> relies on pkcs7_validate_trust() to check if the nonsense signature
> is valid. But pkcs7_validate_trust() says that the blacklisted signature
> is in the accepted list and accepts it.
>
> Make pkcs7_validate_trust_one() reject a blacklisted SignerInfo.
>
> Fixes: 03bb79315ddc ("PKCS#7: Handle blacklisted certificates")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dan Carpenter <dan@pereq.eu>
> ---
> crypto/asymmetric_keys/pkcs7_trust.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/crypto/asymmetric_keys/pkcs7_trust.c b/crypto/asymmetric_keys/pkcs7_trust.c
> index 9a87c34ed173..7f8b80c8488a 100644
> --- a/crypto/asymmetric_keys/pkcs7_trust.c
> +++ b/crypto/asymmetric_keys/pkcs7_trust.c
> @@ -30,6 +30,11 @@ static int pkcs7_validate_trust_one(struct pkcs7_message *pkcs7,
>
> kenter(",%u,", sinfo->index);
>
> + if (sinfo->blacklisted) {
> + kleave(" = -ENOKEY [blacklisted]");
> + return -ENOKEY;
> + }
> +
> if (sinfo->unsupported_crypto) {
> kleave(" = -ENOPKG [cached]");
> return -ENOPKG;
>
> --
> 2.53.0
>
Clear enough despite drifts a bit from my expertise scope:
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Br, Jarkko
next prev parent reply other threads:[~2026-12-01 15:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 8:22 [PATCH 0/5] pkcs7: Fix some certificate handling bugs Dan Carpenter
2026-12-01 8:22 ` [PATCH 1/5] pkcs7: Don't trust a blacklisted certificate Dan Carpenter
2026-12-01 15:42 ` Jarkko Sakkinen [this message]
2026-12-01 15:46 ` Jarkko Sakkinen
2026-12-01 8:22 ` [PATCH 2/5] certs: Fix error checking in is_key_on_revocation_list() Dan Carpenter
2026-12-01 8:22 ` [PATCH 3/5] pkcs7: Clear the ->verified flag before checking trust Dan Carpenter
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=aw7q46YRjkhm9KAH@kernel.org \
--to=jarkko@kernel.org \
--cc=clement@cryspen.com \
--cc=dan@pereq.eu \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=dwmw2@infradead.org \
--cc=eric.snowberg@oracle.com \
--cc=herbert@gondor.apana.org.au \
--cc=ignat@linux.win \
--cc=karthik@pereq.eu \
--cc=keyrings@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=stable@vger.kernel.org \
/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