CVE-2023-36258
LangChain vulnerability analysis and mitigation

Overview

An issue in LangChain before version 0.0.236 allows an attacker to execute arbitrary code because Python code with os.system, exec, or eval can be used. The vulnerability was discovered in June 2023 and was assigned CVE-2023-36258 with a CVSS v3.1 base score of 9.8 (CRITICAL) (NVD, CVE).

Technical details

The vulnerability exists in the PALChain implementation of LangChain version 0.0.235 and earlier. The issue stems from the PALChain's _call() function, which uses a generic LLMChain to process queries and then executes the resulting code using Python's built-in exec function without proper input validation. This implementation allows attackers to inject malicious content into the LLM, prompting it to generate arbitrary Python code that gets executed (Oligo Security).

Impact

The vulnerability allows attackers to execute arbitrary code on the affected system through prompt injection techniques. Given the CVSS score of 9.8, this is considered a critical security issue that could lead to complete system compromise, allowing attackers to execute malicious commands with the same privileges as the application running LangChain (NVD).

Exploitability

The vulnerability can be exploited by crafting specific prompts that include malicious Python code. For example, an attacker can create a prompt that imports the os module and uses os.system to execute arbitrary system commands. The exploitation requires no special privileges or user interaction, making it highly exploitable (GitHub Issue).

Mitigation and workarounds

The vulnerability was fixed in LangChain version 0.0.236. Additionally, starting from version 0.0.247, the PALChain class was moved to the LangChain-Experimental package. Organizations should upgrade to a version newer than 0.0.236 to mitigate this vulnerability (NVD).

Additional resources


SourceThis report was generated using AI

Related LangChain vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2024-8309CRITICAL9.8
  • Python logoPython
  • langchain-community
NoYesOct 29, 2024
CVE-2024-7774CRITICAL9.1
  • JavaScript logoJavaScript
  • langchain
NoYesOct 29, 2024
CVE-2026-45134HIGH7.1
  • Python logoPython
  • open-webui
NoYesMay 27, 2026
CVE-2026-55443MEDIUM5.5
  • Python logoPython
  • langchain-anthropic
NoYesJun 22, 2026
GHSA-gr75-jv2w-4656MEDIUM5.1
  • Python logoPython
  • langchain
NoYesJun 16, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management