Skip to main content
Mallory
Back to intelligence
ai-platform-securityopen-source-dependency-vulnerabilitywidely-deployed-product-advisorybuild-pipeline-compromise

Hugging Face Transformers Flaw Let Malicious Models Bypass `trust_remote_code`

Updated 8d agoFirst seen Jun 3, 20264 sources

A critical remote code execution flaw in Hugging Face's transformers library allowed attacker-controlled model repositories to run arbitrary code during the standard from_pretrained() loading process, even when trust_remote_code=False was set. The issue was tied to unsafe handling of untrusted model configuration data, including nested configuration resolution in the LightGlue loading path, where values from config.json could override the intended safety setting and trigger execution of attacker-supplied Python modules during model initialization.

Reports said the vulnerability affected transformers versions 4.56.0 through 5.2.x in environments where the kernels package was installed, with version 5.2.0 specifically cited in LightGlue-related exploitation scenarios. Exposed targets included inference servers, research notebooks, CI/CD pipelines, and automated model evaluation systems, where successful compromise could enable theft of cloud credentials, API keys, SSH keys, proprietary datasets, lateral movement, persistence, and backdoor deployment. Hugging Face released a fix in transformers 5.3.0 and urged organizations to upgrade and treat model loading as a code execution surface.

Share:
Hugging Face Transformers Flaw Let Malicious Models Bypass `trust_remote_code`
Stay ahead

Get ahead of threats like this

Mallory correlates global threat intelligence with your attack surface — know if you’re exposed before adversaries strike.

EVENT TIMELINE

How this story unfolded

2 events from the most recent confirmed update back to the earliest known activity.

2 EVENTS
Jun 4, 202611d ago

Hugging Face releases Transformers 5.3.0 to fix the flaw

Hugging Face released a fix for the vulnerability in Transformers version 5.3.0 and urged organizations to upgrade immediately. The advisory also warned users to treat model loading as a code execution surface.

Critical vulnerability in Hugging Face Transformers library allowed arbitrary code execution | brief | SC Media
Jun 3, 202613d ago

Hugging Face discloses Transformers RCE vulnerability

A critical remote code execution flaw in Hugging Face Transformers was disclosed, showing that attacker-controlled model configuration data could bypass the intended protection of setting trust_remote_code=False during model loading. The issue was reported as affecting model-loading workflows and enabling arbitrary code execution from malicious model repositories.

CVE-2026-5241 - Policy Bypass in LightGlue Nested Config Resolution in huggingface/transformers
LINKED ENTITIES

Related entities

Vulnerabilities, threat actors, malware, products, organizations, and breaches Mallory has linked to this story.

9 LINKEDOpen in app
Affected products
1 linked
Transformers
Organizations
7 linked
Hugging FaceAmazon Web ServicesLinkedinXGooglePluto SecuritySiliconANGLE
The operational view lives in Mallory

See the full picture, correlated to your attack surface.

This page covers what’s public. Mallory adds the parts that aren’t — which of your assets are affected, which threat actors are using it right now, which detections to deploy, and what to do next.
Exposure mapping

Map indicators from this story to your assets and identify affected systems in minutes.

Threat actor evidence

Every observed campaign, victim, and pivot linked to actors named in this story.

Associated malware

Malware, exploits, and IOCs connected to the activity described here.

Detection signatures

YARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.

Scheduled alerts

Get matching new stories delivered to your team as they break — not the next morning.

AI threads

Ask questions about this story and take action on the answers.