# CVE-2025-68664: LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs

> Attackers can inject malicious objects via serialization APIs to execute code or extract secrets in LangChain applications.

- **Severity:** Critical 9.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 23 Dec 2025
- **Updated:** 24 Dec 2025
- **Also known as:** ECHO-fb5a-79b4-ed97, GHSA-c67j-w6g6-q2cm, MINI-g399-jhx6-775w, PYSEC-2026-373, ROOT-APP-PYPI-CVE-2025-68664

## What is CVE-2025-68664?

CVE-2025-68664 is a critical unsafe deserialization vulnerability in langchain-ai langchain, published on 23 Dec 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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.

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2025-68664?

5 open source packages ship an affected version, including langchain-core. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `langchain-core` | PyPI | All versions | 0.3.81, 1.2.5 |
| `langchain-core` | PyPI | All versions | 0.3.81 |
| `langchain-core` | PyPI | All versions | 0.3.81 |
| `langchain-core` | PyPI | From 1.0.0 | 1.2.5 |
| `langchain-core` | PyPI | From 1.0.0 | 1.2.5 |

Products: Langchain Langchain Core.

## How do I fix CVE-2025-68664?

Upgrade langchain-core to a fixed version for your release line: 0.3.81 or 1.2.5.

## Is CVE-2025-68664 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-68664 exists.

Public exploit code:

- A testing framework to identify and demonstrate deserialization vulnerabilities in LangChain Core (<0.3.81). Educational use only (github_poc): https://github.com/Ak-cybe/CVE-2025-68664-LangGrinch-PoC
- https://github.com/comerc/CVE-2025-68664 (github_poc): https://github.com/comerc/CVE-2025-68664
- LangChain Core 1.2.4 - SSTI/RCE (exploitdb)
- Technical analysis of the LangChain serialization injection vulnerability CVE-2025-68664. (github_poc): https://github.com/Johnnyzhou666/langgrinch-cve-2025-68664-analysis
- LangGrinch - CVE-2025-68664 demo (github_poc): https://github.com/t-sorger/cve-2025-68664-langgrinch

## Other vulnerabilities in langchain-ai langchain

- [CVE-2026-34070](https://insights.sbomify.com/CVE-2026-34070/): LangChain Core has Path Traversal vulnerabilites in legacy `load_prompt` functions (high 7.5)
- [CVE-2026-40087](https://insights.sbomify.com/CVE-2026-40087/): LangChain has incomplete f-string validation in prompt templates (medium 5.3)
- [CVE-2026-26013](https://insights.sbomify.com/CVE-2026-26013/): LangChain affected by SSRF via image_url token counting in ChatOpenAI.get_num_tokens_from_messages (low 3.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-68664 and fix it if it is affected.

What it is: CVE-2025-68664 is a critical unsafe deserialization vulnerability in langchain-ai langchain, published on 23 Dec 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-68664 exists.

Affected packages and fixed versions:
- langchain-core (PyPI): affected all versions; fixed in 0.3.81, 1.2.5
- langchain-core (PyPI): affected all versions; fixed in 0.3.81
- langchain-core (PyPI): affected all versions; fixed in 0.3.81
- langchain-core (PyPI): affected from 1.0.0; fixed in 1.2.5
- langchain-core (PyPI): affected from 1.0.0; fixed in 1.2.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-68664/ (Markdown: https://insights.sbomify.com/CVE-2025-68664/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-68664
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-68664
- OSV: https://osv.dev/vulnerability/CVE-2025-68664

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-68664/
Summaries are generated and may contain mistakes; the official description above is the record.
