CVE-2025-5120: smolagents Sandbox Escape Vulnerability in local_python_executor.py Module
Summary
CVE-2025-5120: smolagents has Sandbox Escape Vulnerability in the local_python_executor.py Module. Affects smolagents versions < 1.17.0. Fixed in 1.17.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
smolagents is a Python package designed for executing and managing agents in a controlled environment. It allows users to run Python code safely, leveraging a sandbox to isolate untrusted code execution. However, this package has been found to have a significant vulnerability that compromises its intended security features.
Vulnerability Detail
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.
How To Fix
Minimum fixed version
1.17.0
This is the first release that contains the fix.
pip install --upgrade "smolagents==1.17.0"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, avoid using the affected version (1.14.0) and refrain from executing untrusted code until the package is updated. Additionally, consider using alternative methods for executing untrusted code that provide stronger isolation.
Conclusion
The smolagents package has a critical vulnerability that allows for sandbox escape and remote code execution. It is essential for users to update to the latest version to mitigate risks. Utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.
See every vulnerability recorded for smolagents →
FAQ
CVE-2025-5120 is a vulnerability in the smolagents package that allows for sandbox escape, enabling remote code execution.
The vulnerability affects smolagents version 1.14.0. It is resolved in version 1.17.0 and later.
The risks include unauthorized code execution, data leakage, and potential compromise of the host system.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.
The CVSS score of this vulnerability is 7.6, indicating a high severity level.
Related vulnerabilities
Recent vulnerabilities recorded for smolagents.