---
id: CVE-2026-85670
title: >-
  tokenizers (Hugging Face) is affected by an out-of-bounds buffer access in
  BpeBuilder::build (tokenizers/src/models/bpe/model.rs)
summary: >-
  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…
severity: medium
cvss: 6.5
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H'
cwe:
  - CWE-787
published: '2026-09-04'
updated: '2026-09-24'
sourceUpdated: '2026-09-24T20:28:01.780'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-85670'
references:
  - url: 'https://github.com/huggingface/tokenizers'
    label: disclosure@vulncheck.com
  - url: >-
      https://github.com/huggingface/tokenizers/blob/v0.23.2/tokenizers/src/models/bpe/model.rs
    label: disclosure@vulncheck.com
  - url: 'https://github.com/huggingface/tokenizers/issues/2094'
    label: disclosure@vulncheck.com
  - url: >-
      https://www.vulncheck.com/advisories/tokenizers-bpebuilder-buffer-overflow-via-merge-token
    label: disclosure@vulncheck.com
  - url: 'https://github.com/huggingface/tokenizers/issues/2094'
    label: 134c704f-9b21-4f2e-91b3-4a467353bcc0
tags:
  - nvd
epss: 0.00467
epssPercentile: 0.37742
ingestedAt: '2026-09-24T20:51:40.243Z'
---

## Overview

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.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
