CVE-2023-36095
Critical · 9.8CVSS
9.8
EPSS
1.2%
Published
Aug 5, 2023
CISA due date
—
Cloudanix analysis
A popular AI programming library lets attackers run their own programs on your servers by sending specially crafted questions to certain math and object features.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Library
- Class
- RCE
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Remote code execution through unsanitized user input passed to Python exec calls inside PALChain.from_math_prompt and from_colored_object_prompt.
Why it matters to the business
Attackers can run arbitrary code on any server or application that loads the vulnerable library version, leading to data theft, system takeover, or ransomware deployment; the issue remains unpatched in the listed fixed versions and has been publicly exploitable for over three years.
How an attack unfolds
An attacker supplies a malicious prompt to any application using PALChain math or colored-object templates; the prompt reaches the exec call, which evaluates attacker-controlled Python code and returns its output or side effects to the attacker.
How to fix it
Remove or disable PALChain usage until the library is updated to a version that no longer invokes exec on untrusted input; monitor upstream LangChain releases for a corrective patch and apply it immediately once available.
How to confirm the fix worked
Audit source code and dependency manifests for direct or transitive use of langchain.chains.pal_chain; attempt to invoke the affected prompt constructors with a benign test expression and verify that arbitrary code is rejected.
Typical attack path
- Identify an application exposing LangChain PALChain functionality over a network endpoint
- Craft a prompt containing Python statements that achieve the desired effect (reverse shell, file write, etc.)
- Submit the prompt via the from_math_prompt or from_colored_object_prompt entry points
- Receive execution results or confirm side effects on the target host
How to detect it
Search application and web-server logs for requests that reach PALChain prompt constructors; inspect process creation or Python exec events that originate from langchain code paths after prompt processing.
What your security team should do
- Treat the component as high-risk RCE and restrict its exposure until a fix is confirmed
- Scan all repositories and deployed containers for the vulnerable langchain version
- Implement input validation or sandboxing around any remaining use of prompt-driven code execution
- Add runtime monitoring for unexpected Python execution originating from the PALChain module
The record
An issue in Harrison Chase langchain v.0.0.194 allows an attacker to execute arbitrary code via the python exec calls in the PALChain, affected functions include from_math_prompt and from_colored_object_prompt.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| PyPI | langchain | 0 | 0.0.236 |
Related vulnerabilities
- CVE-2026-45134 LangSmith Client SDKs provide SDK's for interacting with the LangSmith platform. Also affects langchain
- GHSA-3644-q5cj-c5c7 LangSmith SDK: Public prompt pull deserializes untrusted manifests without trust boundary… Also affects langchain
- CVE-2024-7042 @langchain/community SQL Injection vulnerability Also affects langchain
- CVE-2024-8309 Langchain SQL Injection vulnerability Also affects langchain
- CVE-2024-5998 LangChain pickle deserialization of untrusted data Also affects langchain
- CVE-2024-2965 A Denial-of-Service (DoS) vulnerability exists in the `SitemapLoader` class of the… Also affects langchain
- CVE-2026-63378 TAKO AI Agent for Okta is a local-first AI agent that helps Okta administrators query… CWE-94
- CVE-2026-63346 Refitter is a tool for generating a C# REST API client using the Refit library. CWE-94