Microsoft Security Blog — LangChain Core serialization injection (CVE-2025-68664)
• Category: AI CVEs
AI relevance: LangChain Core sits directly in the execution path of many LLM agents (tool calls, state, memory), so a serialization/deserialization flaw can become a reliable bridge from “untrusted agent inputs” to secrets access or code-adjacent side effects.
- What happened: Microsoft published a case study on LangGrinch (CVE-2025-68664), described as a serialization injection issue in
langchain-core. - Core mechanic (per Microsoft): LangChain uses a reserved key (
lc) to distinguish “plain data” from “serialized LangChain objects”. - Bug class: when user-controlled dictionaries containing
lcflow through serialization (dumps()/dumpd()) and later deserialization, the framework may treat attacker data as a trusted object and reconstruct it. - Impact (per Microsoft): possible secrets extraction (e.g., environment variables), unintended class instantiation, and side effects during object initialization.
- Why this matters for agents: agents routinely ingest semi-structured data from tools (web pages, tickets, emails, JSON blobs). If that data can smuggle control markers, you get an “injection” primitive below the prompt layer.
- Fix versions (per Microsoft): upgrade
langchain-coreto 0.3.81+ (for 0.3.x) or 1.2.5+ (for 1.x). - Operational angle: Microsoft ties this to AI application supply chain posture: inventory where LangChain is deployed (containers, VMs, code envs) and track vulnerable versions as first-class risk.
Why it matters
- “Data vs control” separation: agent ecosystems pass dictionaries everywhere; a reserved key used as a control signal is a sharp edge if it’s not aggressively escaped/validated.
- Secrets are nearby: agent runtimes commonly have API keys (LLM providers, SaaS tools) in env vars; anything that turns “parse this dict” into “instantiate this object” can become a secrets pipeline.
- Supply chain reality: even if your prompt injection defenses are solid, a vulnerable orchestration library is still an exploit surface.
What to do
- Patch now: update
langchain-coreto the fixed versions referenced above (and rebuild/redeploy images, not just source code). - Find exposure: inventory where
langchain-coreis installed (prod containers, notebooks, “utility” lambdas, internal agent services) and map versions. - Harden deserialization: treat any reserved control markers (
lc-like fields) as tainted when they come from tool outputs, user uploads, or external systems; add validation at boundaries. - Reduce blast radius: run agent workers with minimal env secrets; prefer workload identity / scoped tokens and deny outbound network by default where feasible.
Sources
- Microsoft Security Blog: Case study: Securing AI application supply chains
- NVD: CVE-2025-68664
- LangChain fix PR (1.x): langchain-ai/langchain#34458
- LangChain fix PR (0.3.x): langchain-ai/langchain#34455
- Cyata write-up: All I Want for Christmas is Your Secrets: LangGrinch hits LangChain Core