CVE-2026-44513: CWE-94: Improper Control of Generation of Code ('Code Injection') in huggingface diffusers
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.
AI Analysis
Technical Summary
The vulnerability in huggingface diffusers prior to 0.38.0 allows arbitrary remote code execution via a trust_remote_code bypass in DiffusionPipeline.from_pretrained. The trust_remote_code check was incorrectly placed inside the download() method rather than at the dynamic module load site. Consequently, any code path that bypassed download() also bypassed the security check. This includes loading a custom pipeline from a different repository than the main repo, loading from a local snapshot path that skips download(), or loading custom component files referenced in model_index.json from a local snapshot. All variants share the root cause of the misplaced security gate. The vulnerability is addressed in version 0.38.0.
Potential Impact
An attacker can execute arbitrary remote code on the system using the vulnerable diffusers library by bypassing the trust_remote_code security check. This can lead to full compromise of confidentiality, integrity, and availability of the affected system. The CVSS score of 8.8 reflects high impact with network attack vector, low attack complexity, no privileges required, user interaction required, and high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
This vulnerability is fixed in diffusers version 0.38.0. Users should upgrade to version 0.38.0 or later to remediate this issue. Patch status is confirmed by the vendor advisory. No other mitigations are indicated.
CVE-2026-44513: CWE-94: Improper Control of Generation of Code ('Code Injection') in huggingface diffusers
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.
CVSS v3.1
Score 8.8high
Affected software
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
Technical Analysis
The vulnerability in huggingface diffusers prior to 0.38.0 allows arbitrary remote code execution via a trust_remote_code bypass in DiffusionPipeline.from_pretrained. The trust_remote_code check was incorrectly placed inside the download() method rather than at the dynamic module load site. Consequently, any code path that bypassed download() also bypassed the security check. This includes loading a custom pipeline from a different repository than the main repo, loading from a local snapshot path that skips download(), or loading custom component files referenced in model_index.json from a local snapshot. All variants share the root cause of the misplaced security gate. The vulnerability is addressed in version 0.38.0.
Potential Impact
An attacker can execute arbitrary remote code on the system using the vulnerable diffusers library by bypassing the trust_remote_code security check. This can lead to full compromise of confidentiality, integrity, and availability of the affected system. The CVSS score of 8.8 reflects high impact with network attack vector, low attack complexity, no privileges required, user interaction required, and high impact on confidentiality, integrity, and availability.
Mitigation Recommendations
This vulnerability is fixed in diffusers version 0.38.0. Users should upgrade to version 0.38.0 or later to remediate this issue. Patch status is confirmed by the vendor advisory. No other mitigations are indicated.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-05-06T18:28:20.887Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
- Vendor Advisory Urls
- [{"url":"https://access.redhat.com/security/cve/CVE-2026-44513","vendor":"Red Hat"}]
Threat ID: 6a05fd9fec166c07b0f93180
Added to database: 05/14/2026, 16:51:43 UTC
Last enriched: 07/23/2026, 22:05:31 UTC
Last updated: 07/31/2026, 19:22:59 UTC
Views: 104
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
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
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.