Transformers is vulnerable to ReDoS attack through its DonutProcessor class
Medium5.3CVE-2025-3933 · Published Jul 11, 2025 · updated Sep 10, 2026
A Regular Expression Denial of Service (ReDoS) vulnerability was discovered in the Hugging Face Transformers library, specifically within the DonutProcessor class's `token2json()` method. This vulnerability affects versions 4.51.3 and earlier, and is fixed in version 4.52.1. The issue arises from the regex pattern `<s_(.*?)>` which can be exploited to cause excessive CPU consumption through crafted input strings due to catastrophic backtracking. This vulnerability can lead to service disruption, resource exhaustion, and potential API service vulnerabilities, impacting document processing tasks using the Donut model.
Affected versions
| Package | Affected | Fixed in |
|---|---|---|
| transformers PyPI | < 4.52.1 | 4.52.1 |
Details and references
- CVSS 3.1
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- Severity from
- GitHub (reviewed advisory)
- Weakness
- CWE-1333
- Also known as
- CVE-2025-3933, PYSEC-2026-1977
More Transformers advisories
All Transformers| Date | Advisory | Severity | Fixed in |
|---|---|---|---|
| Aug 62025 | Hugging Face Transformers Regular Expression Denial of Service (ReDoS) vulnerability | Medium5.3 | 4.53.0 |
| Jul 72025 | Transformers vulnerable to ReDoS attack through its SETTING_RE variable | Medium5.3 | 4.51.0 |
| Jul 72025 | Transformers vulnerable to ReDoS attack through its get_imports() function | Medium5.3 | 4.51.0 |
| Jul 72025 | Transformers's Improper Input Validation vulnerability can be exploited through username injection | Low3.5 | 4.52.1 |
| Jul 72025 | Transformers's ReDoS vulnerability in get_configuration_file can lead to catastrophic backtracking | Medium5.3 | 4.51.0 |
| May 192025 | Hugging Face Transformers Regular Expression Denial of Service | Medium5.3 | 4.50.0 |