CVE-2025-5120: CWE-94 Improper Control of Generation of Code in huggingface huggingface/smolagents
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.
AI Analysis
Technical Summary
CVE-2025-5120 is a high-severity sandbox escape vulnerability found in the huggingface/smolagents library, specifically affecting version 1.14.0. The vulnerability arises from the local_python_executor.py module, which is designed to execute Python code within a restricted environment to isolate untrusted code execution. Despite implementing static and dynamic checks to limit code execution to a safe subset, the sandbox's controls are insufficient. Attackers can exploit whitelisted modules and functions to bypass these restrictions and execute arbitrary code on the host system. This improper control of code generation (CWE-94) effectively breaks the security boundary intended to prevent unauthorized code execution. The consequence is remote code execution (RCE), allowing attackers to run malicious code remotely, potentially leading to unauthorized data access, data leakage, integrity violations, and further compromise of integrated systems. The vulnerability does not require prior authentication but does require user interaction, as indicated by the CVSS vector. The issue has been addressed in version 1.17.0 of the library, and users are strongly advised to upgrade. No known exploits are currently reported in the wild, but the ease of exploitation combined with the critical nature of sandbox escapes makes this a significant threat to any environment using the affected versions of huggingface/smolagents.
Potential Impact
For European organizations, the impact of this vulnerability is substantial, especially for those leveraging huggingface/smolagents in AI, machine learning, or automation workflows. The ability to escape the sandbox and execute arbitrary code remotely can lead to severe confidentiality breaches, exposing sensitive data processed or stored within the environment. Integrity of data and systems can be compromised, potentially allowing attackers to alter or corrupt data, inject malicious payloads, or pivot to other internal systems. Availability may also be affected if attackers disrupt services or deploy ransomware. Given the increasing adoption of AI tools in sectors such as finance, healthcare, and critical infrastructure across Europe, exploitation could have cascading effects on business operations and regulatory compliance, including GDPR violations due to data leakage. The requirement for user interaction suggests phishing or social engineering could be vectors, increasing risk in environments with less stringent user training or controls.
Mitigation Recommendations
Mitigation requires immediate upgrade of huggingface/smolagents to version 1.17.0 or later, where the vulnerability is fixed. Organizations should audit their use of the local_python_executor.py module and restrict its usage to trusted code only. Implement strict input validation and sandboxing policies beyond the library’s default controls, possibly leveraging containerization or OS-level sandboxing to add defense-in-depth. Monitor logs for unusual execution patterns or attempts to invoke whitelisted modules/functions in unexpected ways. Employ network segmentation to limit exposure of systems running vulnerable versions. User training to recognize and avoid social engineering attempts that could trigger the vulnerability is critical. Additionally, organizations should maintain an inventory of AI/ML tools in use and ensure timely patch management processes are in place for such dependencies.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Italy, Spain
CVE-2025-5120: CWE-94 Improper Control of Generation of Code in huggingface huggingface/smolagents
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.
AI-Powered Analysis
Technical Analysis
CVE-2025-5120 is a high-severity sandbox escape vulnerability found in the huggingface/smolagents library, specifically affecting version 1.14.0. The vulnerability arises from the local_python_executor.py module, which is designed to execute Python code within a restricted environment to isolate untrusted code execution. Despite implementing static and dynamic checks to limit code execution to a safe subset, the sandbox's controls are insufficient. Attackers can exploit whitelisted modules and functions to bypass these restrictions and execute arbitrary code on the host system. This improper control of code generation (CWE-94) effectively breaks the security boundary intended to prevent unauthorized code execution. The consequence is remote code execution (RCE), allowing attackers to run malicious code remotely, potentially leading to unauthorized data access, data leakage, integrity violations, and further compromise of integrated systems. The vulnerability does not require prior authentication but does require user interaction, as indicated by the CVSS vector. The issue has been addressed in version 1.17.0 of the library, and users are strongly advised to upgrade. No known exploits are currently reported in the wild, but the ease of exploitation combined with the critical nature of sandbox escapes makes this a significant threat to any environment using the affected versions of huggingface/smolagents.
Potential Impact
For European organizations, the impact of this vulnerability is substantial, especially for those leveraging huggingface/smolagents in AI, machine learning, or automation workflows. The ability to escape the sandbox and execute arbitrary code remotely can lead to severe confidentiality breaches, exposing sensitive data processed or stored within the environment. Integrity of data and systems can be compromised, potentially allowing attackers to alter or corrupt data, inject malicious payloads, or pivot to other internal systems. Availability may also be affected if attackers disrupt services or deploy ransomware. Given the increasing adoption of AI tools in sectors such as finance, healthcare, and critical infrastructure across Europe, exploitation could have cascading effects on business operations and regulatory compliance, including GDPR violations due to data leakage. The requirement for user interaction suggests phishing or social engineering could be vectors, increasing risk in environments with less stringent user training or controls.
Mitigation Recommendations
Mitigation requires immediate upgrade of huggingface/smolagents to version 1.17.0 or later, where the vulnerability is fixed. Organizations should audit their use of the local_python_executor.py module and restrict its usage to trusted code only. Implement strict input validation and sandboxing policies beyond the library’s default controls, possibly leveraging containerization or OS-level sandboxing to add defense-in-depth. Monitor logs for unusual execution patterns or attempts to invoke whitelisted modules/functions in unexpected ways. Employ network segmentation to limit exposure of systems running vulnerable versions. User training to recognize and avoid social engineering attempts that could trigger the vulnerability is critical. Additionally, organizations should maintain an inventory of AI/ML tools in use and ensure timely patch management processes are in place for such dependencies.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- @huntr_ai
- Date Reserved
- 2025-05-23T16:08:54.094Z
- Cvss Version
- 3.0
- State
- PUBLISHED
Threat ID: 6885dd20ad5a09ad0070d476
Added to database: 7/27/2025, 8:02:40 AM
Last enriched: 8/4/2025, 1:07:32 AM
Last updated: 8/31/2025, 9:27:25 PM
Views: 54
Related Threats
CVE-2025-9770: SQL Injection in Campcodes Hospital Management System
MediumCVE-2025-9769: Command Injection in D-Link DI-7400G+
LowCVE-2025-9768: SQL Injection in itsourcecode Sports Management System
MediumCVE-2025-58318: CWE-306 Missing Authentication for Critical Function in Delta Electronics DIAView
MediumCVE-2025-9767: SQL Injection in itsourcecode Sports Management System
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.