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

CVE-2024-27444: LangChain Experimental vulnerable to arbitrary code execution

criticalCVSS 4.0 9.3 · 3.1 9.8GHSA-v8vj-cv27-hjv8

langchain-experimental before 0.0.52 lets an attacker run arbitrary Python through the PAL chain, bypassing the earlier fix for CVE-2023-44467. The code validator in pal_chain/base.py did not block dunder attributes such as __subclasses__ and __globals__. Upgrade to langchain-experimental 0.0.52.

Published Feb 26, 2024 · Updated Oct 27, 2026 · Analysis Nov 2, 2026

What an attacker can do

The PAL (program-aided language) chain asks a model to write Python, checks it with validate_code, then runs it. The check after the CVE-2023-44467 fix blocked certain function calls but not attribute access. Python lets code walk from an object to its class, its base classes and the interpreter's globals using __class__-style attributes. The advisory lists __import__, __subclasses__, __builtins__, __globals__, __getattribute__, __bases__, __mro__ and __base__ as the ones that were not prohibited. Code using them can reach os or subprocess and run commands.

The attacker only needs to influence the model's generated code. In an app that feeds user text into a PAL chain, a crafted prompt can do that. The CVSS vector is network, no privileges, no interaction. The result is code execution as the app's user. That exposes API keys, environment variables, files and anything reachable from the host.

Who is affected

langchain-experimental below 0.0.52. The advisory says it ships as part of LangChain before 0.1.8. Apps that use the PAL chain (pal_chain) with user-controlled prompts are the main exposure.

Check the installed version:

pip show langchain-experimental

Search your code for use of the chain:

grep -rn PALChain .

langchain-experimental

Ecosystem
PyPI
Affected
< 0.0.52
Fixed in
0.0.52
Check
pip show langchain-experimental

How to fix it

Upgrade to langchain-experimental 0.0.52:

pip install --upgrade "langchain-experimental>=0.0.52"

The fix commit adds a COMMAND_EXECUTION_ATTRIBUTES list with the eight attributes above. While walking the code's AST, validate_code now raises a ValueError ("Found illegal command execution function") for any attribute in that list, unless allow_command_exec is set. Do not enable allow_command_exec for untrusted input. The sources give no other workaround.

How to tell if you were hit

In logs, look for ValueError messages that contain "Found illegal command execution function". They show blocked attempts on patched versions. On unpatched hosts, review prompts and generated code for the strings __subclasses__, __globals__, __builtins__, __mro__ or __import__. Also look for child processes, new files or outbound connections from the Python worker shortly after a chain run.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

langchain_experimental (aka LangChain Experimental) before 0.0.52, part of LangChain before 0.1.8, allows an attacker to bypass the CVE-2023-44467 fix and execute arbitrary code via the __import__, __subclasses__, __builtins__, __globals__, __getattribute__, __bases__, __mro__, or __base__ attribute in Python code. These are not prohibited by pal_chain/base.py.

Questions

Is this a bypass of an earlier fix?

Yes. The advisory says it bypasses the CVE-2023-44467 fix. That fix did not prohibit these dunder attributes in pal_chain/base.py.

Does it need authentication?

No. The CVSS vector sets privileges required and user interaction to none. It depends on whether untrusted text can reach a PAL chain.

Which version fixes CVE-2024-27444?

langchain-experimental 0.0.52. Versions below it are vulnerable.

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