// threat brief
Hugging Face Transformers LightGlue loading: a model's config can override trust_remote_code=False and run the model's own code
- CVSS
- 9.6 CRITICAL
- CISA KEV
- Not listed
- Weakness
- CWE-829
- Topics
- AI security · Supply chain
Human review 2026-09-24Command tests: none yetReproduced: not yetVerification record ↓
In Transformers before 5.5.0, a LightGlue model's own config could override trust_remote_code=False and run the model's bundled Python code.
| Who is affected | People and automation that load LightGlue-type models with transformers before 5.5.0 (the official range; code inspection suggests the risky path starts around 4.54.0), such as inference servers, notebooks, CI pipelines and model evaluation workers. Red Hat OpenShift AI, AI Inference Server and other products are also listed as affected. |
|---|---|
| What happens | If the model being loaded was made or altered by an attacker, the attacker's Python code runs with the loader's permissions and could steal credentials, plant backdoors, or be used to move deeper into the network. |
| What to do now | Upgrade transformers to 5.5.0 or later. Until then, don't load LightGlue-type models from untrusted sources; setting trust_remote_code=False yourself does not protect affected versions.View evidence(4)
|
| Affected versions | Official advisory: before 5.5.0. Versions that actually contain the risky code appear to be about 4.54.0 up to but not including 5.5.0 (PlainCVE spot check, not officially confirmed); NVD's CPE lists only 5.2.0.View evidence: sources disagree(4)
|
| Fixed versions | 5.5.0 or laterView evidence(4)
|
| CVSS vector | Show full vectorCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H |
| Timeline |
|
| CISA KEV | Not listed(Not being in KEV does not mean it has not been exploited)View evidence(2)
|
Blue team playbook
Check, fix / mitigate, respond, harden. Matching the affected versions does not mean you were compromised, and a check that finds nothing does not prove you are safe; each item says what it can and cannot show. Tagged steps point to where the attack flow below can be stopped.
- 01Check your installed transformers version
Anything below 5.5.0 is in the official affected range. Versions before 4.53.0 have no LightGlue, and 4.53.0's LightGlue config lacks this handling, but the official range still says "before 5.5.0", so upgrade to be safe.
Read-only checkpip show transformers | grep -i '^version' - 02Find code and jobs that load LightGlue-type models
Only loading LightGlue-type models reaches this path. Search your code, notebooks and CI config for LightGlue use and confirm where those models come from.
Read-only checkgrep -rniI "lightglue" . - 03Inspect downloaded models' config files
PlainCVE's suggestion (not official detection guidance): look in your local model cache for configs containing a trust_remote_code field and confirm each model's source is trusted. A match is not proof of compromise.
Read-only checkgrep -rl --include=config.json 'trust_remote_code' ~/.cache/huggingface/hub
- 01Upgrade to transformers 5.5.0 or later
The fix removes trust_remote_code from LightGlueConfig and only allows built-in keypoint detectors. Red Hat says no mitigation meets its criteria, so updating is the answer.
Changes your environmentpip install -U "transformers>=5.5.0" - 02After upgrading, remove trust_remote_code=True from LightGlue calls
The 5.5.0 release notes list this as a breaking change; LightGlue variants that relied on remote code, such as lightglue_disk, are no longer supported.
- 03Red Hat products: apply the matching errata
The CVE record lists OpenShift AI, AI Inference Server, Enterprise Linux AI and other products, with errata RHSA-2026:34456, 37275, 42644 and 60520. Check Red Hat's page for each product's fix status.
- 01If an untrusted model was loaded: rotate that machine's secrets
No official indicators or response guidance were published. PlainCVE's precautionary advice: treat API tokens, cloud keys and similar secrets on that machine as possibly exposed, rotate them, and check for backdoors or unusual outbound connections. This does not confirm a leak.
- 01Manage models like code dependencies
Load models only from trusted sources and pin them to a specific revision so their contents can't change without you noticing.
- 02Handle unknown models in isolated environments
Keep production credentials off machines that evaluate or test external models and limit their network access, so that if code does run, the damage stays limited.
Full remediation steps and notes
- Upgrade:
pip install -U "transformers>=5.5.0". If your project uses a requirements file or lockfile (a file that pins dependency versions), raise the minimum version there too. - Compatibility after upgrading: from 5.5.0, any
trust_remote_code=Truepassed when loading LightGlue must be removed; variants that relied on remote code (such aslightglue_disk) are no longer supported. - Red Hat products: update via RHSA-2026:34456, 37275, 42644 and 60520. Red Hat says no mitigation meets its criteria.
- No official workaround, indicators of compromise or detection guidance were published. Until you upgrade, the only practical step is not loading untrusted LightGlue-type models.
Attack flow
Read left to right: this is the order the attack happens in. A blue shield means the step can be stopped; the earlier, the better. Click an icon for details.
- Attacker
The attacker publishes a LightGlue-type model that ships its own Python code
The model's configuration points to a keypoint detector the library doesn't recognise and records the "trust remote code" switch as on.
Defense: Load models only from trusted sources and pin them to a specific revision.
- Your system
A user or automated job downloads and loads the model with trust_remote_code=False
This could be a researcher's notebook, an inference server, a CI pipeline or a model evaluation worker. All three scorers say someone must choose to load the model (UI:R).
Defense: Upgrade to transformers 5.5.0 or later; on affected versions, don't load untrusted LightGlue-type models.
- Your system
The LightGlue config uses trust_remote_code from the model's data, overriding the caller's False
Affected versions store this safety switch as an ordinary config field, and when loading the nested detector config they pass along the config object's own value instead of the caller's choice.
Defense: The 5.5.0 fix removes trust_remote_code from LightGlueConfig and accepts only detectors built into the library.
- Your system
The model's bundled Python modules run while the model is being set up
The CVE record describes this as a policy bypass that runs attacker-supplied Python modules during initialisation.
Defense: Handle models of unknown origin in isolated environments that hold no secrets.
- Attacker
The attacker's code runs with the loader's permissions
The advisory's listed possible impacts include credential theft, lateral movement and backdoors.
Defense: If an untrusted model was loaded, treat the machine's keys and tokens as possibly exposed and rotate them.
Who is affected
Hugging Face Transformers is a Python library for downloading and running AI models. Some models ship with their own Python code (“remote code”). The library won’t run it by default unless the caller explicitly passes trust_remote_code=True. This bug let the loading path for LightGlue (a model that matches features between two images) get around that default.
| Version / product | Status |
|---|---|
| Before 4.53.0 | No LightGlue yet, though the official range still says “before 5.5.0” |
| 4.53.0 | Has LightGlue, but its config has no trust_remote_code handling (PlainCVE source check) |
| About 4.54.0 up to before 5.5.0 | Contains the risky code (spot-checked 4.54.0, 4.55.0, 4.57.0, 5.2.0; not every release checked) |
| 5.2.0 | The advisory’s tested version and the only version in NVD’s CPE entry |
| 5.5.0 or later | Fixed |
| Red Hat OpenShift AI 2.25 / 3.3 / 3.4, AI Inference Server 3, Enterprise Linux AI 3 | Listed as affected in the CVE record; there is also an Ansible Automation Platform 2 entry whose exact product is unconfirmed |
Preconditions: you must be on an affected version and load a LightGlue-type model that an attacker made or altered. That could be a person, or automation such as CI (automated build-and-test pipelines), model evaluation workers or inference servers. On affected versions, setting trust_remote_code=False yourself does not help, because that is exactly the setting that gets overridden.
How it works
LightGlue works alongside a “keypoint detector” model (usually SuperPoint). In affected versions, LightGlueConfig accepted trust_remote_code as an ordinary config field (default False) and stored it on the config object. When the nested detector config named a model type the library didn’t recognise, the code loaded that config from a model repository and passed along the config object’s own trust_remote_code value rather than the caller’s choice.
PlainCVE’s reading (not spelled out word for word by an official source): a value stored on the config object ends up in the model’s config.json, which the model’s publisher controls. The advisory’s wording, that the setting is overridden by untrusted configuration data, fits this. The weakness maps to CWE-829 (inclusion of functionality from an untrusted control sphere).
The flawed approach (conceptual illustration, not the original source code):
Show code example(python)
class PairMatcherConfig:
def __init__(self, detector_config, trust_remote_code=False, **kwargs):
# The safety switch is an ordinary field, so it travels with the model's config.json
self.trust_remote_code = trust_remote_code
if detector_config["model_type"] not in BUILTIN_MODELS:
detector_config = load_config_from_repo(
detector_config,
trust_remote_code=self.trust_remote_code, # value comes from model data
)The fixed approach:
Show code example(python)
class PairMatcherConfig:
def __init__(self, detector_config, **kwargs):
# Never take the safety switch from model data; pick only from the built-in list
if detector_config["model_type"] not in BUILTIN_MODELS:
raise ValueError("Only built-in keypoint detectors are supported")
detector_config = BUILTIN_MODELS[detector_config["model_type"]](**detector_config)The fix (PR #45122) also adds a linter rule, TRF014, that flags trust_remote_code in the library’s built-in model code. A reviewer noted that dynamically built arguments could still slip past a static check, so the rule lowers the risk rather than guaranteeing against it.
Timeline
| Date | Event |
|---|---|
| 2025-06-26 | v4.53.0 released, first with LightGlue (no risky path yet) |
| Unconfirmed | Reported on huntr (report page did not render) |
| 2026-03-31 | CVE ID reserved; fix PR #45122 merged |
| 2026-04-02 | v5.5.0 released with the fix |
| 2026-06-03 | CVE and GitHub security advisory published |
| 2026-07-13 / 07-21 | GitHub advisory reviewed / last updated |
| 2026-08-28 | NVD record last modified |
| 2026-09-01 | CVE record last updated |
The fix was public about two months before the CVE. The v5.5.0 release page summary once showed “April 2, 2025”, but the GitHub API gives 2026-04-02, and the fix was only merged on 2026-03-31, so 2026-04-02 is used here.
Further reading
- The scores differ widely: NVD gives CVSS 3.1 9.6 (Critical), huntr (the CNA that assigned the CVE) gives CVSS 3.0 8.0, and Red Hat gives CVSS 3.1 7.7 (Red Hat rating “Important”). They disagree on attack complexity (NVD Low, the others High), privileges required (Red Hat Low, the others None) and availability impact (NVD High, the others None). All three require user interaction.
- Exploitation: no source reports exploitation in the wild, and this CVE is not in CISA KEV. The GitHub advisory listed EPSS (a predicted likelihood of exploitation) at about 0.6% when checked.
- Reporter: the original huntr report could not be read, so the reporter and report date are unconfirmed.
- Supply-chain lesson: models behave like code dependencies, and one field in a config file was enough to switch off a safety setting. Exposed environments include inference API servers, research notebooks, CI/CD pipelines and model evaluation workers.
Verification Reviewed and checked against sources; not yet reproduced in our lab
| Reviewed | 2026-09-24 |
|---|
Verification records describe the environment and the result only, never reproduction steps or code that could attack other people’s systems. See our policy.
Sources
- Otherv4.54.0 released, first version with PR #39253 · api.github.com · accessed 2026-09-24
- AdvisoryArbitrary Code Execution During Model Initialization in LightGlue Model Loading Path (GHSA-fgcw-684q-jj6r) · GitHub Advisory Database, 2026-06-03 · accessed 2026-09-24
- AdvisoryCVE-2026-5241 CVE record (JSON API) · CVE Program / huntr (CNA), 2026-06-03 · accessed 2026-09-24
- CVE / NVD / OSVCVE-2026-5241 (NVD API) · NIST NVD, 2026-06-03 · accessed 2026-09-24
- Patch / release[LightGlue] Remove remote code execution (#45122) · Hugging Face, 2026-03-31 · accessed 2026-09-24
- Patch / release🚨 [LightGlue] Remove remote code execution (PR #45122) · Hugging Face, 2026-03-31 · accessed 2026-09-24
- VendorRelease v5.5.0 · Hugging Face, 2026-04-02 · accessed 2026-09-24
- VendorRelease v5.5.0 (API metadata) · GitHub / Hugging Face, 2026-04-02 · accessed 2026-09-24
- AdvisoryCVE-2026-5241 · Red Hat · accessed 2026-09-24
- VendorLightGlue documentation · Hugging Face · accessed 2026-09-24
- VendorLightGlue documentation (v4.53.3) · Hugging Face · accessed 2026-09-24
- VendorRelease v4.53.0 (API metadata) · GitHub / Hugging Face, 2025-06-26 · accessed 2026-09-24
Press brief
In one sentence
Hugging Face Transformers is one of the most widely used Python libraries for downloading and running AI models. Its safety switch, trust_remote_code, blocks code bundled with a model by default, but when loading LightGlue image-matching models, the model's own config file could override that switch. The fixed version, 5.5.0, was released in April 2026 and the CVE was published in June; no source reports exploitation in the wild.
Key facts
- Severity (NVD)
- CVSS 3.1 9.6 (Critical) services.nvd.nist.gov
- Severity (huntr, CNA)
- CVSS 3.0 8.0 (High) cveawg.mitre.org
- Fixed version
- 5.5.0 (released 2026-04-02) api.github.com
- Fix PR merged
- PR #45122, 2026-03-31 github.com
- Advisory and CVE published
- 2026-06-03 (GHSA-fgcw-684q-jj6r) github.com
Confirmed
- The LightGlue loading path in transformers before 5.5.0 lets model configuration data override the caller's trust_remote_code=False.
- 5.5.0 fixes it by removing that config field and accepting only built-in detectors.
- Several Red Hat AI products are listed as affected in the CVE record.
Unconfirmed / disputed
- The three scores differ widely: NVD 9.6, huntr 8.0, Red Hat 7.7.
- No official source gives the exact first affected version; a code spot check suggests about 4.54.0.
- The reporter's identity and report date could not be confirmed (the huntr page did not render).
- No source reports exploitation in the wild, and it is not in CISA KEV.
Quotable line
A safety switch belongs in the user's hands, not in a config file written by a stranger.
Images
Download the share image (PNG) · Attack flow diagram (downloadable)
Please credit "PlainCVE" and link to this page. Full citation format is under "How to cite" below. Found a factual error? Report it.
Hugging Face Transformers LightGlue loading: a model's config can override trust_remote_code=False and run the model's own code Hugging Face Transformers is one of the most widely used Python libraries for downloading and running AI models. Its safety switch, trust_remote_code, blocks code bundled with a model by default, but when loading LightGlue image-matching models, the model's own config file could override that switch. The fixed version, 5.5.0, was released in April 2026 and the CVE was published in June; no source reports exploitation in the wild. Key facts: - Severity (NVD):CVSS 3.1 9.6 (Critical)(https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2026-5241) - Severity (huntr, CNA):CVSS 3.0 8.0 (High)(https://cveawg.mitre.org/api/cve/CVE-2026-5241) - Fixed version:5.5.0 (released 2026-04-02)(https://api.github.com/repos/huggingface/transformers/releases/tags/v5.5.0) - Fix PR merged:PR #45122, 2026-03-31(https://github.com/huggingface/transformers/pull/45122) - Advisory and CVE published:2026-06-03 (GHSA-fgcw-684q-jj6r)(https://github.com/advisories/GHSA-fgcw-684q-jj6r) Confirmed: - The LightGlue loading path in transformers before 5.5.0 lets model configuration data override the caller's trust_remote_code=False. - 5.5.0 fixes it by removing that config field and accepting only built-in detectors. - Several Red Hat AI products are listed as affected in the CVE record. Unconfirmed / disputed: - The three scores differ widely: NVD 9.6, huntr 8.0, Red Hat 7.7. - No official source gives the exact first affected version; a code spot check suggests about 4.54.0. - The reporter's identity and report date could not be confirmed (the huntr page did not render). - No source reports exploitation in the wild, and it is not in CISA KEV. 「A safety switch belongs in the user's hands, not in a config file written by a stranger.」— PlainCVE https://plaincve.date/en/vulns/cve-2026-5241-transformers-lightglue-remote-code-override
How to cite this page
This article is CC BY 4.0. Please keep the attribution and link when republishing.
PlainCVE Team (2026). "Hugging Face Transformers LightGlue loading: a model's config can override trust_remote_code=False and run the model's own code". PlainCVE. https://plaincve.date/en/vulns/cve-2026-5241-transformers-lightglue-remote-code-override (accessed YYYY-MM-DD)BibTeX
@misc{cve20265241transformerslightglueremotecodeoverride2026,
title = {Hugging Face Transformers LightGlue loading: a model's config can override trust_remote_code=False and run the model's own code},
author = {PlainCVE Team},
year = {2026},
howpublished = {PlainCVE},
url = {https://plaincve.date/en/vulns/cve-2026-5241-transformers-lightglue-remote-code-override},
note = {Updated 2026-09-24}
}