CVE-2023-36188: LangChain: RCE via PALChain unsanitized Python exec
CRITICAL PoC AVAILABLE CISA: ATTENDAny application running LangChain ≤0.0.64 with PALChain exposed is fully compromised — no credentials needed, network-reachable, trivial to exploit. Patch to a fixed version immediately or disable PALChain entirely. If you can't patch now, add input validation to block code injection and restrict network access to the LangChain service.
What is the risk?
Maximum exploitability: CVSS 9.8, zero authentication required, no user interaction, low complexity. PALChain passes user-controlled input directly to Python exec(), making this a textbook code injection. Exposure is high because LangChain was the dominant LLM framework at time of disclosure and PALChain was a commonly demonstrated feature. Any internet-facing service using LangChain PALChain is at critical risk of full host compromise.
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| LangChain | pip | — | No patch |
Do you use LangChain? You're affected.
How severe is it?
What is the attack surface?
What should I do?
6 steps-
Patch: Upgrade LangChain to a version after 0.0.64 where PALChain input handling is corrected (PR #6003).
-
Workaround: Disable or remove PALChain from your application if not strictly needed.
-
Network hardening: Place LangChain services behind authentication and restrict to internal networks — this vulnerability requires no auth but network segmentation limits reachability.
-
Least privilege: Run LangChain processes with minimal OS permissions; no root, no write access to sensitive paths.
-
Detection: Monitor for unusual process spawning from Python processes, unexpected outbound connections, and anomalous exec() calls in application logs.
-
Audit: Inventory all LangChain versions in use via SCA tooling (Dependabot, Snyk, pip audit).
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2023-36188?
Any application running LangChain ≤0.0.64 with PALChain exposed is fully compromised — no credentials needed, network-reachable, trivial to exploit. Patch to a fixed version immediately or disable PALChain entirely. If you can't patch now, add input validation to block code injection and restrict network access to the LangChain service.
Is CVE-2023-36188 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2023-36188, increasing the risk of exploitation.
How to fix CVE-2023-36188?
1. Patch: Upgrade LangChain to a version after 0.0.64 where PALChain input handling is corrected (PR #6003). 2. Workaround: Disable or remove PALChain from your application if not strictly needed. 3. Network hardening: Place LangChain services behind authentication and restrict to internal networks — this vulnerability requires no auth but network segmentation limits reachability. 4. Least privilege: Run LangChain processes with minimal OS permissions; no root, no write access to sensitive paths. 5. Detection: Monitor for unusual process spawning from Python processes, unexpected outbound connections, and anomalous exec() calls in application logs. 6. Audit: Inventory all LangChain versions in use via SCA tooling (Dependabot, Snyk, pip audit).
What systems are affected by CVE-2023-36188?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, LLM application backends, RAG pipelines, chatbot infrastructure, AI-powered internal tools.
What is the CVSS score for CVE-2023-36188?
CVE-2023-36188 has a CVSS v3.1 base score of 9.8 (CRITICAL). The EPSS exploitation probability is 1.57%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0049 Exploit Public-Facing Application AML.T0050 Command and Scripting Interpreter AML.T0053 AI Agent Tool Invocation Compliance Controls Affected
What are the technical details?
Original Advisory
An issue in langchain v.0.0.64 allows a remote attacker to execute arbitrary code via the PALChain parameter in the Python exec method.
Exploitation Scenario
An adversary identifies a public-facing chatbot or internal AI assistant built on LangChain 0.0.64 using PALChain to answer math or logic questions. They craft a PALChain query containing embedded Python that exfiltrates environment variables (including OPENAI_API_KEY, database credentials, AWS keys) to an attacker-controlled endpoint. The payload is sent as a normal HTTP POST — no special access required. Within seconds, the attacker has obtained cloud credentials and API keys, pivots to exfiltrate the vector database, and establishes a reverse shell for persistence. The entire operation requires no LangChain or AI knowledge — just awareness of the exec() injection point.
Weaknesses (CWE)
CWE-74 — Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'): The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
- [Requirements] Programming languages and supporting technologies might be chosen which are not subject to these issues.
- [Implementation] Utilize an appropriate mix of allowlist and denylist parsing to filter control-plane syntax from all input.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H References
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-36258 9.8 LangChain: unauthenticated RCE via code injection
Same package: langchain