Cloudanix VulnDB

CVE-2023-36095

Critical · 9.8

CVSS

9.8

EPSS

1.2%

Published

Aug 5, 2023

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

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.

Exploit Available
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

  1. Identify an application exposing LangChain PALChain functionality over a network endpoint
  2. Craft a prompt containing Python statements that achieve the desired effect (reverse shell, file write, etc.)
  3. Submit the prompt via the from_math_prompt or from_colored_object_prompt entry points
  4. 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