# CVE-2026-85670: tokenizers BpeBuilder Buffer Overflow via merge token

> Attackers can cause denial of service or potential code execution by supplying a crafted tokenizer.json file to the Hugging Face tokenizers library.

- **Severity:** High 7.1 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 4 Sep 2026
- **Updated:** 4 Sep 2026
- **Also known as:** GHSA-jrf5-f6jp-7vxc, RHLW-2026-b11abda52745af4c

## What is CVE-2026-85670?

CVE-2026-85670 is a high-severity memory corruption vulnerability in huggingface tokenizers, published on 4 Sep 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

tokenizers (Hugging Face) is affected by an out-of-bounds buffer access in BpeBuilder::build (tokenizers/src/models/bpe/model.rs). When loading a tokenizer.json via Tokenizer::from_file/from_str, the builder sizes a scratch buffer to the longest vocabulary key, then writes each concatenated merge rule into it. A merge whose concatenated token exceeds the longest vocabulary key overruns the buffer, which Rust turns into a panic that aborts the process in Rust and FFI embeddings. This occurs at load time with no encoding required, so an attacker who supplies a crafted tokenizer.json can cause a denial of service. A secondary defect at the same location can cause a usize underflow (panic in debug, potential memory corruption in release) when continuing_subword_prefix is set and a merge token is shorter than the prefix. Observed in version 0.23.1.

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

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


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

Upgrade to a fixed version.

## Is CVE-2026-85670 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2026-85670 is a high-severity memory corruption vulnerability in huggingface tokenizers, published on 4 Sep 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-85670 exists.

Affected product: huggingface tokenizers. 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-85670/ (Markdown: https://insights.sbomify.com/CVE-2026-85670/index.md)
```

## Sources

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

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