CVE-2026-5241: Hugging Face Transformers RCE in LightGlue model loading

CVE-2026-5241 · Severity: high · CVSS 8 · Published 2026-06-03

A security flaw in the Hugging Face Transformers library allows a malicious AI model to execute unauthorized code on a user's computer. This occurs even if the user has explicitly disabled the setting that allows remote code execution. An attacker could use this to steal credentials, gain a foothold in a corporate network, or disrupt automated AI pipelines.

Technologies: Hugging Face Transformers, transformers (PyPI). Vendors: Hugging Face, PyPI.

Quick answers

Is CVE-2026-5241 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-5241 being exploited in the wild.
How severe is CVE-2026-5241?
High severity, with a CVSS score of 8, published 3 June 2026.
Which products and versions are affected?
Hugging Face Transformers < 5.5.0, 5.2.0; transformers (PyPI) ECOSYSTEM:introduced=0,fixed=5.5.0, ECOSYSTEM:introduced=0,last_affected=5.2.0.
Is there a fix for CVE-2026-5241?
Yes. transformers (PyPI): upgrade to 5.5.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-5241 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-5241?
Check whether you run Hugging Face Transformers or transformers (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • transformers (PyPI): upgrade to 5.5.0 or later
    pip install "transformers>=5.5.0"

Technical details

A vulnerability in the LightGlue model loading path of huggingface/transformers (specifically version 5.2.0 and others before 5.5.0) allows for arbitrary code execution. The root cause is a failure to properly enforce the 'trust_remote_code' security parameter. When a user loads a LightGlue model via 'AutoModel.from_pretrained()' with 'trust_remote_code=False', the 'LightGlueConfig' component incorrectly reads a 'trust_remote_code' value from the untrusted 'config.json' file within the model repository. This value is then propagated into nested 'AutoConfig.from_pretrained()' calls, overriding the user's safety preference and executing attacker-supplied Python modules. This can be exploited if a user is enticed to load a malicious model from a remote repository.

Affected products

  • Hugging Face transformers < 5.5.0

Identifiers

  • CVE-2026-5241
  • GHSA-fgcw-684q-jj6r
  • PYSEC-2026-2290

Timeline

  • 2026-03-31: patched: Fix committed to repository
  • 2026-06-03: disclosed: Initial advisory publication
  • 2026-07-13: advisory: Advisory updated and reviewed

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.