Executive brief
Hugging Face Transformers is a widely-used Python library for natural language processing and machine learning model deployment. A vulnerability in its model file parsing allows remote attackers to execute arbitrary code when a user loads a malicious model file or visits a malicious page. This could compromise systems running ML workflows, exposing sensitive training data, model weights, and enabling lateral movement within corporate ML infrastructure.
Technical details
The vulnerability exists in the MaskFormer model component within Hugging Face Transformers, specifically in the parsing of model files. The root cause is insufficient validation during deserialization of untrusted data, allowing attackers to craft malicious model files that execute arbitrary Python code when loaded. The attack vector is network-based, requiring user interaction (opening a malicious file or visiting a malicious page), with no privileges required. An attacker can achieve code execution under the privileges of the current user, compromising confidentiality, integrity, and availability. The vulnerability affects Transformers versions below 4.48.0 and is fixed in version 4.48.0 and later. The fix involves excluding potentially dangerous conversion scripts from release wheels and implementing proper model validation.
Affected products
- Hugging Face Transformers < 4.48.0
Timeline
- 2024-09-11: disclosed: Vulnerability reported to vendor via bug bounty platform
- 2024-10-14: other: Vendor rejected the vulnerability
- 2024-11-06: other: ZDI notified vendor of intention to publish as 0-day advisory
- 2024-11-19: advisory: Coordinated public release of advisory by ZDI
- 2024-11-23: patched: GitHub Advisory Database published; patched in version 4.48.0