smolagents code agent may import anything
HighAV-FW-014Runtime safetyFramework packNew in 2.0
What it finds
A smolagents CodeAgent is allowed to import "*" or system modules (os, subprocess, socket…) while running locally.
Why it matters
CodeAgent runs model-written Python. With these imports allowed and no remote sandbox, that code can read files, run commands and reach the network.
What an attacker could do: Model-written code gets full access to the host.
How to fix it
Allow only the modules the task needs, and use a remote sandbox executor (e2b, Docker, Modal).
Pro shows the corrected code for your exact file, step by step, and re-scans to confirm the fix. See plans
Check details
- Finding code
- SMOLAGENTS_UNRESTRICTED_IMPORTS
- How it detects
- Looks for a risky pattern, and stays quiet when a matching safeguard is present.
- Confidence
- Definite: the risky setting is written plainly in the file.
- Scans
- Agent source using the named framework (LangChain, CrewAI, AutoGen, OpenAI Agents SDK, Claude Agent SDK, computer-use tools)
- OWASP LLM Top 10
- LLM08 - Excessive Agency, LLM02 - Insecure Output Handling
- NIST AI RMF
- MG-2.2
- SOC 2
- CC6.8
Check your agent for this
Paste your agent code or MCP config. The free scan runs all 124 checks in about 10 seconds — no account needed.
Related checks
- Command injection riskAV-RUNTIME-004 · Critical
- Unsafe dynamic code executionAV-RUNTIME-005 · Critical
- Privileged or host-mounted container configurationAV-RUNTIME-007 · Critical
- SQL query built from unescaped inputAV-RUNTIME-009 · Critical
- Unsafe deserialization of untrusted dataAV-RUNTIME-010 · Critical
- Prompt injection surface detectedAV-RUNTIME-002 · High