CVE-2025-68665
CRITICALCVE-2025-68665 is a critical deserialization injection in LangChain JS (CVSS 9.1) requiring zero authentication and zero user interaction — patch immediately. Any LangChain JS application that processes user-controlled input through kwargs is potentially exploitable for arbitrary object instantiation, which can escalate to RCE or data exfiltration. Upgrade @langchain/core to ≥0.3.80 or ≥1.1.8, and langchain to ≥0.3.37 or ≥1.2.3 before end of day.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| langchain.js | pip | — | No patch |
| langchain.js | pip | — | No patch |
| langchain\/core | pip | — | No patch |
| langchain\/core | pip | — | No patch |
Severity & Risk
Recommended Action
- 1. PATCH: Upgrade @langchain/core to ≥0.3.80 (stable) or ≥1.1.8 (v1 branch); upgrade langchain package to ≥0.3.37 or ≥1.2.3. Verify via package.json and lock files. 2. AUDIT: Inventory all services using LangChain JS — check CI/CD pipelines, serverless functions, and containerized microservices. 3. WORKAROUND (if patch not immediately possible): Sanitize or reject user-controlled input containing top-level 'lc' keys before it reaches LangChain serialization methods. Implement input validation middleware. 4. DETECT: Add WAF/API gateway rules to flag requests with JSON payloads containing 'lc' key structures in unexpected positions. Monitor LangChain application logs for deserialization errors or unexpected object types. 5. VERIFY: Review commit e5063f9 to understand the exact sanitization applied and validate your patch is complete.
Classification
Compliance Impact
This CVE is relevant to:
Technical Details
NVD Description
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
Exploitation Scenario
An adversary targeting a LangChain JS-powered chatbot or API crafts a JSON payload containing a nested object with the 'lc' key structure used internally by LangChain (e.g., {"input": {"lc": 1, "type": "constructor", "id": ["langchain", "...TargetClass"], "kwargs": {...}}}). When this user-controlled data flows into LangChain's toJSON() or is passed through JSON.stringify(), the framework treats it as a legitimate serialized LangChain object rather than plain user data. During subsequent deserialization, LangChain instantiates the attacker-specified class with attacker-controlled kwargs. Depending on available gadget classes in the runtime context, this can achieve arbitrary file reads, environment variable exfiltration, or code execution — all via a single crafted HTTP request to a public API endpoint.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N References
- github.com/langchain-ai/langchainjs/security/advisories/GHSA-r399-636x-v7f6 Vendor
- github.com/langchain-ai/langchainjs/commit/e5063f9c6e9989ea067dfdff39262b9e7b6aba62 Patch
- github.com/langchain-ai/langchainjs/releases/tag/%40langchain%2Fcore%401.1.8 Release
- github.com/langchain-ai/langchainjs/releases/tag/langchain%401.2.3 Release
- github.com/langchain-ai/langchainjs/security/advisories/GHSA-r399-636x-v7f6 Vendor