CVE-2025-68664
LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- Low
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
9.3
LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs
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.
- Record
CVE-2025-68664- CVSS 3.1
- 9.3 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:N - Weakness
- CWE-502
- Updated
- 2026-11-02
EUVDEUVD-2025-204849
9.3
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.
- Record
EUVD-2025-204849- CVSS 3.1
- 9.3 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-c67j-w6g6-q2cm
9.3
LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs
Summary
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.
Attack surface
The core vulnerability was in dumps() and dumpd(): these functions failed to escape user-controlled dictionaries containing 'lc' keys. When this unescaped data was later deserialized via load() or loads(), the injected structures were treated as legitimate LangChain objects rather than plain user data.
This escaping bug enabled several attack vectors:
- Injection via user data: Malicious LangChain object structures could be injected through user-controlled fields like
metadata,additional_kwargs, orresponse_metadata - Class instantiation within trusted namespaces: Injected manifests could instantiate any
Serializablesubclass, but only within the pre-approved trusted namespaces (langchain_core,langchain,langchain_community). This includes classes with side effects in__init__(network calls, file operations, etc.). Note that namespace validation was already enforced before this patch, so arbitrary classes outside these trusted namespaces could not be instantiated.
Security hardening
This patch fixes the escaping bug in dumps() and dumpd() and introduces new restrictive defaults in load() and loads(): allowlist enforcement via allowed_objects="core" (restricted to serialization mappings), secrets_from_env changed from True to False, and default Jinja2 template blocking via init_validator. These are breaking changes for some use cases.
Who is affected?
Applications are vulnerable if they:
- Use
astream_events(version="v1")— The v1 implementation internally uses vulnerable serialization. Note:astream_events(version="v2")is not vulnerable. - Use
Runnable.astream_log()— This method internally uses vulnerable serialization for streaming outputs. - Call
dumps()ordumpd()on untrusted data, then deserialize withload()orloads()— Trusting your own serialization output makes you vulnerable if user-controlled data (e.g., from LLM responses, metadata fields, or user inputs) contains'lc'key structures. - Deserialize untrusted data with
load()orloads()— Directly deserializing untrusted data that may contain injected'lc'structures. - Use
RunnableWithMessageHistory— Internal serialization in message history handling. - Use
InMemoryVectorStore.load()to deserialize untrusted documents. - Load untrusted generations from cache using
langchain-communitycaches. - Load untrusted manifests from the LangChain Hub via
hub.pull. - Use
StringRunEvaluatorChainon untrusted runs. - Use
create_lc_storeorcreate_kv_docstorewith untrusted documents. - Use
MultiVectorRetrieverwith byte stores containing untrusted documents. - Use
LangSmithRunChatLoaderwith runs containing untrusted messages.
The most common attack vector is through LLM response fields like additional_kwargs or response_metadata, which can be controlled via prompt injection and then serialized/deserialized in streaming operations.
Impact
Attackers who control serialized data can extract environment variable secrets by injecting {"lc": 1, "type": "secret", "id": ["ENV_VAR"]} to load environment variables during deserialization (when secrets_from_env=True, which was the old default). They can also instantiate classes with controlled parameters by injecting constructor structures to instantiate any class within trusted…
- Record
GHSA-c67j-w6g6-q2cm- CVSS 3.1
- 9.3 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:N - Weakness
- CWE-502
- Updated
- 2026-11-02
NVD
9.3
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.
- Record
CVE-2025-68664- CVSS 3.1
- 9.3 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:N - CVSS 3.1
- 8.2 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N - Weakness
- CWE-502
- Updated
- 2026-11-02
OSV
9.3
LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs
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.
- Record
CVE-2025-68664- CVSS 3.1
- 9.3 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:N - Weakness
- CWE-502
- Updated
- 2026-11-02
OSVGHSA-c67j-w6g6-q2cm
9.3
LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs
Summary
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.
Attack surface
The core vulnerability was in dumps() and dumpd(): these functions failed to escape user-controlled dictionaries containing 'lc' keys. When this unescaped data was later deserialized via load() or loads(), the injected structures were treated as legitimate LangChain objects rather than plain user data.
This escaping bug enabled several attack vectors:
- Injection via user data: Malicious LangChain object structures could be injected through user-controlled fields like
metadata,additional_kwargs, orresponse_metadata - Class instantiation within trusted namespaces: Injected manifests could instantiate any
Serializablesubclass, but only within the pre-approved trusted namespaces (langchain_core,langchain,langchain_community). This includes classes with side effects in__init__(network calls, file operations, etc.). Note that namespace validation was already enforced before this patch, so arbitrary classes outside these trusted namespaces could not be instantiated.
Security hardening
This patch fixes the escaping bug in dumps() and dumpd() and introduces new restrictive defaults in load() and loads(): allowlist enforcement via allowed_objects="core" (restricted to serialization mappings), secrets_from_env changed from True to False, and default Jinja2 template blocking via init_validator. These are breaking changes for some use cases.
Who is affected?
Applications are vulnerable if they:
- Use
astream_events(version="v1")— The v1 implementation internally uses vulnerable serialization. Note:astream_events(version="v2")is not vulnerable. - Use
Runnable.astream_log()— This method internally uses vulnerable serialization for streaming outputs. - Call
dumps()ordumpd()on untrusted data, then deserialize withload()orloads()— Trusting your own serialization output makes you vulnerable if user-controlled data (e.g., from LLM responses, metadata fields, or user inputs) contains'lc'key structures. - Deserialize untrusted data with
load()orloads()— Directly deserializing untrusted data that may contain injected'lc'structures. - Use
RunnableWithMessageHistory— Internal serialization in message history handling. - Use
InMemoryVectorStore.load()to deserialize untrusted documents. - Load untrusted generations from cache using
langchain-communitycaches. - Load untrusted manifests from the LangChain Hub via
hub.pull. - Use
StringRunEvaluatorChainon untrusted runs. - Use
create_lc_storeorcreate_kv_docstorewith untrusted documents. - Use
MultiVectorRetrieverwith byte stores containing untrusted documents. - Use
LangSmithRunChatLoaderwith runs containing untrusted messages.
The most common attack vector is through LLM response fields like additional_kwargs or response_metadata, which can be controlled via prompt injection and then serialized/deserialized in streaming operations.
Impact
Attackers who control serialized data can extract environment variable secrets by injecting {"lc": 1, "type": "secret", "id": ["ENV_VAR"]} to load environment variables during deserialization (when secrets_from_env=True, which was the old default). They can also instantiate classes with controlled parameters by injecting constructor structures to instantiate any class within trusted…
- Record
GHSA-c67j-w6g6-q2cm- CVSS 3.1
- 9.3 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:N - Weakness
- CWE-502
- Updated
- 2026-11-02
OSVPYSEC-2026-373
9.3
LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs
Summary
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.
Attack surface
The core vulnerability was in dumps() and dumpd(): these functions failed to escape user-controlled dictionaries containing 'lc' keys. When this unescaped data was later deserialized via load() or loads(), the injected structures were treated as legitimate LangChain objects rather than plain user data.
This escaping bug enabled several attack vectors:
- Injection via user data: Malicious LangChain object structures could be injected through user-controlled fields like
metadata,additional_kwargs, orresponse_metadata - Class instantiation within trusted namespaces: Injected manifests could instantiate any
Serializablesubclass, but only within the pre-approved trusted namespaces (langchain_core,langchain,langchain_community). This includes classes with side effects in__init__(network calls, file operations, etc.). Note that namespace validation was already enforced before this patch, so arbitrary classes outside these trusted namespaces could not be instantiated.
Security hardening
This patch fixes the escaping bug in dumps() and dumpd() and introduces new restrictive defaults in load() and loads(): allowlist enforcement via allowed_objects="core" (restricted to serialization mappings), secrets_from_env changed from True to False, and default Jinja2 template blocking via init_validator. These are breaking changes for some use cases.
Who is affected?
Applications are vulnerable if they:
- Use
astream_events(version="v1")— The v1 implementation internally uses vulnerable serialization. Note:astream_events(version="v2")is not vulnerable. - Use
Runnable.astream_log()— This method internally uses vulnerable serialization for streaming outputs. - Call
dumps()ordumpd()on untrusted data, then deserialize withload()orloads()— Trusting your own serialization output makes you vulnerable if user-controlled data (e.g., from LLM responses, metadata fields, or user inputs) contains'lc'key structures. - Deserialize untrusted data with
load()orloads()— Directly deserializing untrusted data that may contain injected'lc'structures. - Use
RunnableWithMessageHistory— Internal serialization in message history handling. - Use
InMemoryVectorStore.load()to deserialize untrusted documents. - Load untrusted generations from cache using
langchain-communitycaches. - Load untrusted manifests from the LangChain Hub via
hub.pull. - Use
StringRunEvaluatorChainon untrusted runs. - Use
create_lc_storeorcreate_kv_docstorewith untrusted documents. - Use
MultiVectorRetrieverwith byte stores containing untrusted documents. - Use
LangSmithRunChatLoaderwith runs containing untrusted messages.
The most common attack vector is through LLM response fields like additional_kwargs or response_metadata, which can be controlled via prompt injection and then serialized/deserialized in streaming operations.
Impact
Attackers who control serialized data can extract environment variable secrets by injecting {"lc": 1, "type": "secret", "id": ["ENV_VAR"]} to load environment variables during deserialization (when secrets_from_env=True, which was the old default). They can also instantiate classes with controlled parameters by injecting constructor structures to instantiate any class within trusted…
- Record
PYSEC-2026-373- CVSS 3.1
- 9.3 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:N - Updated
- 2026-11-02
OSVROOT-APP-PYPI-CVE-2025-68664 No score
CVE-2025-68664 in langchain-core - Patched by Root
Root has patched CVE-2025-68664 in the langchain-core package for Root:PyPI. Multiple fixed versions available.
- Record
ROOT-APP-PYPI-CVE-2025-68664- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
langchain-corePyPI |
1.0.0 up to 1.2.5 | 1.2.5 |
langchain-corePyPI |
before 0.3.81 | 0.3.81 |
langchain-corePyPI |
1.0.0 up to 1.2.5, plus listed versions 1.0.11.0.21.0.31.0.41.0.5 Show 11 moreShow less1.0.61.0.71.1.01.1.11.1.21.1.31.2.01.2.11.2.21.2.31.2.4 |
1.2.5 |
langchain-corePyPI |
before 0.3.81, plus listed versions 0.0.10.0.100.0.110.0.120.0.13 Show 45 moreShow less0.0.13rc10.0.13rc20.0.20.0.30.0.40.0.50.0.60.0.70.0.80.0.90.1.00.1.10.1.100.1.110.1.120.1.12rc10.1.130.1.140.1.150.1.15rc10.1.15rc20.1.160.1.170.1.180.1.190.1.20.1.200.1.210.1.220.1.230.1.240.1.250.1.260.1.270.1.280.1.290.1.30.1.300.1.310.1.320.1.330.1.33rc10.1.340.1.350.1.36 |
0.3.81 |
langchain-corePyPI |
before 0.3.81, 1.0.0 up to 1.2.5, plus listed versions 0.0.10.0.100.0.110.0.120.0.13 Show 45 moreShow less0.0.13rc10.0.13rc20.0.20.0.30.0.40.0.50.0.60.0.70.0.80.0.90.1.00.1.10.1.100.1.110.1.120.1.12rc10.1.130.1.140.1.150.1.15rc10.1.15rc20.1.160.1.170.1.180.1.190.1.20.1.200.1.210.1.220.1.230.1.240.1.250.1.260.1.270.1.280.1.290.1.30.1.300.1.310.1.320.1.330.1.33rc10.1.340.1.350.1.36 |
0.3.811.2.5 |
langchain-coreRoot:PyPI |
before 0.3.72+aikido.2 | 0.3.72+aikido.21.2.4+aikido.51.0.2+aikido.40.3.72+aikido.30.3.72+aikido.40.3.78+aikido.21.2.0+aikido.21.0.2+aikido.5 |
rootio-langchain-coreRoot:PyPI |
before 1.2.0+root.io.1 | 1.2.0+root.io.11.2.4+root.io.10.3.78+root.io.11.0.2+root.io.10.3.72+root.io.11.0.2+root.io.31.2.4+root.io.21.2.4+root.io.31.2.4+root.io.40.3.72+root.io.21.2.4+root.io.51.0.2+root.io.4 |
Public exploits
Links only. Every CVE stores no exploit code.
| Source | Link | Date |
|---|---|---|
| Exploit-DB | LangChain Core 1.2.4 - SSTI/RCE | 2026-04-29 |
| PoC in GitHub | Ak-cybe/CVE-2025-68664-LangGrinch-PoC | 2025-12-27 |
| PoC in GitHub | Johnnyzhou666/langgrinch-cve-2025-68664-analysis | 2026-05-10 |
| PoC in GitHub | comerc/CVE-2025-68664 | 2026-01-10 |
| PoC in GitHub | t-sorger/cve-2025-68664-langgrinch | 2026-09-06 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, Exploit-DB, GitHub Advisories, NVD, OSV, PoC in GitHub |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2025-68664 is a critical vulnerability (CVSS 9.3) in Langchain-ai Langchain, published December 23, 2025. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 42.9%, the 98th percentile. Fixed in langchain-core 1.2.5.
References
github.com/langchain-ai/langchain/security/advisories/GHSA-c67j-w6g6-q2cm
github.com/langchain-ai/langchain/pull/34455
github.com/langchain-ai/langchain/pull/34458
github.com/langchain-ai/langchain/commit/5ec0fa69de31bbe3d76e4cf9cd65a6accb8466c8
github.com/langchain-ai/langchain/commit/d9ec4c5cc78960abd37da79b0250f5642e6f0ce6
github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D0.3.81
Show 7 moreShow less
github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D1.2.5
nvd.nist.gov/vuln/detail/CVE-2025-68664
github.com/pypa/advisory-database/tree/main/vulns/langchain-core/PYSEC-2026-373.yaml
pypi.org/project/langchain-core
github.com/advisories/GHSA-c67j-w6g6-q2cm
github.com/CVEProject/cvelistV5/tree/main/cves/2025/68xxx/CVE-2025-68664.json
github.com/langchain-ai/langchain
Left out here: 340 versions and the rest of 3 source descriptions. The JSON record has them.