Skip to main content

Deserialization of Untrusted Data in langchain

CVE-2025-68665

  • langchain
  • @langchain/core
Severity High
Score 9.1/10

Summary

LangChain is a framework for building LLM-powered applications. In @langchain/core versions prior to 0.3.80 and 1.x prior to 1.1.8, and langchain versions prior to 0.3.37 and 1.x prior to 1.2.3, a serialization injection vulnerability exists in LangChain JS's "toJSON()" method (and subsequently when stringifying objects using "JSON.stringify()"). The method did not properly escape objects containing "lc" keys when serializing free-form data in "kwargs". The "lc" key is used internally by LangChain to mark serialized objects. When user-controlled data contains this key structure, it is treated as a legitimate LangChain object during deserialization rather than as plain user data.

  • LOW
  • NETWORK
  • HIGH
  • UNCHANGED
  • NONE
  • NONE
  • HIGH
  • NONE

CWE-502 - Deserialization of Untrusted Data

Deserialization of untrusted data vulnerabilities enable an attacker to replace or manipulate a serialized object, replacing it with malicious data. When the object is deserialized at the victim's end the malicious data is able to compromise the victim’s system. The exploit can be devastating, its impact may range from privilege escalation, broken access control, or denial of service attacks to allowing unauthorized access to the application's internal code and logic which can compromise the entire system.

Advisory Timeline

  • Published