TOCTOU trust bypass RCE in Hugging Face Diffusers DiffusionPipeline.from_pretrained
CVE-2026-45804 is a race condition and time-of-check to time-of-use vulnerability in Hugging Face Diffusers prior to version 0.38.0. In the vulnerable DiffusionPipeline.from_pretrained loading flow, the library performs trust validation on repository configuration during an initial download step and later performs a separate repository snapshot retrieval and dynamic loading step. Because these operations are split across sequential, non-atomic requests, the repository content used at load time can differ from the content that was originally validated. An attacker controlling a Hugging Face Hub model repository can modify the configuration after the initial validation request completes but before the subsequent snapshot retrieval occurs, causing the loader to resolve and execute custom pipeline Python code without requiring the caller to pass custom_pipeline or trust_remote_code=True. The flaw affects the custom pipeline loading path and bypasses the intended trust_remote_code safeguard.
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
What an attacker gets, and what they’ve been doing with it.
Successful exploitation can result in silent arbitrary code execution in the context of the process loading the model. This can provide an attacker with initial access to developer workstations, CI/CD runners, inference environments, containerized workloads, or other production systems that automatically fetch and load affected model repositories. Depending on the privileges of the hosting process, impact can include execution of attacker-controlled code, theft of credentials or tokens available to the process, tampering with model-loading workflows, persistence within the environment, and follow-on lateral movement.
If you can’t patch tonight, do this now.
Until patched versions are deployed, reduce exposure by pinning the revision parameter to a specific commit hash when calling DiffusionPipeline.from_pretrained so both fetches resolve to the same repository state. Use only trusted and audited model repositories and custom pipeline sources, and review repository contents before loading. Avoid loading untrusted remote repositories in sensitive environments. Cached downloads may reduce exploitability in some cases, but this is not a dependable security control.
Patch, then assume compromise.
Upgrade Diffusers to version 0.38.0 or later. The fix relocates the security checks to the dynamic-module loading step so that trust enforcement applies at the point where executable custom pipeline code is actually resolved and loaded, closing the identified bypass in the vulnerable two-step flow.
No public exploits tracked yet. Mallory keeps watching.
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
3 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.