Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-93348 Overview
CVE-2026-93348 is a code injection vulnerability [CWE-94] in Unsloth Zoo, an open-source library used by the Unsloth training and inference framework for large language models. The flaw resides in the get_transformers_model_type() function in hf_utils.py, which collects model_type values from nested model configurations without enforcing a character allowlist. A malicious config.json shipped with a Hugging Face model can embed a newline in a nested model_type value, terminate the generated import statement, and inject arbitrary Python source that is later executed by exec() inside unsloth_compile_transformers(). Loading the model for training or inference triggers remote code execution as the loading user.
Critical Impact
Loading a crafted model in Unsloth executes attacker-controlled Python with the privileges of the loading process, enabling data theft, credential exfiltration, and lateral movement across MLOps environments.
Affected Products
- Unsloth Zoo versions 2025.9.9 up to but not including 2026.8.14
- Unsloth 2025.9.9 through 2026.8.19 (as it depends on the vulnerable Unsloth Zoo range)
- Any downstream training or inference pipeline loading third-party Hugging Face models through Unsloth
Discovery Timeline
- 2026-09-28 - CVE-2026-93348 published to NVD
- 2026-09-30 - Last updated in NVD database
Technical Details for CVE-2026-93348
Vulnerability Analysis
Unsloth Zoo compiles Hugging Face transformer models at load time. During compilation, get_transformers_model_type() walks the config.json object and gathers every model_type string it finds, including those in nested auto_map and sub-config entries. These values are concatenated into a dynamically generated Python module string that includes import statements for each model type. The resulting source is then handed to exec() inside unsloth_compile_transformers().
Because the collector does not restrict model_type to a safe character set, a newline character embedded in a nested value ends the generated import line and lets the attacker append arbitrary Python statements. Those statements are compiled and executed in the same process as the model loader, giving the attacker the full privileges of the training or inference job.
Root Cause
The root cause is missing input validation on strings that are later interpolated into executable Python source. The function trusts fields from an untrusted config.json, performs only cosmetic normalization, and never enforces an allowlist such as [A-Za-z0-9_]. This pattern maps directly to CWE-94: Improper Control of Generation of Code.
Attack Vector
An attacker publishes a malicious model repository, for example on a public model hub, or convinces a victim to load a local model directory. The victim invokes an Unsloth API such as FastLanguageModel.from_pretrained() against the model. Unsloth Zoo parses config.json, ingests the nested model_type value containing embedded newlines and Python code, generates the import module, and calls exec(). The injected payload runs as the loading user with access to secrets, model weights, cloud credentials, and any GPU-attached workloads.
# Patch reference from pyproject.toml (Unsloth)
huggingfacenotorch = [
- "unsloth_zoo>=2026.8.13",
+ "unsloth_zoo>=2026.8.15",
"wheel>=0.42.0",
"packaging",
"numpy",
Source: GitHub Commit 92ee020. The patch pins Unsloth to a fixed Unsloth Zoo release that enforces the character allowlist.
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2026-93348
Indicators of Compromise
- config.json files where any model_type field, including entries under auto_map or nested sub-configs, contains newline characters, semicolons, parentheses, or non-identifier characters.
- Python processes spawned from a training or inference job that unexpectedly invoke os.system, subprocess.Popen, socket, or outbound network connections shortly after model load.
- Unexplained file writes under home directories, SSH key paths, or cloud credential locations by Python interpreters running Unsloth workloads.
Detection Strategies
- Statically scan every Hugging Face model repository before use, rejecting any config.json whose model_type strings do not match ^[A-Za-z0-9_]+$.
- Instrument Python model-loading services to log calls to exec(), compile(), and subprocess creation, and alert on execution originating from unsloth_zoo.hf_utils.
- Monitor process trees for MLOps runners spawning shells or network utilities as children of Python training jobs.
Monitoring Recommendations
- Forward process, file, and network telemetry from GPU training nodes and inference servers to a centralized analytics pipeline for correlation.
- Baseline outbound egress from model-loading hosts and alert on new destinations, particularly during the first minutes after a model is fetched.
- Track versions of unsloth and unsloth_zoo deployed across environments to identify hosts still running vulnerable ranges.
How to Mitigate CVE-2026-93348
Immediate Actions Required
- Upgrade unsloth_zoo to 2026.8.14 or later, and Unsloth to a release depending on unsloth_zoo>=2026.8.15.
- Audit all models pulled from public hubs since September 2025 and inspect their config.json for suspicious model_type entries.
- Restrict model loading to a curated internal registry and block direct pulls from untrusted repositories.
Patch Information
The fix landed in Unsloth Zoo through Pull Request #1083 and Pull Request #1108, which enforce a character allowlist on model_type values before they are interpolated into generated Python source. Unsloth was updated in commit 92ee020 to require the patched Unsloth Zoo. Additional context is available in the VulnCheck Code Injection Advisory.
Workarounds
- Run model-loading workloads inside sandboxed containers with no persistent secrets, minimal outbound network access, and non-root users.
- Pre-validate config.json on ingest and reject any file whose model_type fields fail a strict identifier regex.
- Pin dependencies with a lockfile so vulnerable ranges of unsloth and unsloth_zoo cannot be reintroduced by transitive upgrades.
# Upgrade to a fixed release
pip install --upgrade "unsloth_zoo>=2026.8.15"
pip install --upgrade "unsloth>=2026.8.20"
# Verify installed versions
python -c "import unsloth_zoo, unsloth; print(unsloth_zoo.__version__, unsloth.__version__)"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

