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

CVE-2023-44467: langchain_experimental vulnerable to arbitrary code execution via PALChain in the python exec method

criticalCVSS 3.1 9.8GHSA-gjjr-63x4-v8cq

langchain-experimental through 0.0.14 lets an attacker run arbitrary Python through PALChain. The filter added for CVE-2023-36258 does not block __import__ in generated code, so a crafted prompt can make the chain execute attacker code on the host. The advisory data lists no patched version for the package.

Published Oct 9, 2023 · Updated Feb 24, 2025 · Analysis Nov 2, 2026

What an attacker can do

PALChain (Program-Aided Language) asks an LLM to write Python for a question, then runs that code with exec. After CVE-2023-36258, pal_chain/base.py screened the generated code against a list of forbidden keywords. This flaw is a bypass: __import__ is not on that list, so generated code can import os or subprocess without using the blocked import statement.

The attacker's route is prompt injection. Anyone who can influence the question or the text that reaches the model can steer it to emit code that calls __import__ and runs commands. The CVSS 3.1 vector (AV:N, AC:L, PR:N, UI:N) rates this critical, with full confidentiality, integrity and availability impact. In practice the attacker gets code execution as the account that runs the application, with access to its environment variables, API keys, files and network.

The linked fix, pull request 11233, is titled fix code injection vuln. It adds one more keyword to the filtering list and was merged on September 29, 2023 as commit 4c97a10. A keyword blocklist is a weak defense, so related bypasses are plausible.

Who is affected

The pip package langchain-experimental at 0.0.14 and earlier, per the package data. The NVD text frames it as LangChain before 0.0.306. Only applications that use PALChain, or chains built on it, with input from untrusted users are exposed. Check:

pip show langchain-experimental

Search your code for PALChain and from_math_prompt or from_colored_object_prompt.

langchain-experimental

Ecosystem
PyPI
Affected
<= 0.0.14
Fixed in
No patched version yet
Check
pip show langchain-experimental

How to fix it

The advisory data lists no patched version for langchain-experimental, so this entry cannot name a release that is confirmed fixed. The fix commit is 4c97a10, which extends the keyword filter. Check the package release notes to see which release contains it before you rely on it.

The sources give no other mitigation. Reasonable steps, which are my suggestion and not from the advisory: stop exposing PALChain to untrusted input, or run it only inside a sandbox such as a container with no secrets and no network.

How to tell if you were hit

Review application logs and stored LLM outputs for generated code that contains __import__, os.system, subprocess or similar calls. On the host, look for unexpected child processes spawned by the Python service that runs the chain, outbound connections it should not make, and new files in its working directory.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

langchain_experimental (aka LangChain Experimental) in LangChain before 0.0.306 allows an attacker to bypass the CVE-2023-36258 fix and execute arbitrary code via __import__ in Python code, which is not prohibited by pal_chain/base.py.

Questions

Is there a patched version?

The advisory data does not list one for langchain-experimental. The fix commit 4c97a10 was merged on September 29, 2023, but the page names no release. Confirm in the release notes.

How does this relate to CVE-2023-36258?

This is a bypass of that earlier fix. The keyword filter added for CVE-2023-36258 did not cover __import__.

Does the attacker need to log in?

The vector needs no privileges and no user interaction. What matters is whether untrusted text can reach the prompt that PALChain turns into code.

Is it exploited in the wild?

The sources do not say so. The entry has no CISA catalog data.

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