External risk intelligence

LangChain JS Deserialization Injection Vulnerability.

CVE advisorySeverity: CRITICAL (CVSS 9.1)

CVE-2025-68665

LangChain is a developer framework used to build LLM-powered applications. While these applications are often deployed as public-facing web services or APIs, the vulnerability exists within the library code used to build such applications rather than being a standalone internet-facing service itself. Exposure depends entirely on how a developer integrates and exposes the framework's serialization functions.

Halo Surface Signal: 3 out of 5 — possibly public-facing.

External exposure likelihood

Horizon Alert

Summary of the vulnerability and why it matters

A vulnerability in the LangChain framework, which is used for developing AI applications, could allow attackers to inject malicious code during data serialization. This issue affects various versions of the LangChain JavaScript libraries. The primary concern is to confirm if your applications utilize these specific serialization methods, as the impact depends on how the framework is integrated and exposed.

  • Input could be manipulated through specific data structures.
  • Leadership should remember this due to potential code injection risks.
  • Confirm if your AI applications use affected LangChain features.

Attack Path

How an attacker could exploit the issue

An attacker could exploit this vulnerability by sending specially crafted data that includes a specific key structure ('lc') to an application built with a vulnerable version of LangChain JS. This data, when processed by the `toJSON()` method or `JSON.stringify()` function, would be misinterpreted as a legitimate LangChain object during deserialization. This misinterpretation could allow an attacker to potentially execute arbitrary code or gain unauthorized access to sensitive information within the application.

  • Entry condition: Unauthenticated network access.
  • Trigger point: User-controlled data in `kwargs`.
  • Resulting risk: Arbitrary code execution or data compromise.

Live Threat

Current exploitation, exposure, and threat context

When LangChain JS's serialization methods incorrectly handle user-provided data containing a specific internal key structure, it could cause untrusted input to be misinterpreted as legitimate LangChain objects during deserialization. This occurs when free-form data is included in keyword arguments, and the application relies on JSON stringification or the `toJSON()` method without proper escaping.

  • Application logic and data.
  • Untrusted data treated as code.
  • Potential for unexpected behavior.

Operational Fix

Recommended remediation, mitigation, and detection steps

Teams responsible for LLM application development and the underlying infrastructure supporting these applications should address this vulnerability. The first practical step involves identifying all instances of the affected LangChain.js or Langchain/core libraries, determining their exposure and business criticality, and then coordinating with application owners to plan remediation.

  • Application owners and platform teams own the issue.
  • Verify affected library usage and exposure.
  • Plan targeted updates during maintenance windows.

Supplementary metadata

Validate whether this threat affects your internet-facing exposure.

Halo Threat Intelligence helps prioritize remediation with Halo Surface Signal and H/A/L/O context. Start exposure validation with a free external attack surface trial.

Frequently asked questions

What is LangChain JS and why is it used?

LangChain JS is a software framework that simplifies building applications powered by Large Language Models (LLMs). It provides tools for developers to connect models like GPT to external data sources, manage conversation history, and chain together complex logical workflows. Developers use it to create intelligent, automated services that can reason over private documents or interact with various APIs, making it a foundational library for many modern AI-driven web services.

What does CVE-2025-68665 mean in simple terms?

This is a deserialization injection vulnerability. In technical terms, it is a CWE-502 weakness. The issue occurs because the framework uses a special 'lc' key to identify its own internal objects. Because the code fails to properly escape this key in user data, an application might mistake untrusted input for a trusted internal object. This confusion allows an attacker to manipulate how the application processes or executes data, potentially leading to unauthorized system behavior.

How can an attacker trigger this vulnerability?

An attacker triggers this by submitting input that includes the specific 'lc' key structure within keyword arguments (kwargs) processed by the application. When the application runs the affected serialization functions on this data, the system incorrectly treats the attacker's input as internal framework instructions. Importantly, simply having the library installed is not enough; the bug only triggers if the application code actively uses the vulnerable serialization methods on user-supplied data.

Do I need to worry if my application uses LangChain?

Your level of risk depends on how your application exposes these features, as noted by Halo Surface Signal. If your application takes user input and passes it into LangChain serialization functions, you are at higher risk, especially if the service is internet-facing. Internal tools or applications that do not accept or process raw user data through these specific serialization methods may be less likely to provide an immediate pathway for this kind of injection.

How do I start fixing this issue?

Your first step is to perform an inventory of your software projects to identify which services rely on the affected versions of langchain.js or @langchain/core. Once identified, prioritize updating these libraries to the patched versions specified in the advisory. Coordinate with your application development teams to test these updates in your environment, ensuring that the library changes do not disrupt your existing LLM workflows or data handling logic.

References