A trio of high‑severity bugs in Hugging Face’s Diffusers library could allow an attacker to run arbitrary code when loading a model repository, undermining the library’s trust_remote_code safeguard.
The library, widely used for generating images, text, and audio, relies on trust_remote_code to prevent unreviewed code from executing. The new vulnerabilities bypass this mechanism.
According to the library maintainers, the flaws stem from improper validation of custom components defined in a model’s configuration file.
An attacker can craft a malicious repository that includes a malicious Python module, which the library will import during loading, giving the attacker full control over the host machine.
The impact is significant: any system that pulls a model from an untrusted source could be exposed to code execution, potentially compromising data, credentials, and the integrity of the environment.
The maintainers have released a patch that hardens the validation logic and disables remote code imports by default. They urge users to upgrade to the latest version immediately.
The library’s maintainers recommend reviewing the release notes and updating all deployments that use Diffusers for image generation or other tasks.
Security researchers note that the vulnerabilities highlight the broader risk of supply‑chain attacks in machine‑learning workflows, where model code can be injected unnoticed.
The maintainers are working with the community to audit other libraries that rely on similar trust mechanisms.
Users can also enforce stricter policies by disabling trust_remote_code entirely or by using curated repositories that have been vetted.