Not yet analysed by NVD. Matched on the vendor's record; this may change when NVD has analysed it.
Reach libopenssl · 4 builds in 2 of 4 releases
full reviewcross-check✓ a member decided
Description · NVD
Issue summary: When an application passes a stack to PEM_X509_INFO_read_bio_ex() to add entries to, and reading fails, OpenSSL frees every entry in the stack, both the old ones and any new ones, but leaves them in the stack.
Impact summary: An application that passes an existing stack to PEM_X509_INFO_read_bio_ex() and keeps using it after a failed read may use memory that was already freed. This can cause a crash or, in principle, memory corruption. Malformed PEM data can make the read fail, but only applications that pass an existing stack are affected, and OpenSSL itself does not do this.
CWE: CWE-416: Use After Free
Description: PEM_X509_INFO_read_bio_ex() reads certificates, CRLs and private keys from PEM data and adds them to a stack of X509_INFO structures. If the application passes a stack that is not NULL, the function adds the new entries to it and must leave the entries that are already there unchanged.
If reading fails, the function frees every entry in the stack. This includes the entries that were there before the call, and the entries added by the call. It does not remove these entries from the stack, so the stack keeps pointers to freed memory. The failure can happen at any point, even before any entry was added. A PEM item with invalid content is enough. This also happens if the stack was empty: entries added before the failure are freed but stay in the stack.
An application that then reads or frees the stack will use memory that was already freed. This can crash the application or, in principle, corrupt memory.
Only applications that pass a stack that is not NULL are affected. OpenSSL itself never does this. Its own callers, including the code that TLS uses to load CA certificates, always pass NULL. When the stack is NULL, the function frees only the entries that it created itself, which is safe. We expect that very few applications pass an existing stack. An attacker can make the read fail with malformed PEM data, but cannot make an application pass an existing stack.
The same problem affects PEM_X509_INFO_read_bio(), PEM_X509_INFO_read() and PEM_X509_INFO_read_ex(), which use the same code. OpenSSL 1.1.1 and 1.0.2 have only the first two of these functions.
FIPS impact: no The affected code is outside the FIPS module boundary.
Published 2026-11-17NVD
CVSS 3.1Local · no privileges · no user interaction
How it is reached
- Attack vector
- Local
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
What it costs
- Confidentiality
- High
- Integrity
- None
- Availability
- High
- Scope
- Unchanged
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
The vulnerable error path is present unpatched in this build's libcrypto: on failure PEM_X509_INFO_read_bio_ex() frees every entry of the stack, including a caller-supplied one, without removing them. The package is selected for the target and crypto/pem/pem_info.c is in the libcrypto source list.
The bug only triggers when a caller passes a non-NULL stack. Every caller I found in the unpacked sources under output/build and in Infix's own src, package, patches and board directories passes NULL: OpenSSL's CA-file loader, openssl rehash, openssl crl2pkcs7, the TS config code, libcurl, hostapd and wpa_supplicant. The function itself does run on shipped devices (e.g. CA loading for TLS), but only via the safe NULL path.
Reaching the vulnerable path would need a program outside the product, such as custom code run from a root shell or a third-party container, that links libcrypto and passes an existing stack. No YANG node, CLI command or web UI setting changes which argument the shipped callers pass, and there is no network path to it.
Evidence 12
Unfixed error path: when `!ok`, loops over `ret` calling `X509_INFO_free()` on every entry, and only frees the stack itself if `ret != sk`; a caller-supplied `sk` keeps dangling pointers.
output/build/libopenssl-3.5.8/crypto/pem/pem_info.c:199-209
`ret = sk` when the caller passes a non-NULL stack, so pre-existing entries are the ones freed.
output/build/libopenssl-3.5.8/crypto/pem/pem_info.c:68-74
Source is OpenSSL 3.5.8, release date 25 Aug 2026, which predates the 2026-11-17 advisory.
output/build/libopenssl-3.5.8/VERSION.dat:1-6
Only the four Buildroot patches (reproducible build, ppc64 ELFv2, revert static, serialize install) are applied; none touches `pem_info.c`.
output/build/libopenssl-3.5.8/.applied_patches_list
`BR2_PACKAGE_LIBOPENSSL=y`; the package is selected for the target (also `configs/aarch64_minimal_defconfig:55` sets `BR2_PACKAGE_LIBOPENSSL_BIN=y`).
output/.config:2153
`pem_info.c` is in the libcrypto source list; dependency files `libcrypto-shlib-pem_info.d` and `libcrypto-lib-pem_info.d` exist in `crypto/pem/`, and `output/build/packages-file-list.txt:19440` shows `libcrypto.so.3` installed to the target.
output/build/libopenssl-3.5.8/crypto/pem/build.info:3
OpenSSL's CA-file loader calls `PEM_X509_INFO_read_bio_ex(in, NULL, ...)`, the safe NULL-stack path.
output/build/libopenssl-3.5.8/crypto/x509/by_file.c:251
`openssl rehash` passes `NULL`; `apps/crl2pkcs7.c:215` and `crypto/ts/ts_conf.c:83` do the same.
output/build/libopenssl-3.5.8/apps/rehash.c:263
`libcurl` (OpenSSL backend, `output/.config:2627`) calls `PEM_X509_INFO_read_bio(cbio, NULL, NULL, NULL)`.
output/build/libcurl-8.22.0/lib/vtls/openssl.c:2751
`hostapd` passes a `NULL` stack.
output/build/hostapd-2.12/src/crypto/tls_openssl.c:160
`wpa_supplicant` passes a `NULL` stack.
output/build/wpa_supplicant-2.12/src/crypto/tls_openssl.c:160
Outside the OpenSSL sources and the EDK2 copy bundled in `host-qemu`, the only hits are `libcurl`, `hostapd`, `wpa_supplicant`, a `libcurl` docs example and a header vendored in `host-ccache`; nothing in Infix's own code.
rg -uu -l PEM_X509_INFO_read output/build src package patches board
Version and patches
The tree is OpenSSL 3.5.8 (VERSION.dat, released 25 Aug 2026) and the code in crypto/pem/pem_info.c matches the vulnerable behaviour described in the advisory, so the NVD match is correct. CHANGES.md has no entry for this CVE and none of the four applied Buildroot patches touches the function. I could not read the upstream advisory or fix commits (no network access), so the exact affected range and the fixed 3.5.x version are not confirmed from here; it will be a release after 3.5.8.
Recommendation
No urgent backport is needed. Document as not exposed: the vulnerable code is present, but no shipped caller passes an existing stack.
Pick up the fix with the next routine libopenssl bump to the 3.5.x release that contains it; confirm the version from the upstream advisory.
The same applies to host-libopenssl-3.5.8, which is a build-time tool only and whose own callers also pass NULL.
Open questions
The caller search covers C/C++ source unpacked under output/build plus Infix's own directories. It would not catch a caller in a prebuilt binary or in a language binding that reaches these functions without naming them in source; I found no sign of either, but did not check every package for one.
I did not confirm the fixed version or affected range against the upstream advisory.
Two of my shell commands were refused by the sandbox (one used cd into output/build, one included a sed invocation that I should not have issued). Nothing ran from them, and I repeated the searches with permitted commands, except a targeted grep of OpenSSL's ssl/, crypto/store/, providers/ and engines/ directories; the tree-wide rg listing covers those directories and shows no callers there.
Members of Kernel Kit decide. Sign in if you are one.