PYSEC-2026-1982
Transformers Regular Expression Denial of Service (ReDoS) vulnerability
Quick fix
PYSEC-2026-1982 — transformers: upgrade to the fixed version with the command below.
pip install --upgrade 'transformers>=4.48.0'Details
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.
Are you affected?
Enter the version of the package you're using.
Affected packages
References
- https://nvd.nist.gov/vuln/detail/CVE-2024-12720[ADVISORY]
- https://github.com/huggingface/transformers/commit/deac971c469bcbb182c2e52da0b82fb3bf54cccf[WEB]
- https://github.com/huggingface/transformers[PACKAGE]
- https://huntr.com/bounties/4bed1214-7835-4252-a853-22bbad891f98[WEB]
- https://pypi.org/project/transformers[PACKAGE]
- https://github.com/advisories/GHSA-6rvg-6v2m-4j46[ADVISORY]
Check it before you install it
One call answers whether to add this package: known advisories, CISA KEV, and whether the name is a hallucinated or freshly squatted one. No key needed to try it.
curl -s https://vdb.ai.kr/v1/ai/check-packages \
-H 'Content-Type: application/json' \
-d '{"packages":["pkg:pypi/transformers"]}'