Malicious Hugging Face Models Could Trigger Remote Code Execution
Summary
A critical remote code execution (RCE) vulnerability, tracked as CVE-2026-4372, has been identified in the Hugging Face Transformers library, allowing malicious AI models to execute arbitrary code. Disclosed by Pluto researchers, this flaw bypasses the "trust_remote_code=False" security control, enabling attackers to trigger code execution simply by loading a poisoned model via a standard "from_pretrained()" call. The vulnerability affects multiple Transformers versions when the optional "kernels" package is installed, a common setup in GPU-accelerated AI environments. Attackers can manipulate a model's "config.json" to alter the "_attn_implementation_internal" attribute, forcing the download and import of attacker-controlled Python code. Before a patch was released, vulnerable Transformers versions were downloaded approximately 232 million times, posing significant AI supply chain risks and potentially exposing sensitive assets like cloud credentials, SSH keys, and API tokens.
Key takeaway
For MLOps Engineers or AI Security Engineers deploying third-party AI models, this vulnerability underscores the critical need for robust supply chain security. You must immediately upgrade your Hugging Face Transformers library to a patched version, especially if the "kernels" package is installed. Implement strict sandboxing for all external models and restrict outbound network connections from your ML infrastructure. Regularly audit your AI asset inventory and test incident response plans to mitigate risks from compromised model configurations.
Key insights
Malicious AI model configurations can exploit library processing mechanisms to achieve remote code execution, even bypassing explicit security flags.
Principles
- AI supply chain vulnerabilities extend to model configuration files.
- Relying solely on "trust_remote_code=False" is insufficient for model security.
- Default library installations can introduce hidden attack surfaces.
In practice
- Isolate external AI models in sandboxed environments before deployment.
- Restrict outbound network access from machine learning systems.
- Maintain a software bill of materials (SBOM) for AI models and dependencies.
Topics
- Hugging Face Transformers
- Remote Code Execution
- AI Supply Chain Security
- CVE-2026-4372
- Model Security
- MLOps Security
Best for: CTO, VP of Engineering/Data, Director of AI/ML, AI Security Engineer, MLOps Engineer, Machine Learning Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by TechRepublic.