High, CVSS 8.6npmAmendedPublished
LangChain serialization injection vulnerability enables secret extraction
CVE-2025-68665 · GHSA-r399-636x-v7f6
- Affected
- npm @langchain/core >= 1.0.0, < 1.1.8; < 0.3.80
- Fixed in
- 1.1.80.3.80· Vendor fix available
- Issue
- Context 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. Attack surface The core vulnerability was in Serializable.toJSON(): this method failed to escape user-controlled objects containing 'lc' keys within kwargs (e.g., additionalkwargs, metadata, responsemetadata). When this unescaped data was later deserialized via load(), the injected structures were treated as legitimate LangChain objects rather than plain user data. This escaping bug enabled several attack vectors: 1. Injection via user data: Malicious LangChain object structures could be injected through…
Recommended action: Upgrade to 1.1.8 or 0.3.80 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.