NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · LangChain

CVE-2024-46946: LangChain Experimental Eval Injection vulnerability

criticalCVSS 4.0 9.3 · 3.1 9.8GHSA-p2qj-r53j-h3xj

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-experimental

Then 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

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 entries