From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Lukas Wunner <lukas@wunner.de>, Sashiko <sashiko-bot@kernel.org>,
Ignat Korchagin <ignat@linux.win>,
Alistair Francis <alistair.francis@wdc.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.15.y] X.509: Fix validation of ASN.1 certificate header
Date: Thu, 16 Jul 2026 15:49:38 -0400 [thread overview]
Message-ID: <20260716194938.1111666-1-sashal@kernel.org> (raw)
In-Reply-To: <2026071443-crouton-afterlife-63a4@gregkh>
From: Lukas Wunner <lukas@wunner.de>
[ Upstream commit 3b626ba431c4501512ad07549310685e07fe4706 ]
x509_load_certificate_list() seeks to enforce that a certificate starts
with 0x30 0x82 (ASN.1 SEQUENCE tag followed by a length of more than 256
and less than 65535 bytes).
But it only enforces that *either* of those two byte values are present,
instead of checking for the *conjunction* of the two values. Fix it.
Fixes: 631cc66eb9ea ("MODSIGN: Provide module signing public keys to the kernel")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/r/20260508033917.B5873C2BCB0@smtp.kernel.org/
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: stable@vger.kernel.org # v3.7+
Reviewed-by: Ignat Korchagin <ignat@linux.win>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
certs/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/certs/common.c b/certs/common.c
index 16a220887a53e8..c7bcf3f6a77e39 100644
--- a/certs/common.c
+++ b/certs/common.c
@@ -20,7 +20,7 @@ int load_certificate_list(const u8 cert_list[],
*/
if (end - p < 4)
goto dodgy_cert;
- if (p[0] != 0x30 &&
+ if (p[0] != 0x30 ||
p[1] != 0x82)
goto dodgy_cert;
plen = (p[2] << 8) | p[3];
--
2.53.0
prev parent reply other threads:[~2026-07-16 19:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 14:51 FAILED: patch "[PATCH] X.509: Fix validation of ASN.1 certificate header" failed to apply to 5.15-stable tree gregkh
2026-07-16 19:49 ` Sasha Levin [this message]
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=20260716194938.1111666-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=alistair.francis@wdc.com \
--cc=herbert@gondor.apana.org.au \
--cc=ignat@linux.win \
--cc=lukas@wunner.de \
--cc=sashiko-bot@kernel.org \
--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 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.