LangChain is a framework for building agents and LLM-powered applications. Prior to versions 0.3.81 and 1.2.5, a serialization injection vulnerability exists in LangChain's dumps() and dumpd() functions. The functions do not escape dictionaries with 'lc' keys when serializing free-form dictionaries. 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 versions 0.3.81 and 1.2.5.
The dumps() and dumpd() functions used for data serialization do not filter dictionaries containing the 'lc' key, which is internally reserved by LangChain to mark serialized objects. If user-controlled data contains such a key structure, it is treated during deserialization as a valid LangChain object rather than plain user data. This results in untrusted data being processed by the framework's deserialization mechanisms (CWE-502: Deserialization of Untrusted Data).
An attacker can provide crafted data that, after deserialization, will be treated as legitimate LangChain objects, which may lead to disclosure of sensitive information and limited modification of the application state. The vulnerability has a scope exceeding the original component (S:C), which increases the potential impact on the environment.
LangChain Core should be updated to version 0.3.81 or 1.2.5 (or newer). Patches are available in the LangChain project GitHub repository (commits 5ec0fa69 and d9ec4c5c). Until updating, avoid passing untrusted user data directly to the dumps() and dumpd() functions.
LangChain Core in versions before 0.3.81 and before 1.2.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:NLangchain Core
APPLangchain< 0.3.811.0.0 – 1.2.5 (excl.)
Related vulnerabilities
LangChain is a framework for building agents and LLM-powered applications. Prior to version 1.2.22, multiple f...
LangChain to framework do budowania agentów i aplikacji obsługiwanych przez LLM. Przed wersją 0.3.84 i 1.2.28 ...
LangChain to framework do budowania agentów i aplikacji napędzanych LLM-ami. Przed wersją 1.2.11 metoda ChatOp...
SSRF w LangChain RequestsToolkit — dostęp do sieci wewnętrznej i metadanych chmury
SQL injection przez prompt injection w LangChain GraphCypherQAChain