CVE-2024-46946: LangChain Experimental Eval Injection vulnerability
langchain-experimental 0.1.17 through 0.3.0 passes text to sympy.sympify, which uses eval, inside LLMSymbolicMathChain. Whoever controls the input to the chain can run arbitrary Python on the host. The advisory lists no patched version.
Published Sep 19, 2024 · Updated Oct 27, 2026 · Analysis Nov 1, 2026
What an attacker can do
LLMSymbolicMathChain asks a model to write a math expression, pulls it out of a fenced text block, and hands it to sympy.sympify(). That function evaluates the string with Python eval() (CWE-95). A string that is not math but walks Python's object graph, through __class__, __mro__ and __subclasses__() to __builtins__, runs commands. The public proof of concept ends in os.system("id").
The advisory says an attacker who controls the chain's input can exploit it. It does not describe how that input gets there. The likely route, which the advisory does not state, is a user prompt or injected content that makes the model emit the malicious expression. The CVSS vector assumes no privileges and no user interaction over the network, so the score is critical at 9.8.
The code runs with the privileges of the Python process hosting the chain. That gives access to its environment variables, API keys, files and any network the host can reach. Any app that exposes this chain to end users, or feeds it web or document content, is at risk. The package is labelled experimental, and many apps use it in prototypes.
Who is affected
The pip package langchain-experimental, versions 0.1.17 through 0.3.0 inclusive. Only apps that use LLMSymbolicMathChain are exposed. Check the version and the usage:
pip show langchain-experimentalThen search your code for LLMSymbolicMathChain.
langchain-experimental
- Ecosystem
- PyPI
- Affected
- >= 0.1.17, <= 0.3.0
- Fixed in
- No patched version yet
- Check
pip show langchain-experimental
How to fix it
The advisory lists no patched version. The 0.3.0 release is inside the affected range. Check the langchain-experimental release notes for a newer version before relying on it.
Until a fix is confirmed, remove LLMSymbolicMathChain from any chain or agent that handles untrusted input. The reporter recommends strict input validation, a whitelist of allowed operations and symbols, or a safer evaluation method in place of sympify. Run any remaining use in a sandbox with no secrets.
How to tell if you were hit
Search your code for LLMSymbolicMathChain, SymbolicMathChain and sympify. In logs, look for model outputs in the chain that contain __class__, __subclasses__, __globals__, __builtins__, os.system or exec. Check the hosts running such apps for unexpected child processes and outbound connections from the Python process.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
langchain_experimental (aka LangChain Experimental) 0.1.17 through 0.3.0 for LangChain allows attackers to execute arbitrary code through sympy.sympify (which uses eval) in LLMSymbolicMathChain. LLMSymbolicMathChain was introduced in fcccde406dd9e9b05fc9babcbeb9ff527b0ec0c6 (2023-10-05).
Questions
- Is there a fixed version of langchain-experimental?
None is listed in the advisory. 0.1.17 through 0.3.0 are affected, and the 0.3.0 release does not fix it.
- Am I affected if I do not use LLMSymbolicMathChain?
The advisory names that chain as the vulnerable component. If your code never calls it, this flaw does not apply, though you should keep the package current.
- Does the attacker need to call sympify directly?
No. They need to control the input to the chain. The advisory does not say how; prompt injection into the model's output is the plausible path.
References
Read for this analysis:
- https://github.com/advisories/GHSA-p2qj-r53j-h3xj
- https://gist.github.com/12end/68c0c58d2564ef4141bccd4651480820#file-cve-2024-46946-txt
- https://nvd.nist.gov/vuln/detail/CVE-2024-46946
- https://docs.sympy.org/latest/modules/codegen.html
- https://github.com/langchain-ai/langchain/releases/tag/langchain-experimental%3D%3D0.3.0
- https://github.com/pypa/advisory-database/tree/main/vulns/langchain-experimental/PYSEC-2026-374.yaml
- https://pypi.org/project/langchain-experimental
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More LangChain vulnerabilities
All LangChain entriesCVE-2026-55443
LangChain: Path traversal and sandbox escape in LangChain file-search middleware and loaders
medium5.1Jun 16, 2026CVE-2026-45134
LangSmith SDK: Public prompt pull deserializes untrusted manifests without trust boundary warning
high7.1May 13, 2026CVE-2026-44843
LangChain vulnerable to unsafe deserialization of attacker-controlled objects through overly broad `load()` allowlists
high8.2May 8, 2026CVE-2026-40087
LangChain has incomplete f-string validation in prompt templates
medium5.3Apr 8, 2026CVE-2026-34070
LangChain Core has Path Traversal vulnerabilites in legacy `load_prompt` functions
high7.5Mar 27, 2026CVE-2026-27795
LangChain Community: redirect chaining can lead to SSRF bypass via RecursiveUrlLoader
medium4.1Feb 25, 2026
