Malicious Hugging Face Models Could Trigger Remote Code Execution

· Source: TechRepublic · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Cybersecurity & Data Privacy, Software Development & Engineering · Depth: Intermediate, short

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

In practice

Topics

Best for: CTO, VP of Engineering/Data, Director of AI/ML, AI Security Engineer, MLOps Engineer, Machine Learning Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by TechRepublic.