CVE-2026-44513: Diffusers: `trust_remote_code` bypass via `custom_pipeline` and local custom components

Published May 7, 2026
·
Updated

Impact

A trustremotecode bypass in DiffusionPipeline.frompretrained allows arbitrary remote code execution despite the user passing trustremotecode=False (or omitting it, which is the default). The vulnerability has three variants, all sharing the same root cause — the trustremotecode 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:

1. Cross-repo custompipeline. DiffusionPipeline.frompretrained('repoA', custompipeline='attacker/repoB', trustremotecode=False) — the gate evaluated against repoA's file list rather than repoB's, so repoB's pipeline.py was loaded and executed. 2. Local snapshot + Hub custompipeline. DiffusionPipeline.frompretrained('/local/snapshot', custompipeline='attacker/repoB', trustremotecode=False) — the local-path branch never invoked download(), so the gate was never reached and remote code from repoB executed. 3. Local snapshot with custom components. DiffusionPipeline.frompretrained('/local/snapshot', trustremotecode=False) where the snapshot contains custom component files (e.g. unet/myunetmodel.py) referenced from modelindex.json — same root cause; the local path skipped download() and custom component code executed.

Silent remote code execution on the victim's machine. Anyone calling DiffusionPipeline.frompretrained with custom pipelines is impacted.

Patches

Yes. Fixed in diffusers 0.38.0 via PR #13448. All users on versions < 0.38.0 should upgrade:

bash pip install --upgrade "diffusers>=0.38.0"

The fix moves the trustremotecode gate out of DiffusionPipeline.download() and into getcachedmodulefile in src/diffusers/utils/dynamicmodulesutils.py, which is the actual chokepoint for every dynamic module load (local, Hub, or community mirror). All three variants now raise ValueError instead of executing untrusted code.

Workarounds

If upgrading immediately is not possible:

- Only call frompretrained with pretrainedmodelnameorpath, custompipeline, and local snapshot directories from fully trusted sources that have been audited. - Do not pass custompipeline= pointing at a Hub repository different from the primary pretrainedmodelnameorpath before reading its pipeline.py. - Before calling frompretrained on a local snapshot, inspect the snapshot for unexpected .py files, especially under component subdirectories (unet/, scheduler/, etc.) and at the snapshot root.

These are mitigations, not fixes — the only complete remediation is upgrading to 0.38.0.

Resources

- Fix: https://github.com/huggingface/diffusers/pull/13448 - Original issue: https://github.com/huggingface/diffusers/issues/13446 - Release notes: https://github.com/huggingface/diffusers/releases/tag/v0.38.0 - CWE-94: https://cwe.mitre.org/data/definitions/94.html

Other sources

Diffusers is the a library for pretrained diffusion models. Prior to 0.38.0, a trustremotecode bypass in DiffusionPipeline.frompretrained allows arbitrary remote code execution despite the user passing trustremotecode=False (or omitting it, which is the default). The vulnerability has three variants, all sharing the same root cause — the trustremotecode 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.frompretrained('repoA', custompipeline='attacker/repoB', trustremotecode=False) — the gate evaluated against repoA's file list rather than repoB's, so repoB's pipeline.py was loaded and executed. DiffusionPipeline.frompretrained('/local/snapshot', custompipeline='attacker/repoB', trustremotecode=False) — the local-path branch never invoked download(), so the gate was never reached and remote code from repoB executed. DiffusionPipeline.frompretrained('/local/snapshot', trustremotecode=False) where the snapshot contains custom component files (e.g. unet/myunetmodel.py) referenced from modelindex.json — same root cause; the local path skipped download() and custom component code executed. This vulnerability is fixed in 0.38.0.

MITRE

Affected Software

2 affected componentsFixes available
pip/diffusers<0.38.0
0.38.0
huggingface Diffusers Python<0.38.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/diffusers to a version that resolves this vulnerability.

    Fixed in 0.38.0
  2. Upgrade

    Upgrade diffusers to a version that resolves this vulnerability.

    Fixed in 0.38.0Patch PR #13448
  3. Configuration

    Before calling DiffusionPipeline.from_pretrained, do not set custom_pipeline to a Hub repository different from the primary pretrained_model_name_or_path (this prevents loading attacker-controlled pipeline.py).

    DiffusionPipeline.from_pretrained custom_pipeline = Do not pass custom_pipeline pointing at a Hub repository different from the primary pretrained_model_name_or_path before reading its pipeline.py
  4. Configuration

    Before calling DiffusionPipeline.from_pretrained on a local snapshot, inspect the snapshot for unexpected *.py files, especially under component subdirectories (e.g., unet/, scheduler/) and at the snapshot root.

    DiffusionPipeline.from_pretrained (local snapshot) snapshot contents validation = Inspect for unexpected *.py files under component subdirectories and at the snapshot root
  5. Compensating control

    Only call DiffusionPipeline.from_pretrained with pretrained_model_name_or_path, custom_pipeline, and local snapshot directories from fully trusted sources that have been audited.

Event History

May 7, 2026
Advisory Published
via GitHub·05:31 AM
Data Sourced
via GitHub·05:31 AM
DescriptionSeverityWeaknessAffected Software
May 14, 2026
CVE Published
via MITRE·04:26 PM
Data Sourced
via MITRE·04:26 PM
DescriptionSeverityWeakness
Data Sourced
via Red Hat·05:02 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·05:16 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-44513?

CVE-2026-44513 has a critical severity level due to its potential for arbitrary remote code execution.

2

How do I fix CVE-2026-44513?

To fix CVE-2026-44513, update the 'diffusers' package to version 0.38.1 or higher.

3

What is the impact of CVE-2026-44513?

CVE-2026-44513 allows attackers to execute arbitrary code remotely despite the user setting 'trust_remote_code=False'.

4

Which versions of the 'diffusers' package are affected by CVE-2026-44513?

CVE-2026-44513 affects the 'diffusers' package versions up to and including 0.38.0.

5

What variants exist for CVE-2026-44513?

CVE-2026-44513 has three variants, all stemming from the same underlying issue with remote code execution.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203
CVE-2026-44513 - Diffusers: `trust_remote_code` bypass via `custom_pipeline` and local custom components - SecAlerts