Incident report
LangChain PythonAstREPLTool Sandbox Escape via Object Attribute Traversal
CVE-2023-44467 bypassed AST-level function allowlists in LangChain Experimental's `PythonAstREPLTool` (`<= 0.0.305`). By traversing standard Python dunder attributes such as `__subclasses__` or `__globals__` inside AST-checked expressions, prompt-injected scripts recovered restricted modules (`os`, `subprocess`) and executed arbitrary host commands. This demonstrated why in-process Python AST filtering cannot act as a security boundary against arbitrary code execution. Maintainers added attribute checks and moved interpreter execution toward explicit sandboxing.
Incident record
- Reported
- Severity
- Critical
- Vector
- Tool/MCP Abuse
- Affected system type
- Python REPL & Code-Interpreter Agent Tools
- Reference
CVE-2023-44467- Reference URI
https://nvd.nist.gov/vuln/detail/CVE-2023-44467
Defensive lesson
Do not rely on Python AST filters or dunder-blocklists as an isolation boundary; run model-generated Python exclusively in OS-level sandboxes.
Referenced techniques
- Command and Scripting Interpreter AML.T0050
- AI Agent Tool Invocation AML.T0053
- Virtualization/Sandbox Evasion AML.T0097
- Escape to Host AML.T0105