Description
Diffusers is the a library for pretrained diffusion models. Prior to 0.38.0, a trust_remote_code bypass in DiffusionPipeline.from_pretrained allows arbitrary remote code execution despite the user passing trust_remote_code=False (or omitting it, which is the default). The vulnerability has three variants, all sharing the same root cause — the trust_remote_code gate was implemented inside DiffusionPipeline.download() rather than at the actual dynamic-module load site, so any code path that bypassed or short-circuited download() also bypassed the security check. DiffusionPipeline.from_pretrained('repoA', custom_pipeline='attacker/repoB', trust_remote_code=False) — the gate evaluated against repoA's file list rather than repoB's, so repoB's pipeline.py was loaded and executed. DiffusionPipeline.from_pretrained('/local/snapshot', custom_pipeline='attacker/repoB', trust_remote_code=False) — the local-path branch never invoked download(), so the gate was never reached and remote code from repoB executed. DiffusionPipeline.from_pretrained('/local/snapshot', trust_remote_code=False) where the snapshot contains custom component files (e.g. unet/my_unet_model.py) referenced from model_index.json — same root cause; the local path skipped download() and custom component code executed. This vulnerability is fixed in 0.38.0.
Published: 2026-05-14
Score: 8.8 High
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Diffusers, a library for pretrained diffusion models, has a trust_remote_code bypass that permits arbitrary remote code execution when using DiffusionPipeline.from_pretrained. Even when trust_remote_code=False is set or omitted, code from untrusted pipelines or local custom components can be loaded and executed. The issue occurs because the security check was placed inside a download routine rather than at the dynamic-module loading site, allowing the gate to be bypassed via custom_pipeline or local snapshots. This flaw is classified as CWE‑94, indicating code injection through dynamic code loading.

Affected Systems

This vulnerability affects the Hugging Face Diffusers library for any version before 0.38.0. Users who load pipelines from external repositories or local snapshots that reference custom components—particularly those specifying a custom_pipeline argument or containing untrusted Python modules—are exposed. The weakness operates regardless of whether the source is remote or local, impacting all deployments that have not applied the 0.38.0 fix.

Risk and Exploitability

The flaw carries a CVSS score of 8.8, denoting a high severity level and a significant potential impact on confidentiality, integrity, and availability via remote code execution. EPSS data is unavailable, and the vulnerability is not listed in the CISA KEV catalog, suggesting no mass exploitation is currently documented. Nonetheless, the attack vector can be exercised by merely specifying a malicious custom_pipeline or loading a local snapshot with untrusted scripts, a path that requires no special privileges and can be triggered by any user invoking from_pretrained.

Generated by OpenCVE AI on May 14, 2026 at 18:25 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Apply the official patch by upgrading Hugging Face Diffusers to version 0.38.0 or later.
  • Where upgrading is not yet feasible, restrict the usage of the trust_remote_code flag to True only for trusted, verified repositories and avoid passing a custom_pipeline value when loading pipelines.
  • Audit any local snapshots or custom component modules (e.g., unet/my_unet_model.py) before use, and remove or replace them with vetted code.

Generated by OpenCVE AI on May 14, 2026 at 18:25 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-98h9-4798-4q5v Diffusers has a `trust_remote_code` bypass via `custom_pipeline` and local custom components
History

Thu, 14 May 2026 19:00:00 +0000

Type Values Removed Values Added
First Time appeared Huggingface
Huggingface diffusers
Vendors & Products Huggingface
Huggingface diffusers

Thu, 14 May 2026 17:00:00 +0000

Type Values Removed Values Added
Description Diffusers is the a library for pretrained diffusion models. Prior to 0.38.0, a trust_remote_code bypass in DiffusionPipeline.from_pretrained allows arbitrary remote code execution despite the user passing trust_remote_code=False (or omitting it, which is the default). The vulnerability has three variants, all sharing the same root cause — the trust_remote_code gate was implemented inside DiffusionPipeline.download() rather than at the actual dynamic-module load site, so any code path that bypassed or short-circuited download() also bypassed the security check. DiffusionPipeline.from_pretrained('repoA', custom_pipeline='attacker/repoB', trust_remote_code=False) — the gate evaluated against repoA's file list rather than repoB's, so repoB's pipeline.py was loaded and executed. DiffusionPipeline.from_pretrained('/local/snapshot', custom_pipeline='attacker/repoB', trust_remote_code=False) — the local-path branch never invoked download(), so the gate was never reached and remote code from repoB executed. DiffusionPipeline.from_pretrained('/local/snapshot', trust_remote_code=False) where the snapshot contains custom component files (e.g. unet/my_unet_model.py) referenced from model_index.json — same root cause; the local path skipped download() and custom component code executed. This vulnerability is fixed in 0.38.0.
Title Diffusers: `trust_remote_code` bypass via `custom_pipeline` and local custom components
Weaknesses CWE-94
References
Metrics cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}


Subscriptions

Huggingface Diffusers
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-05-14T16:26:03.907Z

Reserved: 2026-05-06T18:28:20.887Z

Link: CVE-2026-44513

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Awaiting Analysis

Published: 2026-05-14T17:16:22.903

Modified: 2026-05-14T18:30:57.103

Link: CVE-2026-44513

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-05-14T18:45:26Z

Weaknesses