Critical LangChain Vulnerability Allows Attackers to Steal Sensitive Secrets
## Cybersecurity Update: LangChain Vulnerability CVE-2025-68664
Cybersecurity Update: LangChain Vulnerability CVE-2025-68664
A critical security vulnerability has been identified in LangChain, a widely utilized AI framework. This vulnerability, known as CVE-2025-68664, allows attackers to extract environment variable secrets and possibly achieve code execution through a serialization injection flaw.
The issue arises from improper handling of serialization functions, dumps() and dumpd() , in the langchain-core library. This vulnerability was disclosed on Tue, Dec 25, 2024, by security researcher Yarden Porat from Cyata.
Attribute Details
CVE ID CVE-2025-68664
GHSA ID GHSA-c67j-w6g6-q2cm
A critical security vulnerability has been identified in LangChain, a widely utilized AI framework.
CVSS Score 9.3 (Critical)
The vulnerability affects applications using standard LangChain features, including astream_events(version="v1") , Runnable: astream_log() , RunnableWithMessageHistory , and various caching mechanisms. The most severe attack vector involves prompt injection via LLM response fields, such as additional_kwargs or response_metadata , which can be serialized and deserialized through standard streaming operations.
Successful exploitation allows attackers to extract environment variable secrets by injecting structures like {"lc": 1, "type": "secret", "id": ["ENV_VAR"]} during deserialization, especially when secrets_from_env=True (the previous default setting).
LangChain has released patches in versions 1.2.5 and 0.3.81 to address this issue. The updates fix the escaping bug and introduce restrictive defaults. The allowed_objects parameter now defaults to 'core', limiting deserialization to core objects. Additionally, secrets_from_env has changed from True to False , and Jinja2 templates are now blocked by default through a new init_validator parameter.
Organizations using LangChain in production are advised to update immediately, as the framework has recorded approximately 847 million total downloads, including 98 million in the last month alone.
LangChain awarded a $4,000 bounty for this finding, marking the highest reward ever offered by the project.
Based on reporting by GBHackers.
