# CVE-2026-40253: openCryptoki: Memory safety vulnerabilities in BER/DER decoders in asn1.c

> Attackers can trigger out-of-bounds reads in openCryptoki via malformed BER-encoded objects, potentially causing crashes or information disclosure.

- **Severity:** Medium 6.8 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 16 Apr 2026
- **Updated:** 17 Apr 2026
- **Also known as:** ALSA-2026:26352, ALSA-2026:28231, ALSA-2026:28256, AZL-82982, CLSA-2026-1788955910, CLSA-2026-1790079559, DEBIAN-CVE-2026-40253, GHSA-c9cf-6vr4-wfxm, OESA-2026-2163, OESA-2026-2164, OESA-2026-2165, OESA-2026-2166, RHSA-2026:26352, RHSA-2026:28231, RHSA-2026:28256, RHSA-2026:33519, RHSA-2026:36697, RHSA-2026:36717, RLSA-2026:26352, RLSA-2026:28231, RLSA-2026:28256, SUSE-SU-2026:1658-1, SUSE-SU-2026:1723-1, SUSE-SU-2026:21492-1, SUSE-SU-2026:21575-1, SUSE-SU-2026:21593-1, SUSE-SU-2026:21637-1, SUSE-SU-2026:2355-1, SUSE-SU-2026:2685-1, SUSE-SU-2026:2685-2, SUSE-SU-2026:2757-1, UBUNTU-CVE-2026-40253, openSUSE-SU-2026:10593-1, openSUSE-SU-2026:20699-1

## What is CVE-2026-40253?

CVE-2026-40253 is a medium-severity memory corruption vulnerability in opencryptoki, published on 16 Apr 2026. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

openCryptoki is a PKCS#11 library and provides tooling for Linux and AIX. In versions 3.26.0 and below, the BER/DER decoding functions in the shared common library (asn1.c) accept a raw pointer but no buffer length parameter, and trust attacker-controlled BER length fields without validating them against actual buffer boundaries. All primitive decoders are affected: ber_decode_INTEGER, ber_decode_SEQUENCE, ber_decode_OCTET_STRING, ber_decode_BIT_STRING, and ber_decode_CHOICE. Additionally, ber_decode_INTEGER can produce integer underflows when the encoded length is zero. An attacker supplying a malformed BER-encoded cryptographic object through PKCS#11 operations such as C_CreateObject or C_UnwrapKey, token loading from disk, or remote backend communication can trigger out-of-bounds reads. This affects all token backends (Soft, ICA, CCA, TPM, EP11, ICSF) since the vulnerable code is in the shared common library. A patch is available thorugh commit ed378f463ef73364c89feb0fc923f4dc867332a3.

Weakness: CWE-125 (Out-of-bounds Read)

## Which versions are affected by CVE-2026-40253?

It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `opencryptoki` | AlmaLinux:10 | All versions | 3.26.0-3.el10_2.1 |
| `opencryptoki-ccatok` | AlmaLinux:10 | All versions | 3.26.0-3.el10_2.1 |
| `opencryptoki-devel` | AlmaLinux:10 | All versions | 3.26.0-3.el10_2.1 |
| `opencryptoki-ep11tok` | AlmaLinux:10 | All versions | 3.26.0-3.el10_2.1 |
| `opencryptoki-icatok` | AlmaLinux:10 | All versions | 3.26.0-3.el10_2.1 |
| `opencryptoki-icsftok` | AlmaLinux:10 | All versions | 3.26.0-3.el10_2.1 |
| `opencryptoki-libs` | AlmaLinux:10 | All versions | 3.26.0-3.el10_2.1 |
| `opencryptoki-swtok` | AlmaLinux:10 | All versions | 3.26.0-3.el10_2.1 |
| `opencryptoki` | AlmaLinux:8 | All versions | 3.22.0-3.el8_10.3 |
| `opencryptoki-ccatok` | AlmaLinux:8 | All versions | 3.22.0-3.el8_10.3 |
| `opencryptoki-devel` | AlmaLinux:8 | All versions | 3.22.0-3.el8_10.3 |
| `opencryptoki-ep11tok` | AlmaLinux:8 | All versions | 3.22.0-3.el8_10.3 |
| `opencryptoki-icatok` | AlmaLinux:8 | All versions | 3.22.0-3.el8_10.3 |
| `opencryptoki-icsftok` | AlmaLinux:8 | All versions | 3.22.0-3.el8_10.3 |
| `opencryptoki-libs` | AlmaLinux:8 | All versions | 3.22.0-3.el8_10.3 |
| `opencryptoki-swtok` | AlmaLinux:8 | All versions | 3.22.0-3.el8_10.3 |
| `opencryptoki-tpmtok` | AlmaLinux:8 | All versions | 3.22.0-3.el8_10.3 |
| `opencryptoki` | AlmaLinux:9 | All versions | 3.26.0-2.el9_8.2 |
| `opencryptoki-ccatok` | AlmaLinux:9 | All versions | 3.26.0-2.el9_8.2 |
| `opencryptoki-devel` | AlmaLinux:9 | All versions | 3.26.0-2.el9_8.2 |
| `opencryptoki-ep11tok` | AlmaLinux:9 | All versions | 3.26.0-2.el9_8.2 |
| `opencryptoki-icatok` | AlmaLinux:9 | All versions | 3.26.0-2.el9_8.2 |
| `opencryptoki-icsftok` | AlmaLinux:9 | All versions | 3.26.0-2.el9_8.2 |
| `opencryptoki-libs` | AlmaLinux:9 | All versions | 3.26.0-2.el9_8.2 |
| `opencryptoki-swtok` | AlmaLinux:9 | All versions | 3.26.0-2.el9_8.2 |
| `opencryptoki` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-ccatok` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-ccatok-debuginfo` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-debuginfo` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-debugsource` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-devel` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-ep11tok` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-ep11tok-debuginfo` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-icatok` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-icatok-debuginfo` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-icsftok` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-icsftok-debuginfo` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-libs` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-libs-debuginfo` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |
| `opencryptoki-swtok` | Red Hat:enterprise_linux:10.2 | All versions | 0:3.26.0-3.el10_2.1 |

Products: Opencryptoki Project Opencryptoki.

## How do I fix CVE-2026-40253?

Apply the vendor's patch.

## Is CVE-2026-40253 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-40253 exists.

## Other vulnerabilities in opencryptoki

- [CVE-2026-23893](https://insights.sbomify.com/CVE-2026-23893/): openCryptoki has improper link resolution before file access (link following) (medium 6.8)
- [CVE-2026-22791](https://insights.sbomify.com/CVE-2026-22791/): openCryptoki incorrectly calculates the buffer size in C_WrapKey with CKM_ECDH_AES_KEY_WRAP (medium 6.6)
- [CVE-2012-4455](https://insights.sbomify.com/CVE-2012-4455/): Path traversal in n/a (medium 6.2)
- [CVE-2024-0914](https://insights.sbomify.com/CVE-2024-0914/): Opencryptoki: timing side-channel in handling of rsa pkcs#1 v1.5 padded ciphertexts (marvin) (medium 5.9)
- [CVE-2021-3798](https://insights.sbomify.com/CVE-2021-3798/): Information disclosure in opencryptoki (medium 5.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-40253 and fix it if it is affected.

What it is: CVE-2026-40253 is a medium-severity memory corruption vulnerability in opencryptoki, published on 16 Apr 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-40253 exists.

Affected product: opencryptoki. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-40253/ (Markdown: https://insights.sbomify.com/CVE-2026-40253/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-40253
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-40253
- OSV: https://osv.dev/vulnerability/CVE-2026-40253

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-40253/
Summaries are generated and may contain mistakes; the official description above is the record.
