PyPI: langchain-core
CVE-2025-68664
Safety vulnerability ID: SFTY-20251223-41986
Safety legacy ID: pyup.io-83246
Affected versions of the langchain-core package are vulnerable to Deserialization of Untrusted Data due to improper escaping of user-controlled dictionaries containing the internal 'lc' serialization marker. The langchain_core.load.dumps() and langchain_core.load.dumpd() functions serialize free-form dictionaries without escaping 'lc' keys, so subsequent deserialization via langchain_core.load.load() or langchain_core.load.loads() can treat attacker-supplied structures as legitimate LangChain Serializable manifests (including "type": "secret" objects) instead of plain data.
Overview
LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs
Advisory
Affected versions of the langchain-core package are vulnerable to Deserialization of Untrusted Data due to improper escaping of user-controlled dictionaries containing the internal 'lc' serialization marker. The langchain_core.load.dumps() and langchain_core.load.dumpd() functions serialize free-form dictionaries without escaping 'lc' keys, so subsequent deserialization via langchain_core.load.load() or langchain_core.load.loads() can treat attacker-supplied structures as legitimate LangChain Serializable manifests (including "type": "secret" objects) instead of plain data.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20251223-41986/CVE-2025-68664
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-68664
- https://github.com/advisories/GHSA-c67j-w6g6-q2cm
- https://github.com/langchain-ai/langchain/security/advisories/GHSA-c67j-w6g6-q2cm
- https://github.com/langchain-ai/langchain/pull/34455
- https://github.com/langchain-ai/langchain/pull/34458
- https://github.com/langchain-ai/langchain/commit/5ec0fa69de31bbe3d76e4cf9cd65a6accb8466c8
- https://github.com/langchain-ai/langchain/commit/d9ec4c5cc78960abd37da79b0250f5642e6f0ce6
- https://github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D0.3.81
- https://github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D1.2.5
- https://nvd.nist.gov/vuln/detail/CVE-2025-68664
- https://github.com/advisories/GHSA-c67j-w6g6-q2cm
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
