Hugging Face Transformers, ReDoS, CVE-2025-XXXX (Moderate)

Listen to this Post

The CVE-2025-XXXX vulnerability in Hugging Face Transformers stems from inefficient regex handling in the `DonutProcessor` class. The `token2json()` method uses the pattern <s_(.?)>, which is susceptible to catastrophic backtracking when processing maliciously crafted input strings. An attacker can exploit this by supplying a string with nested or unbalanced tags, causing exponential time complexity in regex evaluation. This leads to excessive CPU consumption, resulting in a Denial-of-Service (DoS) condition. The flaw affects versions ≤4.51.3, allowing disruption of document processing tasks relying on the Donut model.

DailyCVE Form:

Platform: Hugging Face Transformers
Version: ≤4.51.3
Vulnerability: ReDoS via `token2json()`
Severity: Moderate
Date: Jul 11, 2025

Prediction: Patch expected by Jul 25, 2025

What Undercode Say:

Check installed version:
pip show transformers
Exploit PoC (malicious input):
curl -X POST --data "<s_<<<<<...>>>>>>" http://victim-api/process
Mitigation (upgrade):
pip install transformers>=4.52.1

How Exploit:

  • Crafted input with nested `` tags triggers regex backtracking.
  • Causes CPU spike, degrading service performance.
  • Exploitable via API endpoints using DonutProcessor.

Protection from this CVE:

  • Upgrade to Transformers ≥4.52.1.
  • Implement regex timeout mechanisms.
  • Sanitize input before processing.

Impact:

  • Service disruption due to CPU exhaustion.
  • Affects document parsing workflows.
  • Potential API downtime.

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top