LangChain core vulnerability allows prompt injection and data exposure
好的,我现在需要帮用户总结这篇文章的内容,控制在100个字以内。首先,我得仔细阅读文章,理解其主要内容。 文章标题是“LangChain核心漏洞允许提示注入和数据泄露”,作者是Pierluigi Paganini,日期是2025年12月27日。文章主要讲述了一个关键漏洞CVE-2025-68664,CVSS评分9.3分。这个漏洞存在于LangChain Core的dumps()和dumpd()函数中,没有正确处理包含“lc”键的用户控制字典,导致在反序列化时被当作合法对象处理。攻击者可以利用这一点注入恶意对象结构,窃取敏感信息或操纵LLM响应。漏洞影响广泛,已发布补丁版本1.2.5和0.3.81。 接下来,我需要将这些信息浓缩到100字以内。重点包括:漏洞名称、影响、攻击者的能力、漏洞原因、影响范围和补丁信息。 可能的结构是:描述漏洞及其影响,说明攻击者能做什么,原因是什么,影响范围如何,最后提到补丁。 现在开始组织语言: “LangChain Core存在严重漏洞(CVE-2025-68664),CVSS评分9.3分。该漏洞源于dumps()和dumpd()函数未正确处理包含'lc'键的用户控制字典,在反序列化时被误认为合法对象。攻击者可借此注入恶意对象结构,窃取敏感数据或操控LLM响应。此漏洞影响深远,已发布补丁版本1.2.5和0.3.81。” 检查字数:刚好在100字左右。 确认是否涵盖了所有关键点:漏洞名称、评分、原因、攻击者能力、影响范围、补丁版本。是的。 最后再通读一遍确保流畅准确。 </think> LangChain Core存在严重漏洞(CVE-2025-68664),CVSS评分9.3分。该漏洞源于dumps()和dumpd()函数未正确处理包含'lc'键的用户控制字典,在反序列化时被误认为合法对象。攻击者可借此注入恶意对象结构,窃取敏感数据或操控LLM响应。此漏洞影响深远,已发布补丁版本1.2.5和0.3.81。 2025-12-27 18:20:16 Author: securityaffairs.com(查看原文) 阅读量:3 收藏

LangChain core vulnerability allows prompt injection and data exposure

Pierluigi Paganini December 27, 2025

A critical flaw in LangChain Core could allow attackers to steal sensitive secrets and manipulate LLM responses via prompt injection.

LangChain Core (langchain-core) is a key Python package in the LangChain ecosystem that provides core interfaces and model-agnostic tools for building LLM-based applications. A critical vulnerability, tracked as CVE-2025-68664 (CVSS score of 9.3), affects the package. Security researcher Yarden Porat reported the issue on December 4, 2025, and named it LangGrinch.

“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.” reads the advisory.

The vulnerability stemmed from the functions dumps() and dumpd(), which do not escape user-controlled dictionaries containing “lc” keys. When deserialized with load() or loads(), this data was treated as valid LangChain objects instead of user input. This allowed attackers to inject malicious object structures through fields like metadata or response data. The flaw also enabled instantiation of Serializable classes within trusted LangChain namespaces, including those with side effects in initialization, though it could not load arbitrary external classes.

Cyata researcher Yarden Porat said the issue stems from two functions that failed to escape user-controlled dictionaries containing “lc” keys, which mark LangChain objects in its serialization format. If attackers force a LangChain loop to serialize and later deserialize such data, unsafe objects may be instantiated.

“So once an attacker is able to make a LangChain orchestration loop serialize and later deserialize content including an ‘lc’ key, they would instantiate an unsafe arbitrary object, potentially triggering many attacker-friendly paths.” wrote Porat.

This can lead to secret leakage from environment variables, instantiation of classes in trusted namespaces like langchain_core or langchain_community, and potentially code execution via Jinja2 templates. The bug also allows object injection through user-controlled fields such as metadata or response data using prompt injection.

Porat pointed out that this vulnerability is especially serious because it affects langchain-core itself, not a peripheral tool or edge case. The vulnerable dumps() and dumpd() APIs sit at the framework’s core, which is widely deployed at massive scale, with hundreds of millions of installs globally. A single prompt can trigger the flaw indirectly, as LLM outputs may influence metadata that later gets serialized and deserialized during normal operations. This makes exploitation subtle and far-reaching. Patches are available in versions 1.2.5 and 0.3.81, and users should update immediately.

Users are urged to address the flaw as soon as possible.

Follow me on Twitter: @securityaffairs and Facebook and Mastodon

Pierluigi Paganini

(SecurityAffairs – hacking, LangChain)




文章来源: https://securityaffairs.com/186185/hacking/langchain-core-vulnerability-allows-prompt-injection-and-data-exposure.html
如有侵权请联系:admin#unsafe.sh