CVE-2025-1194: Transformers Regular Expression Denial of Service (ReDoS) vulnerability
The GPT-NeoX-Japanese tokenizer in Hugging Face Transformers has a regex with exponential complexity in `SubWordJapaneseTokenizer`. Crafted text makes it backtrack and pin the CPU. Versions before 4.50.0 are affected. Fixed in 4.50.0.
Published Apr 29, 2025 · Updated Aug 4, 2025 · Analysis Nov 1, 2026
What an attacker can do
tokenization_gpt_neox_japanese.py defines SubWordJapaneseTokenizer. It runs regular expressions over the text you tokenize. One of them shows exponential complexity on specially crafted input, so the matcher backtracks for a very long time. The advisory describes high CPU use and possible application downtime.
The attacker needs to get crafted text into a tokenizer call. That is realistic for a service that tokenizes user text with a GPT-NeoX-Japanese model: a chat or inference endpoint, or a data pipeline. The CVSS 3.1 vector lists network access, no privileges, user interaction required, and low availability impact only. Expect a stalled worker thread or process, which hurts most when the tokenizer runs in the request path of a service with few workers. The advisory describes no code execution or data exposure.
Who is affected
Affected: transformers before 4.50.0. The report was made against v4.48.1. Check:
pip show transformersThe vulnerable code only runs when you use the GPT-NeoX-Japanese tokenizer on text from untrusted sources.
transformers
- Ecosystem
- PyPI
- Affected
- < 4.50.0
- Fixed in
- 4.50.0
- Check
pip show transformers
How to fix it
Upgrade to 4.50.0:
pip install --upgrade transformers==4.50.0The fix is in the commit linked from the advisory. It lists no workaround. Until you upgrade, avoid sending untrusted text through the GPT-NeoX-Japanese tokenizer, or cap the input length and run tokenization with a timeout.
How to tell if you were hit
Look for Python workers stuck at full CPU with a stack trace in tokenization_gpt_neox_japanese.py. A py-spy dump of a hung process shows it. Check the request logs for unusually long inputs just before the stall. The advisory lists no log signature.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
A Regular Expression Denial of Service (ReDoS) vulnerability was identified in the huggingface/transformers library, specifically in the file tokenization_gpt_neox_japanese.py of the GPT-NeoX-Japanese model. The vulnerability occurs in the SubWordJapaneseTokenizer class, where regular expressions process specially crafted inputs. The issue stems from a regex exhibiting exponential complexity under certain conditions, leading to excessive backtracking. This can result in high CPU usage and potential application downtime, effectively creating a Denial of Service (DoS) scenario. The affected version is v4.48.1 (latest).
Questions
- Does CVE-2025-1194 affect all Transformers tokenizers?
No. The advisory names
SubWordJapaneseTokenizerintokenization_gpt_neox_japanese.py, used by the GPT-NeoX-Japanese model. Other tokenizers are not named.- Which version fixes it?
4.50.0. The advisory data lists everything below 4.50.0 as affected.
- How severe is it?
Medium, with a CVSS 3.1 score of 4.3 and low availability impact only. It needs a victim-side action per the vector, and it is not in the CISA KEV catalog.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Transformers vulnerabilities
All Transformers entriesCVE-2026-80047
Hugging Face Transformers downloads custom generation code before trust consent
high7.8No fixSep 1, 2026CVE-2026-9856
Transformers save_pretrained path traversal allows arbitrary file writes through chat template names
high7.1Aug 2, 2026CVE-2026-5241
huggingface/transformers: Arbitrary Code Execution During Model Initialization in the LightGlue Model Loading Path
high8.0Jun 3, 2026CVE-2026-4372
HuggingFace transformers vulnerable to remote code execution
high7.8May 26, 2026CVE-2026-1839
HuggingFace Transformers allows for arbitrary code execution in the `Trainer` class
medium6.5Apr 7, 2026CVE-2025-6921
Hugging Face Transformers vulnerable to Regular Expression Denial of Service (ReDoS) in the AdamWeightDecay optimizer
medium5.3Sep 23, 2025
