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.

Created at: Jan 13, 2026Updated at: Jan 13, 2026

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.

Affected Package

Affecting langchain-core package, versions
>=1.0.0,<1.2.5
<0.3.81

Also affects

---

How to Fix

Upgrade
langchain-core
to
1.2.5
0.3.81
or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

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