CVE-2025-5120: Smolagents Smolagents Has Sandbox Escape Vulnerability Vulnerability

CRITICAL
Advisory Identifier: GHSA-6v92-r5mx-h5fx
CVSS 9.9
CWE-94
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2025-5120
GHSA Identifier GHSA-6v92-r5mx-h5fx
Severity CRITICAL
CVSS v3.1 Base Score 9.9
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Smolagents
Package Ecosystem PyPI
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability Low (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.

smolagents fixed: 1.17.0
pip install smolagents>=1.17.0
Verify Direct and Transitive Dependencies

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

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.

CVE-2025-5120 Affected Smolagents Versions

1 component(s)
Fixed Versions:
1.17.0
Product / Package Ecosystem Affected Versions Fixed Version
smolagents
PyPI
< 1.17.0
1.17.0

References

Frequently Asked Questions

What is CVE-2025-5120?
CVE-2025-5120 is a security vulnerability in Smolagents involving smolagents has Sandbox Escape Vulnerability in the local_python_executor.py Module under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Smolagents versions are affected?
Affected versions include releases prior to 1.17.0 across affected packages: smolagents.
What version fixes CVE-2025-5120?
Upgrading to 1.17.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is smolagents affected?
Yes, smolagents is affected in releases prior to 1.17.0. Upgrade your dependency to 1.17.0 or later.
What is the CVSS score of CVE-2025-5120?
CVE-2025-5120 has a CVSS v3.1 base score of 9.9 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:H/A:L.
What CWE is associated with CVE-2025-5120?
CVE-2025-5120 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (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.).
How can I check PyPI dependencies for CVE-2025-5120?
Run the dependency tree command: 'pip show smolagents'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}