Skip to main content
EPSS 0.6%top 53%

CVE-2026-5241: CWE-829 Inclusion of Functionality from Untrusted Control Sphere in huggingface huggingface/transformers

0
High
VulnerabilityCVE-2026-5241cvecve-2026-5241cwe-829gcve
Published: 06/03/2026 (06/03/2026, 12:33:10 UTC)
Source: CVE Database V5
Vendor/Project: huggingface
Product: huggingface/transformers

Description

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.

CVSS v3.0

Score 8.0high

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None
CVSS:3.0/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:N

Affected software

huggingface

huggingface/transformers

transformers
pkg:pypi/transformers
Affected versions
=5.2.0

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/12/2026, 13:04:31 UTC

Technical Analysis

The vulnerability in huggingface/transformers 5.2.0 involves the LightGlue model loading mechanism where the 'trust_remote_code' parameter, designed to prevent remote code execution, is overridden by untrusted serialized configuration data in nested calls. Specifically, when loading a LightGlue model with 'AutoModel.from_pretrained()' and 'trust_remote_code' set to false, the 'LightGlueConfig' reads this parameter from an attacker-controlled 'config.json' file, propagating it into nested 'AutoConfig.from_pretrained()' calls. This results in execution of arbitrary attacker-provided Python code despite explicit disabling of remote code execution. The vulnerability affects all versions prior to 5.5.0, with the LightGlue model introduced in 4.53.0. Red Hat advisories confirm the vulnerability affects their AI/ML products and note no current mitigation meets their standards. The CVSS v3 score is 8.0, indicating high severity, with network attack vector, high attack complexity, no privileges required, user interaction required, and scope changed. The impact includes potential credential theft, unauthorized access, and deployment of backdoors.

Potential Impact

Successful exploitation allows an attacker to execute arbitrary code during model loading, potentially leading to credential theft, unauthorized system access, lateral movement, and deployment of persistent backdoors. This risk is especially critical in environments processing untrusted models such as API inference servers, research notebooks, CI/CD pipelines, and model evaluation workers. The vulnerability compromises confidentiality and integrity but does not impact availability.

Mitigation Recommendations

A fix is available in huggingface/transformers version 5.5.0 and later, which corrects the handling of the 'trust_remote_code' parameter to prevent override by untrusted configuration data. Users should upgrade to version 5.5.0 or newer to remediate this vulnerability. Currently, Red Hat states that no mitigation meeting their criteria for ease of use, applicability, and stability is available. Therefore, upgrading to a fixed version is the recommended remediation. Avoid loading untrusted LightGlue models until patched.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
@huntr_ai
Date Reserved
2026-03-31T14:26:14.353Z
Cvss Version
3.0
State
PUBLISHED
Vendor Advisory Urls
[{"url":"https://access.redhat.com/security/cve/CVE-2026-5241","vendor":"Red Hat"}]

Threat ID: 6a2037c7e29bf47b50c14ed8

Added to database: 06/03/2026, 14:18:47 UTC

Last enriched: 08/12/2026, 13:04:31 UTC

Last updated: 09/13/2026, 10:01:32 UTC

Views: 123

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses