NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Transformers

CVE-2026-5241: huggingface/transformers: Arbitrary Code Execution During Model Initialization in the LightGlue Model Loading Path

highCVSS 3.0 8.0GHSA-fgcw-684q-jj6r

In huggingface/transformers 5.2.0, loading a LightGlue model from an attacker-controlled repository can run the attacker's Python code, even when you pass `trust_remote_code=False`. The LightGlue config trusts a flag inside the repository's own `config.json`. The advisory lists versions before 5.5.0 as vulnerable and 5.5.0 as the fix.

Published Jun 3, 2026 · Updated Jul 21, 2026 · Analysis Oct 26, 2026

What an attacker can do

trust_remote_code=False is the guard that stops a model repo from running its own Python. In the LightGlue path it fails. LightGlueConfig reads a trust_remote_code value from the untrusted config.json and passes it into nested AutoConfig.from_pretrained() calls. A repo that sets it to true gets its Python modules loaded and run during AutoModel.from_pretrained() (CWE-829).

The attacker needs the victim to load a model from a repository the attacker controls. That is the user interaction in the CVSS vector. High attack complexity reflects that need. Nothing else is required, and the victim does not opt in to remote code.

The advisory names API inference servers, research notebooks, CI/CD pipelines and model evaluation workers as high-risk places. Code runs with the loader's privileges, so the outcomes it lists are credential theft, lateral movement and persistence or backdoors. Pipelines that pull community models by name and rely on trust_remote_code=False as their safety check are the most exposed.

Who is affected

The transformers package on PyPI. The description names 5.2.0; the package data marks everything before 5.5.0 as vulnerable. The flaw is in the LightGlue loading path, so it matters when you load LightGlue models or models from untrusted repos. Check your version:

pip show transformers

Search your code and pipelines for from_pretrained calls that take a model name from user input or an untrusted list.

transformers

Ecosystem
PyPI
Affected
< 5.5.0
Fixed in
5.5.0
Check
pip show transformers

How to fix it

Upgrade to transformers 5.5.0:

pip install --upgrade 'transformers>=5.5.0'

The fix is commit 676559d, "Remove remote code execution". It removes the trust_remote_code field from LightGlueConfig. The config now always builds the keypoint detector config from CONFIG_MAPPING, so a detector type that is not registered fails at the lookup instead of loading remote code. The commit also adds lint rule TRF014 to flag trust_remote_code in native model integrations.

The sources give no workaround. Until you upgrade, load models only from repositories you trust and pin the revision.

How to tell if you were hit

The sources give no indicators. Review which model repositories your jobs loaded, especially LightGlue repos or any you do not own. Inspect their config.json for a trust_remote_code key set to true, and look for Python files in the repo that the loader could import. Look for unexpected child processes or outbound connections from inference servers, notebooks and CI workers right after a model load.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

A vulnerability in the LightGlue model loading path of huggingface/transformers version 5.2.0 allows an attacker-controlled model repository to execute arbitrary code during model initialization. The issue arises because the trust_remote_code parameter, intended to prevent remote code execution, is overridden by untrusted serialized configuration data in a nested code path. Specifically, when loading a LightGlue model using AutoModel.from_pretrained() with trust_remote_code=False, the LightGlueConfig reads the trust_remote_code value from the untrusted config.json file and propagates it into nested AutoConfig.from_pretrained() calls. This results in the execution of attacker-provided Python modules, even when the victim explicitly disables remote code execution. The vulnerability poses a high risk for environments such as API inference servers, research notebooks, CI/CD pipelines, and model evaluation workers, potentially leading to credential theft, lateral movement, or persistence/backdoor deployment.

Questions

Does trust_remote_code=False protect me on 5.2.0?

Not in the LightGlue path. The config reads the flag from the repository's config.json and passes it to nested AutoConfig.from_pretrained() calls, overriding your setting.

Which version fixes CVE-2026-5241?

transformers 5.5.0. The package data lists all versions before it as vulnerable.

Is user interaction needed?

Yes. Someone or something has to load a model from the attacker's repository, for example a notebook or pipeline that takes a model name from outside.

Is it exploited in the wild?

The sources do not say so, and there is no CISA KEV flag. The EPSS score is 0.006.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Transformers vulnerabilities

All Transformers entries