CVE-2026-31430: X.509: Fix out-of-bounds access when parsing extensions
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
X.509: Fix out-of-bounds access when parsing extensions
Leo reports an out-of-bounds access when parsing a certificate with empty Basic Constraints or Key Usage extension because the first byte of the extension is read before checking its length. Fix it.
The bug can be triggered by an unprivileged user by submitting a specially crafted certificate to the kernel through the keyrings(7) API. Leo has demonstrated this with a proof-of-concept program responsibly disclosed off-list.
The Linux kernel CVE team has assigned CVE-2026-31430 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.4 with commit 30eae2b037af54b24109dcaea21db46f6285c69b and fixed in 6.6.135 with commit 672b526def1f94c1be8eb11b885b803da0d8c2f1 Issue introduced in 6.4 with commit 30eae2b037af54b24109dcaea21db46f6285c69b and fixed in 6.12.82 with commit 30ab358fad0c7daa1d282ec48089901b21b36a20 Issue introduced in 6.4 with commit 30eae2b037af54b24109dcaea21db46f6285c69b and fixed in 6.18.23 with commit 206121294b9cf27f0589857f80d64f87e496ffb2 Issue introduced in 6.4 with commit 30eae2b037af54b24109dcaea21db46f6285c69b and fixed in 6.19.13 with commit 7fb4dadc2734f4020d7543d688b8d49c8e569c61 Issue introduced in 6.4 with commit 30eae2b037af54b24109dcaea21db46f6285c69b and fixed in 7.0 with commit d702c3408213bb12bd570bb97204d8340d141c51
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2026-31430
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
crypto/asymmetric_keys/x509_cert_parser.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/672b526def1f94c1be8eb11b885b803da0d8c2f1 https://git.kernel.org/stable/c/30ab358fad0c7daa1d282ec48089901b21b36a20 https://git.kernel.org/stable/c/206121294b9cf27f0589857f80d64f87e496ffb2 https://git.kernel.org/stable/c/7fb4dadc2734f4020d7543d688b8d49c8e569c61 https://git.kernel.org/stable/c/d702c3408213bb12bd570bb97204d8340d141c51