LangChain JS
CVE-2025-68665
CRITICAL
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessInject 'lc'-keyed object into user-controlled field
-
DeliveryApp serializes object via JSON.stringify and stores it
-
ExploitData rehydrated via load(), treated as LangChain object
-
ExecutionInstantiate allowed class or resolve secret reference
-
ImpactExtract 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
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
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
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.
Primary rating from NVD.
CVSS VectorNVD
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
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.
Apply vendor patch.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
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.
NVD
CVE.org
EPSS
GitHub
Exploit-DB