{"id":"CVE-2026-85670","summary":"tokenizers BpeBuilder Buffer Overflow via merge token","details":"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.","modified":"2026-09-06T03:47:20.256899663Z","published":"2026-09-04T14:32:25.391Z","database_specific":{"cwe_ids":["CWE-787"],"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/85xxx/CVE-2026-85670.json","cna_assigner":"VulnCheck"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/85xxx/CVE-2026-85670.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-85670"},{"type":"ADVISORY","url":"https://www.vulncheck.com/advisories/tokenizers-bpebuilder-buffer-overflow-via-merge-token"},{"type":"REPORT","url":"https://github.com/huggingface/tokenizers/issues/2094"},{"type":"PACKAGE","url":"https://github.com/huggingface/tokenizers"},{"type":"ARTICLE","url":"https://github.com/huggingface/tokenizers/blob/v0.23.2/tokenizers/src/models/bpe/model.rs"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/huggingface/tokenizers","events":[{"introduced":"0"},{"last_affected":"88a4498ad4ea1a9487b0a9b0ff881383fd5a06a3"}],"database_specific":{"extracted_events":[{"introduced":"0"},{"last_affected":"0.23.2"}],"source":"AFFECTED_FIELD"}}],"versions":["v0.23.2","v0.23.2rc0","v0.21.3","v0.15.1rc0","v0.15.1.rc0","v0.13.4.rc2","v0.13.4.rc1","v0.13.4-rc2","v0.13.4-rc1","v0.13.3","python-v0.13.3","node-v0.13.3","python-v0.13.3rc1","v0.13.2","python-v0.13.2","node-v0.13.2","python-v0.13.0","v0.13.0","node-v0.13.0","python-v0.12.1","node-v0.12.0","v0.12.0","python-v0.12.0","v0.11.2","node-v0.8.3","python-v0.11.6","python-v0.11.5","python-v0.11.4","node-v0.8.2","python-v0.11.3","v0.11.1","node-v0.8.1","python-v0.11.2","python-v0.11.1","python-v0.11.0","node-v0.8.0","python-v0.10.3","python-v0.10.2","python-v0.10.1","python-v0.10.1rc1","python-v0.10.0","python-v0.10.0rc1","python-v0.9.4","python-v0.9.3","python-v0.9.2","python-v0.9.1","python-v0.9.0","python-v0.9.0.rc2","python-v0.9.0.rc1","python-v0.9.0.dev4","python-v0.9.0.dev0","python-v0.8.1","python-v0.8.1.rc2","python-v0.8.1.rc1","node-v0.7.0","python-v0.8.0","python-v0.8.0-transformers","python-v0.8.0-rc3","python-v0.8.0-rc2","python-v0.8.0-rc1","python-v0.8.0-dev2","python-v0.8.0-dev1","python-v0.8.0-dev","python-v0.7.0","python-v0.7.0-rc7","python-v0.7.0-rc6","node-v0.6.2","python-v0.7.0-rc5","rust-v0.10.1","python-v0.7.0-rc4","rust-v0.10.0","node-v0.6.1","python-v0.7.0-rc3","node-v0.6.0","python-v0.7.0-rc2","python-v0.7.0-rc1","rust-v0.9.0","python-v0.6.0","rust-v0.8.0","node-v0.5.0","python-v0.5.2","python-v0.5.1","python-v0.5.0","node-v0.4.1","python-v0.4.2","python-v0.4.1","python-v0.4.0","node-v0.4.0","python-v0.3.0","node-v0.3.1","node-v0.3.0","python-v0.2.1","python-v0.2.0","node-v0.2.4","node-v0.2.3","v0.1.1","v0.1.0","v0.0.13","v0.0.12","v0.0.11","v0.0.10","v0.0.9","v0.0.8","v0.0.7","v0.0.6","v0.0.5","v0.0.4","v0.0.3"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-85670.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V4","score":"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"}]}