CVE-2025-5120: smolagents: sandbox escape enables unauthenticated RCE
GHSA-6v92-r5mx-h5fx CRITICAL PoC AVAILABLE CISA: TRACK*Any deployment of smolagents < 1.17.0 using the Python code executor is fully compromised — CVSS 10, no auth, no user interaction required. Patch to 1.17.0 immediately; until patched, disable the local Python executor or isolate the process in a hardened container with no network egress. This is a complete security boundary failure in a widely-used HuggingFace agent framework.
Risk Assessment
Maximum severity (CVSS 10.0, S:C). Network-reachable with zero prerequisites — no credentials, no user interaction, no complexity. The Changed scope flag means successful exploitation pivots beyond the sandboxed process into the host system. Low EPSS (0.003) reflects novelty, not safety; public exploit details are available via huntr. Risk is highest for teams running smolagents in multi-tenant or internet-exposed agentic pipelines where untrusted inputs reach the code executor.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| smolagents | pip | — | No patch |
| smolagents | pip | < 1.17.0 | 1.17.0 |
Severity & Risk
Attack Surface
Recommended Action
5 steps-
PATCH
Upgrade smolagents to >= 1.17.0 immediately (pip install --upgrade smolagents).
-
VERIFY
Audit requirements.txt, pyproject.toml, and lock files across all repos and deployed environments for pinned vulnerable versions.
-
WORKAROUND (if patching is delayed): Disable LocalPythonInterpreter; use E2B or Docker-based sandboxes with seccomp/AppArmor profiles instead.
-
HARDEN
Run smolagents in a rootless container with read-only filesystem, no network egress, and dropped capabilities (--cap-drop ALL).
-
DETECT
Alert on unexpected subprocess spawns, outbound connections, or file writes from Python interpreter processes. Check for imports of os, subprocess, importlib, ctypes from agent-generated code in logs.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2025-5120?
Any deployment of smolagents < 1.17.0 using the Python code executor is fully compromised — CVSS 10, no auth, no user interaction required. Patch to 1.17.0 immediately; until patched, disable the local Python executor or isolate the process in a hardened container with no network egress. This is a complete security boundary failure in a widely-used HuggingFace agent framework.
Is CVE-2025-5120 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2025-5120, increasing the risk of exploitation.
How to fix CVE-2025-5120?
1. PATCH: Upgrade smolagents to >= 1.17.0 immediately (pip install --upgrade smolagents). 2. VERIFY: Audit requirements.txt, pyproject.toml, and lock files across all repos and deployed environments for pinned vulnerable versions. 3. WORKAROUND (if patching is delayed): Disable LocalPythonInterpreter; use E2B or Docker-based sandboxes with seccomp/AppArmor profiles instead. 4. HARDEN: Run smolagents in a rootless container with read-only filesystem, no network egress, and dropped capabilities (--cap-drop ALL). 5. DETECT: Alert on unexpected subprocess spawns, outbound connections, or file writes from Python interpreter processes. Check for imports of os, subprocess, importlib, ctypes from agent-generated code in logs.
What systems are affected by CVE-2025-5120?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, code execution sandboxes, multi-agent systems, AI coding assistants, model serving.
What is the CVSS score for CVE-2025-5120?
CVE-2025-5120 has a CVSS v3.1 base score of 10.0 (CRITICAL). The EPSS exploitation probability is 0.40%.
Technical Details
NVD Description
A sandbox escape vulnerability was identified in huggingface/smolagents version 1.14.0, allowing attackers to bypass the restricted execution environment and achieve remote code execution (RCE). The vulnerability stems from the local_python_executor.py module, which inadequately restricts Python code execution despite employing static and dynamic checks. Attackers can exploit whitelisted modules and functions to execute arbitrary code, compromising the host system. This flaw undermines the core security boundary intended to isolate untrusted code, posing risks such as unauthorized code execution, data leakage, and potential integration-level compromise. The issue is resolved in version 1.17.0.
Exploitation Scenario
An adversary sends a crafted task to a smolagents-powered coding assistant or autonomous agent exposed via API. The agent routes the task to LocalPythonInterpreter, which applies static/dynamic whitelisting checks. The attacker uses a whitelisted module (e.g., importlib, builtins manipulation, or a permitted stdlib function) as a pivot to re-import restricted modules or invoke os.system/subprocess. Once code executes outside the sandbox, the attacker establishes a reverse shell (AML.T0072), dumps environment variables for API keys and cloud credentials, and pivots to connected services — model registries, vector databases, or upstream CI/CD pipelines. In multi-tenant SaaS deployments, this leads to cross-tenant data exfiltration.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H References
Timeline
Related Vulnerabilities
CVE-2025-14931 10.0 Analysis pending
Same package: smolagents CVE-2026-2654 9.8 smolagents: SSRF allows internal network access
Same package: smolagents CVE-2026-4963 6.3 smolagents: code injection via incomplete sandbox fix
Same package: smolagents CVE-2025-11844 5.4 smolagents: security flaw enables exploitation
Same package: smolagents CVE-2025-59528 10.0 Flowise: Unauthenticated RCE via MCP config injection
Same attack type: Supply Chain
AI Threat Alert