CVE-2026-44827: 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, diffusers 0.37.0 allows remote code execution without the trust_remote_code=True safeguard when loading pipelines from Hugging Face Hub repositories. The _resolve_custom_pipeline_and_cls function in pipeline_loading_utils.py performs string interpolation on the custom_pipeline parameter using f"{custom_pipeline}.py". When custom_pipeline is not supplied by the user, it defaults to None, which Python interpolates as the literal string "None.py". If an attacker publishes a Hub repository containing a file named None.py with a class that subclasses DiffusionPipeline, the file is automatically downloaded and executed during a standard DiffusionPipeline.from_pretrained() call with no additional keyword arguments. The trust_remote_code check in DiffusionPipeline.download() is bypassed because it evaluates custom_pipeline is not None as False (since the kwarg was never supplied), while the downstream code path that actually loads the module resolves the None value into a valid filename. An attacker can achieve silent arbitrary code execution by publishing a malicious model repository with a None.py file and a standard-looking model_index.json that references a legitimate pipeline class name, requiring only that a victim calls from_pretrained on the repository. This vulnerability is fixed in 0.38.0.
AI Analysis
Technical Summary
The diffusers library for pretrained diffusion models has a code injection vulnerability (CWE-94) in versions before 0.38.0. The _resolve_custom_pipeline_and_cls function uses string interpolation on the custom_pipeline parameter, which defaults to None and becomes "None.py". If an attacker publishes a repository with a malicious None.py file defining a DiffusionPipeline subclass, it is automatically loaded and executed when a user calls DiffusionPipeline.from_pretrained() without specifying custom_pipeline or trust_remote_code=True. The trust_remote_code check is bypassed because it only evaluates if custom_pipeline is not None, which is False when the parameter is omitted, but the downstream code still loads the None.py file. This leads to remote code execution. The vulnerability is resolved in diffusers version 0.38.0.
Potential Impact
An attacker can achieve remote arbitrary code execution on a victim's system by publishing a malicious model repository containing a None.py file with a DiffusionPipeline subclass. When a victim loads this repository using DiffusionPipeline.from_pretrained() without the trust_remote_code=True flag, the malicious code executes silently. This can lead to full compromise of the affected system. The CVSS v3.1 score is 8.8 (high), reflecting network attack vector, low attack complexity, no privileges required, user interaction required, and high confidentiality, integrity, and availability impacts.
Mitigation Recommendations
Upgrade the diffusers library to version 0.38.0 or later, where this vulnerability is fixed. Until upgrading, users should explicitly set trust_remote_code=True only when they trust the source of the model repository. Avoid loading pipelines from untrusted or unknown Hugging Face Hub repositories without this safeguard. Patch status is not explicitly stated in the vendor advisory, but the fix is included in version 0.38.0.
CVE-2026-44827: 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, diffusers 0.37.0 allows remote code execution without the trust_remote_code=True safeguard when loading pipelines from Hugging Face Hub repositories. The _resolve_custom_pipeline_and_cls function in pipeline_loading_utils.py performs string interpolation on the custom_pipeline parameter using f"{custom_pipeline}.py". When custom_pipeline is not supplied by the user, it defaults to None, which Python interpolates as the literal string "None.py". If an attacker publishes a Hub repository containing a file named None.py with a class that subclasses DiffusionPipeline, the file is automatically downloaded and executed during a standard DiffusionPipeline.from_pretrained() call with no additional keyword arguments. The trust_remote_code check in DiffusionPipeline.download() is bypassed because it evaluates custom_pipeline is not None as False (since the kwarg was never supplied), while the downstream code path that actually loads the module resolves the None value into a valid filename. An attacker can achieve silent arbitrary code execution by publishing a malicious model repository with a None.py file and a standard-looking model_index.json that references a legitimate pipeline class name, requiring only that a victim calls from_pretrained on the repository. 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.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The diffusers library for pretrained diffusion models has a code injection vulnerability (CWE-94) in versions before 0.38.0. The _resolve_custom_pipeline_and_cls function uses string interpolation on the custom_pipeline parameter, which defaults to None and becomes "None.py". If an attacker publishes a repository with a malicious None.py file defining a DiffusionPipeline subclass, it is automatically loaded and executed when a user calls DiffusionPipeline.from_pretrained() without specifying custom_pipeline or trust_remote_code=True. The trust_remote_code check is bypassed because it only evaluates if custom_pipeline is not None, which is False when the parameter is omitted, but the downstream code still loads the None.py file. This leads to remote code execution. The vulnerability is resolved in diffusers version 0.38.0.
Potential Impact
An attacker can achieve remote arbitrary code execution on a victim's system by publishing a malicious model repository containing a None.py file with a DiffusionPipeline subclass. When a victim loads this repository using DiffusionPipeline.from_pretrained() without the trust_remote_code=True flag, the malicious code executes silently. This can lead to full compromise of the affected system. The CVSS v3.1 score is 8.8 (high), reflecting network attack vector, low attack complexity, no privileges required, user interaction required, and high confidentiality, integrity, and availability impacts.
Mitigation Recommendations
Upgrade the diffusers library to version 0.38.0 or later, where this vulnerability is fixed. Until upgrading, users should explicitly set trust_remote_code=True only when they trust the source of the model repository. Avoid loading pipelines from untrusted or unknown Hugging Face Hub repositories without this safeguard. Patch status is not explicitly stated in the vendor advisory, but the fix is included in version 0.38.0.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-05-07T21:21:48.351Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a05fda1ec166c07b0f931e0
Added to database: 05/14/2026, 16:51:45 UTC
Last enriched: 05/14/2026, 17:06:39 UTC
Last updated: 07/31/2026, 19:22:59 UTC
Views: 102
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.
External Links
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.