Skip to content
DoS Disclosed report Intermediate CVE-2025-3933

Transformers is vulnerable to ReDoS attack through its DonutProcessor class

The DonutProcessor class in Hugging Face Transformers used a regex pattern that could backtrack catastrophically on crafted input. An attacker could supply a malicious string to cause excessive CPU consumption and disrupt document processing services.

huggingface/transformers

Originally disclosed on huntr

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.

From the GitHub Advisory Database (GHSA-37mw-44qp-f5jm, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

This could lead to service disruption, resource exhaustion, and potential API service vulnerabilities, affecting document processing tasks using the Donut model.

What the attacker needed

Crafted input string; use of DonutProcessor token2json()

The fix

The vulnerability was fixed in version 4.52.1.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A regular expression (regex) is a pattern used to search text. Some patterns can take a very long time to match certain inputs, which is called catastrophic backtracking. Here, a crafted string could make the DonutProcessor's regex work extremely hard, slowing down or crashing the service that processes documents.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More from huggingface/transformers

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.