CVE-2024-11393: Hugging Face Transformers MaskFormer Model Deserialization Vulnerability Leading to Remote Code Execution
Summary
CVE-2024-11393: Hugging Face Transformers MaskFormer Model Deserialization of Untrusted Data Remote Code Execution Vulnerability. Affects transformers versions < 4.48.0. Fixed in 4.48.0. 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 widely-used library in the machine learning community, providing pre-trained models and tools for natural language processing tasks. The library supports various model architectures, including MaskFormer, which is designed for image segmentation tasks. This library is popular due to its ease of use and extensive documentation, making it accessible for developers and researchers alike. However, it has recently been identified to have a critical vulnerability that could allow remote code execution through improper handling of model files.
Vulnerability Detail
The vulnerability arises from the deserialization of untrusted data when parsing model files within the Hugging Face Transformers library. This flaw is due to inadequate validation of user-supplied data, which can lead to an attacker executing arbitrary code in the context of the current user. The exploitation of this vulnerability requires user interaction, as the target must either visit a malicious webpage or open a compromised model file. The potential ramifications of this vulnerability are severe, as it could allow attackers to gain control over the affected system, leading to data breaches or further exploitation.
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.48.0
This is the first release that contains the fix.
pip install --upgrade "transformers==4.48.0"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, users should avoid opening model files from untrusted sources and refrain from visiting suspicious links that may lead to malicious model files until the library is updated.
Conclusion
The Hugging Face Transformers library has a critical vulnerability (CVE-2024-11393) that allows for remote code execution through improper handling of model files. Users are strongly advised to update to version 4.48.0 or later to mitigate this risk. Until then, exercising caution with untrusted model files is essential.
See every vulnerability recorded for transformers →
FAQ
CVE-2024-11393 is a vulnerability in the Hugging Face Transformers library that allows remote code execution due to improper deserialization of model files.
You can check if your application is affected by using the Vulert playground at Vulert Scanner, which monitors open-source vulnerabilities without requiring any signup.
If you cannot update the library right away, avoid using model files from untrusted sources and refrain from clicking on suspicious links.
The CVSS score of this vulnerability is 8.8, indicating a high severity level.
More information about the Hugging Face Transformers library can be found on its official GitHub repository and documentation site.
References
Related vulnerabilities
Recent vulnerabilities recorded for transformers.