CVE-2026-45804: CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition in huggingface diffusers
Diffusers is the a library for pretrained diffusion models. Prior to 0.38.0, Diffusers' DiffusionPipeline.from_pretrained flow can bypass the trust_remote_code guard because download() validates model_index.json and custom pipeline code before later loading from a cached folder that can change, allowing a Hub repository with custom .py pipeline code to execute through the custom pipeline flow without passing custom_pipeline or trust_remote_code=True. This issue is fixed in version 0.38.0.
AI Analysis
Technical Summary
The vulnerability in huggingface diffusers (CVE-2026-45804) is a time-of-check to time-of-use (TOCTOU) race condition in the DiffusionPipeline.from_pretrained flow. The download() function validates model_index.json and custom pipeline code before loading from a cached folder that can be changed, enabling a malicious Hub repository with custom .py pipeline code to execute without requiring the custom_pipeline or trust_remote_code=True flags. This allows unauthorized code execution through the custom pipeline flow. The issue is resolved in version 0.38.0.
Potential Impact
An attacker controlling a Hub repository can execute arbitrary Python code through the custom pipeline mechanism without explicit user consent (i.e., without setting trust_remote_code=True). This leads to high confidentiality, integrity, and availability impacts as indicated by the CVSS score of 7.5.
Mitigation Recommendations
Upgrade huggingface diffusers to version 0.38.0 or later, where this vulnerability is fixed. No other official remediation or temporary fixes are indicated. Users should avoid using affected versions prior to 0.38.0 to prevent exploitation.
CVE-2026-45804: CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition in huggingface diffusers
Description
Diffusers is the a library for pretrained diffusion models. Prior to 0.38.0, Diffusers' DiffusionPipeline.from_pretrained flow can bypass the trust_remote_code guard because download() validates model_index.json and custom pipeline code before later loading from a cached folder that can change, allowing a Hub repository with custom .py pipeline code to execute through the custom pipeline flow without passing custom_pipeline or trust_remote_code=True. This issue is fixed in version 0.38.0.
CVSS v3.1
Score 7.5high
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 vulnerability in huggingface diffusers (CVE-2026-45804) is a time-of-check to time-of-use (TOCTOU) race condition in the DiffusionPipeline.from_pretrained flow. The download() function validates model_index.json and custom pipeline code before loading from a cached folder that can be changed, enabling a malicious Hub repository with custom .py pipeline code to execute without requiring the custom_pipeline or trust_remote_code=True flags. This allows unauthorized code execution through the custom pipeline flow. The issue is resolved in version 0.38.0.
Potential Impact
An attacker controlling a Hub repository can execute arbitrary Python code through the custom pipeline mechanism without explicit user consent (i.e., without setting trust_remote_code=True). This leads to high confidentiality, integrity, and availability impacts as indicated by the CVSS score of 7.5.
Mitigation Recommendations
Upgrade huggingface diffusers to version 0.38.0 or later, where this vulnerability is fixed. No other official remediation or temporary fixes are indicated. Users should avoid using affected versions prior to 0.38.0 to prevent exploitation.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-05-13T08:19:32.604Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a57b64168715ace430b3837
Added to database: 07/15/2026, 16:33:05 UTC
Last enriched: 07/15/2026, 16:48:13 UTC
Last updated: 07/16/2026, 03:34:04 UTC
Views: 7
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.