SOCRadarAmeer Owda
CVE-2025-68664: Critical LangChain Flaw Enables Secret Extraction
CVE-2025-68664 is a serialization injection vulnerability in LangChain Core that affects how dumps() and dumpd() convert Python objects, enabling an attacker-controlled input to be misinterpreted as a trusted LangChain object during deserialization when untrusted data is processed. The issue can lead to secret leakage from environment variables and the potential instantiation of trusted LangChain classes with attacker-controlled parameters, possibly triggering network or file operations.
Affected versions include langchain-core from 1.0.0 up to, but not including, 1.2.5, and any version below 0.3.81; a related issue, CVE-2025-68665, targets LangChain.js. The security patch tightens deserialization defaults and escaping in dumps() and dumpd(), introduces an allowlist of reconstructible classes (allowed_objects), disables environment-based secret loading by default, and blocks Jinja2 template execution unless explicitly permitted.
Developers are advised to upgrade to patched releases and audit code paths that serialize and deserialize untrusted data, especially fields like additional_kwargs and response_metadata, to limit the blast radius.