Packages / langchain / Security

ModerateVulnerabilityGHSA-hc5w-c9f8-9cc4CVE-2024-7774Published 29 Oct 2024

Langchain Path Traversal vulnerability

Your version

Affected releases · langchain

  • 0.2.x0.2.0 – 0.2.18Fixed in 0.2.19
  • 0.1.x and older0.0.1 – 0.1.37No fix, no longer updated

On 0.2.x, the newest line:

npm install langchain@0.2.19
Every release on a timeline
1.x
  1. Not affected

    1.0.0 – 1.6.7

    95 releases, latest

0.x
  1. Affected

    0.0.1 – 0.2.18

    269 releases

  2. Fixed

    0.2.19 – 0.3.37

    40 releases

404 stable releases of langchain, oldest to newest, one row per major.

What happens

A path traversal vulnerability exists in the getFullPath method of langchain-ai/langchainjs version 0.2.5. This vulnerability allows attackers to save files anywhere in the filesystem, overwrite existing text files, read .txt files, and delete files. The vulnerability is exploited through the setFileContent, getParsedFile, and mdelete methods, which do not properly sanitize user input.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.