Cyber Resilience

CVE-2025-5120

CriticalPublic PoCRCE

Published: 27 July 2025

Published
27 July 2025
Modified
07 August 2025
KEV Added
Patch
CVSS Score v3.1 10.0 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
EPSS Score 0.0187 83.5th percentile
Risk Priority 21 60% EPSS · 20% KEV · 20% CVSS

Summary

CVE-2025-5120 is a critical-severity Code Injection (CWE-94) vulnerability in Huggingface Smolagents. Its CVSS base score is 10.0 (Critical).

Operationally, exploitation aligns with the MITRE ATT&CK technique Python (T1059.006); ranked in the top 16.5% of CVEs by exploit likelihood; it is not currently listed in the CISA KEV catalog; a public proof-of-concept is referenced.

This vulnerability is AI-related — categorised as AI Agent Protocols and Integrations; in the LLM/Generative AI Risks risk domain.

The strongest mitigations our analysis identified are NIST 800-53 AC-25 (Reference Monitor) and SC-18 (Mobile Code).

Deeper analysis

A sandbox escape vulnerability was identified in huggingface/smolagents version 1.14.0, specifically in the local_python_executor.py module. The component employs static and dynamic checks to restrict Python execution but fails to prevent use of whitelisted modules and functions, enabling attackers to bypass the sandbox and achieve remote code execution. The flaw carries a CVSS score of 10.0 and is tracked under CWE-94; it was fixed in version 1.17.0.

An unauthenticated attacker with network access can supply crafted code that abuses permitted imports and calls to escape the restricted environment, resulting in arbitrary command execution on the host, data exfiltration, or broader compromise of any system integrating the library. The attack requires no user interaction and breaks the core isolation boundary intended for untrusted agent-generated code.

The issue is addressed by the patch at commit 33a942e62b6fbf6a35d41f1c735bda2d64c163d0, with further details available in the associated huntr.com bounty report. The EPSS score has remained flat at 0.0187 since disclosure, indicating limited observed exploitation interest to date. The affected library is an AI agent framework, making the sandbox bypass particularly relevant to deployments that execute model-generated Python in shared or production environments.

EU & UK References

Vulnerability 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…

more

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.

CWE(s)

AI Security AnalysisAI

AI Category
AI Agent Protocols and Integrations
Risk Domain
LLM/Generative AI Risks
OWASP Top 10 for LLMs 2025
None mapped
Classification Reason
Matched keywords: huggingface

Related Threats

MITRE ATT&CK Enterprise TechniquesAI

T1059.006 Python Execution
Adversaries may abuse Python commands and scripts for execution.
T1211 Exploitation for Stealth Stealth
Adversaries may exploit vulnerabilities to evade detection by hiding activity, suppressing logging, or operating within trusted or unmonitored components.
Why these techniques?

The vulnerability enables attackers to bypass Python sandbox restrictions using whitelisted modules for arbitrary remote code execution, facilitating Python interpreter abuse (T1059.006) and exploitation to evade sandbox defenses (T1211).

CVEs Like This One

CVE-2026-4963Same product: Huggingface Smolagents
CVE-2026-2654Same product: Huggingface Smolagents
CVE-2026-44513Same vendor: Huggingface
CVE-2026-44827Same vendor: Huggingface
CVE-2026-23523Shared CWE-94
CVE-2024-12471Shared CWE-94
CVE-2025-51482Shared CWE-94
CVE-2025-67744Shared CWE-94
CVE-2026-22807Shared CWE-94
CVE-2026-5241Same vendor: Huggingface

Affected Assets

huggingface
smolagents
1.14.0

Mitigating Controls

Mitigating Controls (NIST 800-53 r5) AI

prevent

Requires confinement of mobile code, such as untrusted Python agent code, to approved execution domains, directly preventing sandbox escape and arbitrary code execution.

prevent

Mandates software-enforced separation and policy enforcement, addressing the inadequate static and dynamic checks in the local_python_executor.py module.

prevent

Implements a tamperproof reference monitor mediating all resource accesses, mitigating bypass of whitelisted modules and functions for RCE.

References