ZeroHour

CVE-2026-85670

mass

Out-of-Bounds Buffer Access in Hugging Face tokenizers BPE Loader Enables DoS

CVSS 4.0
7.1 high
EPSS
<1%p24
Published
()
Modified
AI analysis

Hugging Face's tokenizers library contains an out-of-bounds buffer access (CWE-787) in BpeBuilder::build (tokenizers/src/models/bpe/model.rs): when constructing a BPE model, the builder sizes a scratch buffer to the longest vocabulary key and then writes each concatenated merge rule into it, so any merge whose concatenated tokens exceed that length overruns the buffer. The flaw triggers purely at load time — calling Tokenizer::from_file or Tokenizer::from_str on a crafted tokenizer.json panics without any encoding request — so an attacker who can supply a tokenizer file (user upload, downloaded model config, API input) can abort the host process. A secondary defect in the same code path causes a usize underflow when continuing_subword_prefix is set and a merge token is shorter than the prefix, yielding a panic in debug builds and potential memory corruption in release builds. The impact is denial of service (process abort in Rust and FFI embeddings such as the Python wheels), affecting applications and services that load tokenizer.json from untrusted or attacker-controlled sources; version 0.23.1 is confirmed affected and no fixed version is identified in the available data. There are no known public exploits, PoCs, or CISA KEV entries, and EPSS estimates only a 0.3% probability of exploitation within 30 days.

What to do: Upgrade the tokenizers crate and any FFI/Python wheels to a release that fixes CVE-2026-85670 once upstream publishes the patched version (0.23.1 is confirmed vulnerable). Until patched, only load tokenizer.json from trusted sources; if you must load user-supplied tokenizers, isolate or catch the abort (e.g., catch_unwind or subprocess isolation) and avoid setting continuing_subword_prefix with untrusted merges. Audit whether your service accepts tokenizer files or model configs from untrusted users, as that determines whether this flaw is remotely triggerable for you.

Affected
Hugging Face tokenizers (Rust library, including FFI/Python embeddings)0.23.1 confirmed affected; broader affected version range and fixed release not specified in available data
Estimated exposure
massmillions to tens of millions of downstream deployments/users (core tokenizer engine of the Hugging Face Transformers ecosystem), though realistic attacker… — tokenizers is the default tokenizer runtime shipped with Hugging Face Transformers and many ML stacks, with hundreds of millions of cumulative PyPI/crates.io downloads, but the flaw is only reachable where tokenizer.json files are loaded…

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

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
Vector
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

In the news

No ingested article mentions this CVE yet.