CVE-2026-5241: Policy Bypass in LightGlue Nested Config Resolution in huggingface/transformers
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 trustremotecode 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.frompretrained() with trustremotecode=False, the LightGlueConfig reads the trustremotecode value from the untrusted config.json file and propagates it into nested AutoConfig.frompretrained() 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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
When loading LightGlue models via AutoModel.from_pretrained(), ensure you do not allow attacker-controlled model repositories/config.json files (e.g., only use trusted local model directories or trusted repositories) so untrusted nested LightGlueConfig/AutoConfig resolution cannot override trust_remote_code behavior.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-5241?
CVE-2026-5241 has a severity rating of high, classified as an 8 on the CVSS scale.
How do I fix CVE-2026-5241?
To mitigate CVE-2026-5241, upgrade to the latest version of huggingface/transformers where the vulnerability has been patched.
What does CVE-2026-5241 affect?
CVE-2026-5241 affects the LightGlue model loading path in huggingface/transformers version 5.2.0.
What is the risk associated with CVE-2026-5241?
The risk associated with CVE-2026-5241 is rated as 58, indicating a significant potential impact on security.
What is the nature of the vulnerability in CVE-2026-5241?
CVE-2026-5241 is a policy bypass vulnerability that allows an attacker-controlled model repository to execute arbitrary code.