CVE-2025-3777: Transformers Package Improper Input Validation 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
The Hugging Face Transformers package is a widely used library in the field of natural language processing (NLP) and machine learning. It provides pre-trained models and tools for tasks such as text classification, translation, and summarization. However, versions up to 4.49.0 are vulnerable to an improper input validation issue that can be exploited through malicious URL manipulation.
Vulnerability Detail
The vulnerability in the Transformers package is rooted in the improper validation of URLs within the image_utils.py file. The use of the 'startswith()' method for URL validation allows attackers to inject usernames into URLs, making them appear legitimate (e.g., from YouTube) while redirecting users to malicious domains. This can lead to serious consequences such as phishing attacks, malware distribution, or unauthorized data access.
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, you can implement additional validation checks for URLs in your application to prevent the exploitation of this vulnerability. For example, you can use regular expressions to validate URLs more securely.
Conclusion
The improper input validation vulnerability in the Hugging Face Transformers package poses significant risks, including potential phishing and malware attacks. It is crucial for users to update to version 4.52.1 or later to mitigate these risks. Regular monitoring of dependencies using tools like Vulert can help maintain security.
See every vulnerability recorded for transformers →
FAQ
The CVSS score for this vulnerability is 3.5, indicating a low severity level.
All versions of the Transformers package up to 4.49.0 are affected by this vulnerability.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
Exploitation of this vulnerability can lead to phishing attacks, malware distribution, or data exfiltration.
Yes, Vulert can monitor and alert you in real-time for open-source vulnerabilities in your software using just the Pipfile.lock.
Related vulnerabilities
Recent vulnerabilities recorded for transformers.