CVE-2025-3777: Transformers Package Username Injection Vulnerability
Summary
CVE-2025-3777: Transformers's Improper Input Validation vulnerability can be exploited through username injection. Affects transformers versions < 4.52.1. Fixed in 4.52.1. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Hugging Face Transformers is a popular open-source library designed for natural language processing tasks. It provides pre-trained models and tools for tasks such as text classification, translation, and image processing. The library is widely used in the AI community due to its ease of use and extensive capabilities. However, versions up to 4.49.0 are susceptible to a critical vulnerability that compromises its URL validation mechanism.
Vulnerability Detail
The vulnerability in the Transformers package arises from improper input validation in the image_utils.py file. Specifically, the use of the 'startswith()' method for URL validation can be bypassed through username injection. This allows attackers to craft malicious URLs that masquerade as legitimate YouTube links, potentially leading to phishing attacks, malware distribution, or data exfiltration. The vulnerability has a CVSS score of 3.5, indicating a moderate level of risk.
How To Fix
Latest published version: 5.20.2 as of 22 Oct 2026
pip install --upgrade "transformers==5.20.2"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
4.52.1
This is the first release that contains the fix.
pip install --upgrade "transformers==4.52.1"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, users can implement additional validation checks on URLs before processing them. For example, you can manually verify that the URL does not contain any unexpected username components. However, the best solution is to update to the patched version.
Conclusion
The improper input validation vulnerability in the Hugging Face Transformers package poses a significant risk to users. It is crucial to update to the latest version to mitigate potential threats. By following the provided steps, users can ensure their applications remain secure.
See every vulnerability recorded for transformers →
FAQ
The vulnerability is an improper input validation issue that allows for username injection in URLs.
All versions up to 4.49.0 are affected by this vulnerability.
Attackers could exploit this vulnerability to conduct phishing attacks, distribute malware, or exfiltrate sensitive data.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
Vulert is a tool that monitors and alerts in real-time for open-source vulnerabilities in software, using just the Pipfile.lock.
Related vulnerabilities
Recent vulnerabilities recorded for transformers.