diff options
| author | Fabrice Derepas <fabrice.derepas@canonical.com> | 2026-08-15 16:00:19 +0200 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2026-09-04 19:49:33 +1000 |
| commit | 37d550172c2d3cdb3a5ace3e6cb0625967d86349 (patch) | |
| tree | 999bfe2f506760e22350c18c3e1479b65255f8ae /scripts/Makefile.thinlto | |
| parent | 4333ab90aaaea54f51af04025dc6f12f87e83f2d (diff) | |
| download | linux-next-37d550172c2d3cdb3a5ace3e6cb0625967d86349.tar.gz linux-next-37d550172c2d3cdb3a5ace3e6cb0625967d86349.zip | |
crypto: asymmetric_keys - fix OOB read in pefile_parse_binary
pefile_parse_binary() reads the size field of the certificate table's
data-directory entry, which sits at fixed index 4 of the PE optional
header's data directory:
ctx->certs_size = ddir->certs.size;
but nothing ensures index 4 is present. n_data_dirents (the untrusted
NumberOfRvaAndSizes) is only upper-bounded against header_size and may be
0, and header_size need only satisfy cursor < header_size < datalen. A
crafted PE with n_data_dirents = 0 and a tiny header_size therefore causes
the ddir->certs.size read to land past the end of the image (CWE-125). The
chkaddr() that bounds the certificate blob runs only after this read.
verify_pefile_signature() is reached from kexec_file_load() (the
lockdown/secure-boot enforced PE-image signature path), and the image is
parsed before its signature is checked. The trigger needs CAP_SYS_BOOT and
the access is out-of-bounds read only (no write).
Require the certificate table's data-directory entry (index 4) to be
present; the existing upper-bound check then keeps ddir->certs within
[cursor, header_size).
Fixes: 26d1164be37f ("pefile: Parse a PE binary to find a key and a signature contained therein")
Assisted-by: copilot-cli:claude-opus-4-6 frama-c
Signed-off-by: Fabrice Derepas <fabrice.derepas@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
