# CVE-2025-3933: PYSEC-2026-1977 - Transformers is vulnerable to ReDoS attack through its DonutProcessor class

Source: https://junglewise.ai/threats/cve-2025-3933-hugging-face-transformers-redos-in-donutprocessor  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-07. Updated: 2026-09-26  
License: CC BY 4.0 with a link back

CVE-2025-3933 · Severity: low · CVSS 3.1 · Published 2026-07-07

Hugging Face Transformers is a widely-used machine learning library for natural language processing and document understanding. The DonutProcessor class contains a Regular Expression Denial of Service (ReDoS) vulnerability that can be triggered by specially crafted input strings, causing excessive CPU consumption and potential service disruption when processing documents with the Donut model.

Technologies: [Hugging Face Transformers](https://junglewise.ai/threats/technologies/transformers), [transformers (PyPI)](https://junglewise.ai/threats/technologies/pypi-transformers). Vendors: [Hugging Face](https://junglewise.ai/threats/vendors/hugging-face), [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2025-3933 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2025-3933 being exploited in the wild.

**How severe is CVE-2025-3933?** Low severity, with a CVSS score of 3.1, published 7 July 2026.

**Which products and versions are affected?** Hugging Face Transformers <=4.51.3; transformers (PyPI) ECOSYSTEM:introduced=0,fixed=4.52.1.

**Is there a fix for CVE-2025-3933?** Yes. transformers (PyPI): upgrade to 4.52.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2025-3933 attacked?** It is attacked over the network.

**Am I affected by CVE-2025-3933?** Check whether you run Hugging Face Transformers or transformers (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- transformers (PyPI): upgrade to 4.52.1 or later

  ```sh
  pip install "transformers>=4.52.1"
  ```


## Technical details

A Regular Expression Denial of Service (ReDoS) vulnerability exists in the DonutProcessor class's token2json() method, triggered by the regex pattern &lt;s_(.*?)&gt; which is vulnerable to catastrophic backtracking. The vulnerability affects all versions up to and including 4.51.3, with a fix available in version 4.52.1. An attacker can craft malicious input strings to cause excessive CPU consumption, leading to service disruption and resource exhaustion, particularly impacting API services and document processing tasks. The vulnerability is triggered through network input if the affected service processes user-supplied documents, and no authentication is typically required to exploit it. A patch is available and should be applied immediately by upgrading to version 4.52.1 or later.

## Affected products

- Hugging Face Transformers <=4.51.3

## Identifiers

- CVE-2025-3933
- GHSA-37mw-44qp-f5jm
- PYSEC-2026-1977

## Timeline

- 2025-07-11: disclosed
- 2025-05-06: patched: Fix merged in PR #37788; version 4.52.1 contains the patch

## References

- [https://github.com/huggingface/transformers/pull/37788](https://github.com/huggingface/transformers/pull/37788)

## Related threats

- [Hugging Face Transformers arbitrary file write via load_custom_generate](https://junglewise.ai/threats/cve-2026-80047-hugging-face-transformers-arbitrary-file-write-via-load-custom)
- [Hugging Face Transformers path traversal in save_pretrained](https://junglewise.ai/threats/cve-2026-9856-hugging-face-transformers-path-traversal-in-save-pretrained)
- [Hugging Face Transformers vulnerable to Regular Expression Denial of Service (ReDoS) in the AdamWeightDecay optimizer](https://junglewise.ai/threats/cve-2025-6921-hugging-face-transformers-vulnerable-to-regular-expression-denial)
- [PYSEC-2026-1988 - Hugging Face Transformers library has Regular Expression Denial of Service](https://junglewise.ai/threats/cve-2025-6051-hugging-face-transformers-library-has-regular-expression-denial-of)
- [PYSEC-2026-1981 - Hugging Face Transformers is vulnerable to ReDoS through its MarianTokenizer](https://junglewise.ai/threats/cve-2025-6638-hugging-face-transformers-is-vulnerable-to-redos-through-its)
