# CVE-2026-120667: Heap Buffer Overflow When Re-Encoding Cached ASN.1 Items Above INT_MAX

> Attackers supplying oversized crafted DER CRLs, certificates or CSRs can trigger a heap overflow crashing applications that parse untrusted DER from buffers over 4 GiB.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Harmful if only installed:** No
- **Needs a specific call:** Yes (`ASN1_item_i2d`, `ossl_asn1_enc_restore`, `d2i_X509_CRL`)
- **Fix available:** Yes
- **Published:** 1 Dec 2026
- **Updated:** 1 Dec 2026
- **Also known as:** DEBIAN-CVE-2026-120667, GHSA-6qvh-54gx-q3g6, UBUNTU-CVE-2026-120667

## What is CVE-2026-120667?

CVE-2026-120667 is a high-severity memory corruption vulnerability in OpenSSL, published on 1 Dec 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Issue summary: An application that parses a maliciously crafted DER CRL,
certificate or CSR from a buffer larger than 4 GiB may trigger a heap buffer
overflow when OpenSSL re-encodes the item's cached encoding.

Impact summary: An attacker who supplies a crafted CRL, certificate or CSR to
an application that parses untrusted DER from a buffer larger than 4 GiB
causes a heap out-of-bounds write of attacker-controlled data, crashing the
process: Denial of Service.

CWE: CWE-787: Out-of-bounds Write

Description: ASN1_item_i2d() encodes an item in two passes, sizing the buffer
first and writing it second. For an item with a cached DER encoding,
ossl_asn1_enc_restore() reports that length through an int while copying the
full long. A cached encoding longer than INT_MAX is reported truncated, so the
caller allocates a small buffer and the second pass copies the whole span into
it.

The cache is kept for the signed parts of CRLs, certificates and CSRs. Parsing
a CRL reaches it: d2i_X509_CRL() fingerprints the CRL and re-encodes that
part, and a CRL inside PKCS#7 or CMS triggers it when the container is parsed.
Certificates reach it at the first X509_verify() or extension-cache
fingerprint, CSRs at X509_REQ_verify(). The attacker must supply a DER object
whose signed part spans more than 2^32 bytes from a buffer of at least 4 GiB,
on a platform with a 64-bit long. TLS, the HTTP CRL fetch, the BIO, PEM,
decoder and store readers cap input below 4 GiB.

The oversized copy runs off the end of the heap mapping and the process dies.
Nothing is read out of bounds or returned to the attacker, and the fixed
overrun size leaves no partial overwrite to steer.

FIPS impact: no
The affected code is outside the FIPS module boundary.

Weakness: CWE-787 (Out-of-bounds Write)

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

An affected version is only exploitable if your software calls ASN1_item_i2d, ossl_asn1_enc_restore or d2i_X509_CRL. Many projects that include it are not exposed.


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

No fix published yet.

## Is CVE-2026-120667 being exploited?

There is no known exploitation of CVE-2026-120667 in the wild and no public exploit code.

## Fix prompt for AI coding agents

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

What it is: CVE-2026-120667 is a high-severity memory corruption vulnerability in OpenSSL, published on 1 Dec 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-120667 in the wild and no public exploit code.
Exposure: An affected version is only exploitable if your software calls ASN1_item_i2d, ossl_asn1_enc_restore or d2i_X509_CRL. Many projects that include it are not exposed.

Affected product: OpenSSL. 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.
   If an affected version is present, also search the code for calls to ASN1_item_i2d, ossl_asn1_enc_restore or d2i_X509_CRL and report whether any exist.
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-120667/ (Markdown: https://insights.sbomify.com/CVE-2026-120667/index.md)
```

## Sources

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

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