CVE-2025-68664
LangChain · LangChain is a framework for building agents and Multiple Products
A critical serialization injection vulnerability has been identified in the LangChain framework, which could allow an unauthenticated attacker to execute arbitrary code on the server.
Executive summary
A critical serialization injection vulnerability has been identified in the LangChain framework, which could allow an unauthenticated attacker to execute arbitrary code on the server. The vulnerability stems from improper handling of user-supplied data during serialization, where a specially crafted input can be misinterpreted as a trusted internal object. Successful exploitation could lead to a complete compromise of the affected application and its underlying system.
Vulnerability
A serialization injection vulnerability exists within the dumps() and dumpd() functions of the LangChain framework. These functions are responsible for serializing Python objects. The vulnerability occurs because the functions do not properly sanitize or escape user-provided dictionaries that contain a special key, 'lc'. LangChain uses this key internally to identify its own serialized objects. An attacker can craft a malicious dictionary containing the 'lc' key, and when this dictionary is processed by the vulnerable functions, it is treated as a trusted LangChain object upon deserialization. This allows the attacker to control the object instantiation process, potentially leading to arbitrary code execution on the system running the LangChain application.
Business impact
This vulnerability is rated as critical severity with a CVSS score of 9.3. Successful exploitation could grant an attacker full control over the application server, leading to severe business consequences. Potential impacts include theft of sensitive data processed by the LLM application, complete service disruption, deployment of ransomware, or using the compromised system as a pivot point for further attacks into the corporate network. The direct financial and reputational damage from such an incident could be substantial.
Remediation
Immediate Action: Immediately upgrade all instances of LangChain to the patched versions 0.3.81, 1.2.5, or newer. Prioritize patching for all internet-facing systems. After patching, it is crucial to monitor for any signs of exploitation attempts and review historical access and application logs for suspicious activity.
Proactive Monitoring: Implement monitoring to detect and alert on exploitation attempts. Security teams should look for log entries where user-supplied data passed to dumps() or dumpd() functions contains the dictionary key 'lc'. Monitor application servers for anomalous behavior, such as unexpected child processes being spawned by the application, unusual network connections, or modifications to the file system.
Compensating Controls: If immediate patching is not feasible, implement strict input validation to inspect and block any user-supplied dictionary objects containing the 'lc' key before they are passed to the LangChain framework. A Web Application Firewall (WAF) can also be configured with custom rules to detect and block HTTP requests containing payloads with the malicious {'lc': ...} structure.
Exploitation status
Public Exploit Available: false
Analyst recommendation
Given the critical CVSS score of 9.3 and the high risk of remote code execution, immediate action is required. All organizations using the affected LangChain versions must prioritize the deployment of the security patches (versions 0.3.81 and 1.2.5 or later). Due to the ease with which serialization vulnerabilities can be weaponized, organizations should assume that an exploit will become publicly available and treat this as an urgent threat to their application security posture.