CVE-2025-5120: Smolagents Smolagents Has Sandbox Escape Vulnerability Vulnerability
CRITICALCVE-2025-5120 is a CRITICAL (CVSS 9.9) smolagents has sandbox escape vulnerability vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Smolagents libraries in the PyPI ecosystem. The issue involves smolagents has sandbox escape vulnerability in the local_python_executor.py module. Remediation is available by upgrading affected packages to version 1.17.0.
CVE-2025-5120 at a Glance
Security Impact
CVSS: 9.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:L).
How to Fix CVE-2025-5120
To remediate this vulnerability, upgrade all affected Smolagents dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install smolagents>=1.17.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show smolagents
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-5120, inspect your installed packages using pip:
pip show smolagents
Analyze the terminal output to locate any version of Smolagents in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.17.0), your application is affected.
Note: The pip show smolagents command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Smolagents, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-5120 Affected Smolagents Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
smolagents
|
PyPI |
< 1.17.0
|
1.17.0
|
References
Frequently Asked Questions
What is CVE-2025-5120?
Which Smolagents versions are affected?
What version fixes CVE-2025-5120?
Is smolagents affected?
What is the CVSS score of CVE-2025-5120?
What CWE is associated with CVE-2025-5120?
How can I check PyPI dependencies for CVE-2025-5120?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6v92-r5mx-h5fx",
"modified" : "2025-08-07T15:03:59Z",
"published" : "2025-07-27T09:30:26Z",
"aliases" : [ "CVE-2025-5120" ],
"summary" : "smolagents has Sandbox Escape Vulnerability in the local_python_executor.py Module",
"details" : "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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "smolagents"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.17.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-5120"
}, {
"type" : "WEB",
"url" : "https://github.com/huggingface/smolagents/commit/33a942e62b6fbf6a35d41f1c735bda2d64c163d0"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/huggingface/smolagents"
}, {
"type" : "WEB",
"url" : "https://huntr.com/bounties/63ab1cfe-b573-4cf5-a7d3-fb6c957e34b0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2025-07-28T14:54:22Z",
"nvd_published_at" : "2025-07-27T08:15:25Z"
}
}