Documented Incident · INC-2024-46946 · Critical severity
LangChain Experimental Symbolic Math Wrapper RCE via Unsafe SymPy Evaluation
CVE-2024-46946 documented a critical arbitrary code execution vulnerability in LangChain's experimental symbolic math helper that routed LLM-generated math strings into `sympy.sympify()`. Because `sympify()` internally leverages Python's dynamic `eval()` parsing on untrusted expressions, prompt inputs could trick the agent into emitting malicious Python code strings that ran directly in the server process. Attackers could execute arbitrary OS commands and harvest host secrets with zero container isolation. Maintainers removed unsafe dynamic evaluation in favor of safer expression parsing or explicit sandboxing.
Incident dossier metadata
- Case ID
INC-2024-46946- Classification
- Incident
- Date
- Severity
- Critical
- Sector
- Software Development & AI Tooling
- Attack vector
- Tool/MCP Abuse
- System type
- LLM Agent Math & Symbolic Evaluation Plugins
- CVE / reference
CVE-2024-46946- Reference URI
https://nvd.nist.gov/vuln/detail/CVE-2024-46946
Defensive takeaway
Never pass LLM outputs into eval()-backed parsers such as unfiltered sympify(); use deterministic AST calculators or isolated WebAssembly/gVisor sandboxes.
Mapped AI security techniques
- Command and Scripting Interpreter AML.T0050
- LLM Prompt Injection: Direct AML.T0051.000
- AI Agent Tool Invocation AML.T0053
- Generate Malicious Commands AML.T0102
Mapped defensive controls
- Restrict Library Loading AML.M0011
- Enforce Access Controls for AI Agent Tools AML.M0028
- Segmentation of AI Agent Components AML.M0032
- Input and Output Validation for AI Agent Components AML.M0033
Source citation records
- NVD Record CVE-2024-46946: LangChain Experimental SymPy Unsafe Evaluation RCE · NIST National Vulnerability Database (NVD) ·