CVE-2024-27444: LangChain Experimental vulnerable to arbitrary code execution
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-experimentalSearch 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 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
