CVE-2024-12720: Transformers: ReDoS in Nougat tokenizer causes DoS
GHSA-6rvg-6v2m-4j46 HIGH CISA: TRACK*Any inference endpoint running HuggingFace Transformers < 4.48.0 with the Nougat tokenizer is network-exploitable by an unauthenticated attacker sending crafted input—no privileges needed. Patch to 4.48.0 immediately; if you can't, rate-limit or disable Nougat endpoints now. Low EPSS (0.14%) suggests no active exploitation yet, but this is trivial to weaponize once discovered.
Risk Assessment
CVSS 7.5 High with AV:N/AC:L/PR:N/UI:N means zero-barrier remote exploitation. Practical risk is elevated because Transformers is installed in virtually every ML environment—the blast radius is wide. EPSS 0.00137 indicates no current in-the-wild use, but the simplicity of the attack (craft a string, POST to endpoint) makes exploitation trivial once a PoC circulates. Containment window is narrow.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| transformers | pip | — | No patch |
| transformers | pip | < 4.48.0 | 4.48.0 |
Severity & Risk
Attack Surface
Recommended Action
5 steps-
PATCH
Upgrade transformers to >= 4.48.0 (commit deac971c fixes the regex).
-
DETECT
Monitor for CPU spikes on tokenization workers; alert on >80% sustained CPU from inference processes.
-
WORKAROUND (if patching is blocked): Add input length caps (e.g., 10K chars) and character-class filtering upstream of the Nougat tokenizer.
-
ISOLATE
Run Nougat endpoints in dedicated containers with CPU limits (e.g., Kubernetes resource quotas) to prevent neighbor starvation.
-
INVENTORY
Audit all pip environments for transformers < 4.48.0 using
pip show transformers.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2024-12720?
Any inference endpoint running HuggingFace Transformers < 4.48.0 with the Nougat tokenizer is network-exploitable by an unauthenticated attacker sending crafted input—no privileges needed. Patch to 4.48.0 immediately; if you can't, rate-limit or disable Nougat endpoints now. Low EPSS (0.14%) suggests no active exploitation yet, but this is trivial to weaponize once discovered.
Is CVE-2024-12720 actively exploited?
No confirmed active exploitation of CVE-2024-12720 has been reported, but organizations should still patch proactively.
How to fix CVE-2024-12720?
1. PATCH: Upgrade transformers to >= 4.48.0 (commit deac971c fixes the regex). 2. DETECT: Monitor for CPU spikes on tokenization workers; alert on >80% sustained CPU from inference processes. 3. WORKAROUND (if patching is blocked): Add input length caps (e.g., 10K chars) and character-class filtering upstream of the Nougat tokenizer. 4. ISOLATE: Run Nougat endpoints in dedicated containers with CPU limits (e.g., Kubernetes resource quotas) to prevent neighbor starvation. 5. INVENTORY: Audit all pip environments for transformers < 4.48.0 using `pip show transformers`.
What systems are affected by CVE-2024-12720?
This vulnerability affects the following AI/ML architecture patterns: document processing pipelines, model serving, OCR and document understanding systems, multi-modal inference APIs.
What is the CVSS score for CVE-2024-12720?
CVE-2024-12720 has a CVSS v3.1 base score of 7.5 (HIGH). The EPSS exploitation probability is 0.23%.
Technical Details
NVD Description
A Regular Expression Denial of Service (ReDoS) vulnerability was identified in the huggingface/transformers library, specifically in the file tokenization_nougat_fast.py. The vulnerability occurs in the post_process_single() function, where a regular expression processes specially crafted input. The issue stems from the regex exhibiting exponential time complexity under certain conditions, leading to excessive backtracking. This can result in significantly high CPU usage and potential application downtime, effectively creating a Denial of Service (DoS) scenario. The affected version is v4.46.3 (latest).
Exploitation Scenario
An attacker targeting a document-intelligence API (common in legal, finance, healthcare AI stacks) sends a POST request with a specially crafted string containing nested repeating patterns that exploit the catastrophic backtracking in the Nougat tokenizer's post-processing regex. Each request pins one CPU core indefinitely. With 4-8 concurrent requests, a standard 4-vCPU inference pod is fully saturated. The service becomes unavailable within seconds, and Kubernetes liveness probes restart the pod—only for the attacker to repeat the cycle. No account, no token, no prior access required.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H References
Timeline
Related Vulnerabilities
CVE-2024-3568 9.6 HuggingFace Transformers: RCE via pickle deserialization
Same package: transformers CVE-2023-6730 8.8 HuggingFace Transformers: RCE via unsafe deserialization
Same package: transformers CVE-2024-11392 8.8 HuggingFace Transformers: RCE via config deserialization
Same package: transformers CVE-2024-11393 8.8 Transformers: RCE via MaskFormer model deserialization
Same package: transformers CVE-2024-11394 8.8 Transformers: RCE via Trax model deserialization
Same package: transformers
AI Threat Alert