Headline
GHSA-9356-575x-2w9m: Hugging Face Transformers Regular Expression Denial of Service (ReDoS) vulnerability
A Regular Expression Denial of Service (ReDoS) vulnerability exists in the Hugging Face Transformers library, specifically in the convert_tf_weight_name_to_pt_weight_name()
function. This function, responsible for converting TensorFlow weight names to PyTorch format, uses a regex pattern /[^/]*___([^/]*)/
that can be exploited to cause excessive CPU consumption through crafted input strings due to catastrophic backtracking. The vulnerability affects versions up to 4.51.3 and is fixed in version 4.53.0. This issue can lead to service disruption, resource exhaustion, and potential API service vulnerabilities, impacting model conversion processes between TensorFlow and PyTorch formats.
Skip to content
Navigation Menu
GitHub Copilot
Write better code with AI
GitHub Spark New
Build and deploy intelligent apps
GitHub Models New
Manage and compare prompts
GitHub Advanced Security
Find and fix vulnerabilities
Actions
Automate any workflow
* Codespaces
Instant dev environments
* Issues
Plan and track work
* Code Review
Manage code changes
* Discussions
Collaborate outside of code
* Code Search
Find more, search less
Explore
- Learning Pathways
- Events & Webinars
- Ebooks & Whitepapers
- Customer Stories
- Partners
- Executive Insights
GitHub Sponsors
Fund open source developers
* The ReadME Project
GitHub community articles
Enterprise platform
AI-powered developer platform
- Pricing
Provide feedback
Saved searches****Use saved searches to filter your results more quickly
Sign up
Appearance settings
- GitHub Advisory Database
- GitHub Reviewed
- CVE-2025-5197
Hugging Face Transformers Regular Expression Denial of Service (ReDoS) vulnerability
Moderate severity GitHub Reviewed Published Aug 6, 2025 to the GitHub Advisory Database • Updated Aug 6, 2025
Package
pip transformers (pip)
Affected versions
< 4.53.0
Description
A Regular Expression Denial of Service (ReDoS) vulnerability exists in the Hugging Face Transformers library, specifically in the convert_tf_weight_name_to_pt_weight_name() function. This function, responsible for converting TensorFlow weight names to PyTorch format, uses a regex pattern /[^/]___([^/])/ that can be exploited to cause excessive CPU consumption through crafted input strings due to catastrophic backtracking. The vulnerability affects versions up to 4.51.3 and is fixed in version 4.53.0. This issue can lead to service disruption, resource exhaustion, and potential API service vulnerabilities, impacting model conversion processes between TensorFlow and PyTorch formats.
References
- https://nvd.nist.gov/vuln/detail/CVE-2025-5197
- huggingface/transformers@944b560
- https://huntr.com/bounties/3f8b3fd0-166b-46e7-b60f-60dd9d2678bf
- huggingface/transformers@701caef
Published to the GitHub Advisory Database
Aug 6, 2025
EPSS score