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

CVE-2024-38459: langchain_experimental Code Execution via Python REPL access

highCVSS 3.1 7.8GHSA-wmvm-9vqv-5qpp

langchain-experimental before 0.0.61 ships agents that use a Python REPL tool under the hood without asking the developer to opt in. Prompts that reach those agents can execute Python on the host. This is an incomplete fix for CVE-2024-27444. Upgrade to langchain-experimental 0.0.61, which requires an explicit opt-in.

Published Jun 16, 2024 · Updated Jul 5, 2024 · Analysis Nov 1, 2026

What an attacker can do

Some agents in langchain_experimental hand model output to a Python REPL. The earlier fix for CVE-2024-27444 did not make this obvious to developers, so an application could include such an agent with no sign that arbitrary code execution was in play. The advisory classes the cause as incorrect default permissions (CWE-276).

What an attacker needs depends on the application. If text they control reaches the agent, through a chat box, a document the agent reads or tool output, they can steer the model into writing Python that the REPL runs. The code then runs as the application's user, with access to files, environment variables and the network. The CVSS 3.1 vector is local with user interaction, which is how NVD scored a library-level flaw. In real deployments the exposure is whichever app wires untrusted text into one of these agents.

Who is affected

Affected: langchain-experimental < 0.0.61. You are exposed only if your code uses one of the experimental agents that rely on the Python REPL tool and its input can be influenced by outsiders. The sources do not list the agent classes. Check the version and search your code for imports from langchain_experimental:

pip show langchain-experimental

langchain-experimental

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

How to fix it

Upgrade to langchain-experimental 0.0.61.

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

Pull request 22860 is marked a major, breaking change: users must now opt in explicitly to code that relies on the Python REPL. Expect code that used those agents to fail until you opt in. Do that only for agents whose inputs you fully control. The sources do not name the flag, so read the release notes of 0.0.61 for it.

How to tell if you were hit

Find where your application imports agents or tools from langchain_experimental that run Python. Review logs of agent runs for generated code that touches os, subprocess, socket or files outside the task. Look for child processes and outbound connections from the application. After the upgrade, an error that asks for an opt-in marks code that was running the REPL implicitly.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

langchain_experimental (aka LangChain Experimental) before 0.0.61 for LangChain provides Python REPL access without an opt-in step. NOTE; this issue exists because of an incomplete fix for CVE-2024-27444.

Questions

How does CVE-2024-38459 relate to CVE-2024-27444?

The advisory says it exists because of an incomplete fix for CVE-2024-27444. The second change forces an explicit opt-in to REPL-based code.

Will my agents break after upgrading to 0.0.61?

They may. The pull request is tagged major because developers now have to opt in to code that depends on the Python REPL.

Is the plain langchain package affected?

The advisory is about the separate langchain-experimental package only.

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