Critical RCE Bug in Unsloth Studio Allowed Code Execution via Untrusted Models

Unsloth Studio, a browser-based interface for fine-tuning and quantizing large language models, contained a critical remote code execution (RCE) vulnerability that has now been patched. The flaw made it possible for malicious model repositories hosted on Hugging Face to run arbitrary Python code simply when selected in the Studio UI. Users are urged to update to version 2026.6.9 immediately to close the gap.

What Happened

Studio, the beta component of Unsloth, includes a backend process that inspects model metadata before loading weights or performing inference. That workflow relied on setting trust_remote_code=True by default. This configuration allows a model repository to define custom Python files alongside model assets and configuration. When the associated config.json uses an auto_map field to reference those local modules, the Transformers library may import and execute them automatically.

In vulnerable versions of Studio, this check took place during metadata inspection alone—just clicking on a model in the browser interface before any model loading or training could trigger code execution in the backend process. Because the default logic trusted remote code, an attacker could craft a repository with an intentionally malicious config.json, get a user to select it in Studio, and take over execution with those user permissions.

Potential Damage and Exposure

Since execution occurred under the same privileges as the user running Studio, harmful outcomes could include leakage of sensitive credentials like Hugging Face tokens, cloud deployment keys, SSH keys, or access to proprietary datasets, model outputs, and training artifacts. Attackers might also modify local model files, persist malicious changes, or use available permissions to move laterally within systems.

The problematic code was not restricted to experimental or prerelease branches—it was baked directly into the standard, pip-installable Unsloth package. To exploit the vulnerability, a target simply needed to run Studio and select a compromised model. No other user actions—such as loading the model’s weights or approving remote code execution—were necessary.

Fix and Mitigations

The flaw was privately reported to Unsloth in early June 2026 by security researchers and addressed on June 18 with the release of version 2026.6.9. That update closes off the vulnerable paths for both Hugging Face models and local directories. Because Studio was in beta at the time, the maintainers decided not to issue a formal advisory or assign a CVE.

Users and security teams should upgrade to v2026.6.9 or newer. Additionally, any use of trust_remote_code=True should be treated as executing untrusted software—not just an innocuous model-loading parameter. Best practices include pinning models to known revisions, isolating model loading in secure environments, and preventing long-lived credentials from being exposed through model workflows.

Why This Matters: Many AI developers use Unsloth Studio for model handling, and Hugging Face serves as a central hub for model sharing. With Unsloth being the third-largest source of derivative models on the Hub, behind Qwen and Google, the potential attack surface was broad. This flaw underscores the risks emerging at the intersection of ease-of-use tools and implicit trust in shared AI assets.

From here, organizations should validate trust boundaries around AI tooling. This means auditing any default security settings, scrutinizing remote code execution features in model platforms, and ensuring user workflows do not accidentally expose infrastructure to unvetted code. Monitoring for future similar patterns will be essential.