Skip to content
MediumVulnerability

CVE-2025-5197: Hugging Face Transformers ReDoS in TensorFlow to PyTorch weight name conversion

Identifier
CVE-2025-5197
Published
Record updated
View JSON
Affected
  • transformers < 4.53.0
Fixed in
4.53.0
  • released June 26, 2025, 41 days before disclosure
Known exploitation
Not listed in the CISA Known Exploited Vulnerabilities catalog at the last check.
EPSS
0.4%

Summary

A Regular Expression Denial of Service (ReDoS) flaw exists in the Hugging Face Transformers library, in the `convert_tf_weight_name_to_pt_weight_name()` function that converts TensorFlow weight names to PyTorch format. Its regex pattern `/[^/]*___([^/]*)/` can be driven into catastrophic backtracking by crafted input strings, consuming excessive CPU. The flaw affects versions up to 4.51.3 and can cause service disruption, resource exhaustion and potential API service vulnerabilities during model conversion.

Mitigation

Fixed in version 4.53.0.