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

Inspect INC-2024-46946 in Interactive Incidents & Cases Hub

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

Mapped defensive controls

Source citation records