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).

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
  • PythonPython
  • langchain
NoYesOct 29, 2024
CVE-2024-7042CRITICAL9.8
  • JavaScriptJavaScript
  • langchain
NoYesOct 29, 2024
CVE-2024-7774CRITICAL9.1
  • JavaScriptJavaScript
  • langchain
NoYesOct 29, 2024
CVE-2024-5998HIGH7.8
  • PythonPython
  • langchain
NoYesSep 17, 2024
CVE-2024-3095HIGH7.7
  • PythonPython
  • langchain
NoYesJun 06, 2024

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