Skip to main content

LangChain JS CVE-2025-68665

CRITICAL
Deserialization of Untrusted Data (CWE-502)
2025-12-23 security-advisories@github.com
9.1
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Inject 'lc'-keyed object into user-controlled field
  2. Delivery
    App serializes object via JSON.stringify and stores it
  3. Exploit
    Data rehydrated via load(), treated as LangChain object
  4. Execution
    Instantiate allowed class or resolve secret reference
  5. Impact
    Extract environment secrets or trigger constructor side effects

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A08:2025 - Software or Data Integrity Failures
ASVS 5.0
V1 - Encoding and Sanitization Safe deserialization, type allowlists
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires an application that (1) constructs LangChain Serializable objects embedding user-controlled free-form data in kwargs fields such as additional_kwargs, metadata, or response_metadata, (2) serializes them via toJSON()/JSON.stringify(), and (3) later deserializes that output with load(). The most damaging outcomes are further gated: secret extraction requires the pre-patch secretsFromEnv behavior (which had no explicit default, effectively true), and arbitrary class instantiation requires the target class to be present in the configured importMap/optionalImportsMap. Limiting factors: applications that never call load() on untrusted or user-derived serialized data are not realistically exploitable, and the set of instantiable classes is bounded by the import maps the application explicitly provides. Affects @langchain/core < 0.3.80 and >=1.0.0 <1.1.8, and langchain < 0.3.37 and >=1.0.0 <1.2.3 on Node.js.

Impact

The NVD CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:N/C:H/I:H/A:N, score 9.1) presents this as a critical, network-exploitable, unauthenticated flaw with high confidentiality and integrity impact. However, these raw signals overstate the practical risk because exploitation is strongly conditional on application design: the host application must serialize user-controlled Serializable objects via toJSON()/JSON.stringify() and later feed that output back through load(). The most severe outcomes (secret extraction, arbitrary class instantiation) further require secretsFromEnv behavior to be enabled and attacker-reachable classes to be present in the configured import maps - so the ~AC:L rating is optimistic for most real deployments. No EPSS score, SSVC decision, KEV listing, or public POC was provided in the input. Per precision rules, there is no public exploit identified at time of analysis and no evidence of active exploitation, so this is best treated as a high-severity library defect requiring patching rather than an emergency in-the-wild threat. Exploitation also demands a specific round-trip serialize-then-deserialize data flow, which limits who is genuinely exposed; teams not calling load() on untrusted serialized data are not practically affected.

Exploit ScenarioDerived

An attacker submits data into a user-controlled field such as message metadata, additional_kwargs, or response_metadata containing a crafted object with an 'lc' key structure. The application serializes the LangChain object with JSON.stringify() and later rehydrates it with load(), at which point the injected structure is treated as a legitimate LangChain object - enabling environment-variable secret extraction (when secretsFromEnv is effectively enabled) or instantiation of an attacker-chosen class from the import map with attacker-controlled constructor kwargs. No public exploit code was identified at time of analysis.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.8% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 19, 2026

Serialization injection in LangChain JS affects @langchain/core before 0.3.80 and 1.0.0 through 1.1.7, plus langchain before 0.3.37 and 1.0.0 through 1.2.2, where Serializable.toJSON() fails to escape user-controlled objects containing an 'lc' key inside kwargs such as metadata, additional_kwargs, or response_metadata. If an application later deserializes that JSON with load(), injected data can be treated as legitimate LangChain objects, enabling secret extraction when pre-patch secretsFromEnv behavior is in effect or instantiation of classes already exposed through configured import maps. NVD rates this 9.1, but the assessed vector is AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N because meaningful exploitation requires the specific serialize-then-load workflow and, for the most damaging outcomes, permissive secret or import-map configuration; no public exploit was identified at time of analysis.

RemediationAI

Upgrade to vendor-released patched versions: @langchain/core 0.3.80 or 1.1.8, and langchain 0.3.37 or 1.2.3, or later, using the releases linked from GHSA-r399-636x-v7f6; the upstream fix is commit e5063f9c6e9989ea067dfdff39262b9e7b6aba62. Until upgraded, avoid calling load() on serialized data that may contain user-controlled kwargs, because that is the critical precondition for exploitation. If deserialization of such data cannot be avoided, explicitly set secretsFromEnv to false and keep importMap and optionalImportsMap limited to the minimum trusted classes needed, accepting that this may break legitimate loading of less common object types. Also sanitize or reject 'lc'-structured objects in free-form fields such as metadata, additional_kwargs, and response_metadata before serialization, with the trade-off that legitimate user data shaped like LangChain objects may be rejected or altered.

Affected Packages

npm @langchain/core fix: 0.3.80, 1.1.8
npm langchain fix: 0.3.37, 1.2.3

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

This is a CWE-502 deserialization issue in LangChain JS's object serialization protocol. LangChain marks serialized objects with an 'lc' key so load() can distinguish framework objects from plain data. The vulnerable toJSON() implementation did not escape ordinary objects that happened to contain an 'lc' key when they appeared in free-form kwargs, so attacker-controlled content could be serialized in a form that load() later interpreted as a genuine LangChain object. The patch adds escape-based injection protection: plain objects with an 'lc' key are wrapped as {"__lc_escaped__": {...}} during serialization and unwrapped as plain data during deserialization, while only objects produced by Serializable.toJSON() are treated as LangChain objects. It also hardens load() by making secretsFromEnv explicitly default to false and adding a maxDepth limit against deeply nested JSON denial-of-service. The impact is bounded by application behavior: secret extraction depends on the old effective secretsFromEnv behavior, and arbitrary class instantiation is limited to classes present in the importMap or optionalImportsMap the application provides.

Know when Langchain Js gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

NVD PRIMARY 9.1 CRITICAL
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
vuln.today AI 7.4 HIGH

Network-delivered via user data with no auth (PR:N), but AC:H because exploitation depends on the app's serialize-then-load() flow plus import-map/secretsFromEnv configuration; high confidentiality and integrity impact, no availability impact.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
4.0 AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
Red Hat 8.6 HIGH

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

DescriptionNVD

LangChain is a framework for building LLM-powered applications. Prior to @langchain/core versions 0.3.80 and 1.1.8, and prior to langchain versions 0.3.37 and 1.2.3, a serialization injection vulnerability exists in LangChain JS's toJSON() method (and subsequently when string-ifying objects using JSON.stringify(). The method did not escape objects with '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 plain user data. This issue has been patched in @langchain/core versions 0.3.80 and 1.1.8, and langchain versions 0.3.37 and 1.2.3

Executive ViewAI

Why It Matters

LangChain JS libraries @langchain/core and langchain contain a critical serialization-injection flaw that can let user-controlled data be treated as trusted LangChain objects when applications serialize then later deserialize model inputs or metadata. GenAI application teams using the affected versions are exposed to potential secret extraction and unintended class instantiation, so leadership should prioritize inventory and upgrade even though no public exploit has been identified at time of analysis.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.8%
Top 44% exploitable
Prevalence
Medium
popular LLM app framework, but JS variant smaller than Python LangChain
Data Quality
3 sources
Confidence: Low

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.8%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

47
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +46
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Insecure deserialization occurs when an application converts serialized data (a stream of bytes representing an object's state) back into a living object without proper validation.

Affected Products (CPE)NVD

cpe:2.3:a:langchain:langchain.js:*:*:*:*:*:*:*:*
cpe:2.3:a:langchain:langchain.js:*:*:*:*:*:*:*:*
cpe:2.3:a:langchain:langchain\/core:*:*:*:*:*:node.js:*:*
cpe:2.3:a:langchain:langchain\/core:*:*:*:*:*:node.js:*:*

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy