AgentbeamBeta
AI agent vulnerability · LangGraph

CVE-2026-27794: LangGraph: BaseCache Deserialization of Untrusted Data may lead to Remote Code Execution

mediumCVSS 3.1 6.6GHSA-mhr3-j7m5-c7c9

langgraph-checkpoint before 4.0.0 deserializes cached values with pickle when msgpack fails. An attacker who can write to the cache backend of a LangGraph app can plant a malicious pickle and run code in the LangGraph process. Caching is off by default. Upgrade to langgraph-checkpoint 4.0.0.

Published Feb 25, 2026 · Analysis Nov 9, 2026

What an attacker can do

BaseCache, the parent of InMemoryCache, RedisCache and SqliteCache, defaulted to JsonPlusSerializer(pickle_fallback=True). When msgpack serialization fails, the serializer stores a ("pickle", bytes) tuple. On read, loads_typed() in jsonplus.py calls pickle.loads() on it. Pickle runs code during loading, so a crafted entry executes in the process that reads the cache.

The app is exposed only when it passes cache=... to StateGraph.compile() (or sets another BaseCache), at least one node opts in with CachePolicy, and the attacker can write to the cache store. Examples are a Redis instance with weak or no authentication, cache infrastructure shared with other tenants or services, and a SQLite cache file with loose permissions.

The serializer is not a network API, so the attacker cannot send a payload straight to the app. This is why the advisory calls it a post-access escalation and the CVSS vector has high complexity and high privileges. Once triggered, the attacker gets arbitrary code execution as the agent process, with its API keys, tool access and data. The issue was reported through the Trend Micro Zero Day Initiative (ZDI-CAN-28385).

Who is affected

Affected: the pip package langgraph-checkpoint below 4.0.0, in applications that enable a cache backend and use CachePolicy on nodes. Apps that do not enable caching are not affected.

pip show langgraph-checkpoint

Also search your code for cache= in StateGraph.compile() and for CachePolicy. Check who can write to the Redis or SQLite store behind it.

langgraph-checkpoint

Ecosystem
PyPI
Affected
< 4.0.0
Fixed in
4.0.0
Check
pip show langgraph-checkpoint

How to fix it

Upgrade to langgraph-checkpoint 4.0.0 or later:

pip install --upgrade "langgraph-checkpoint>=4.0.0"

The fix turns off the pickle fallback by default (pickle_fallback=False). Also lock down the cache backend itself: require authentication on Redis, keep it off shared networks, and restrict file permissions on SQLite cache files. The advisory lists no other workaround.

How to tell if you were hit

Check the cache store for entries of type pickle, which a normal msgpack-only setup should not produce. Look at Redis for keys written by clients or addresses that are not your app, and at file modification times and owners on SQLite cache files. In the app host, look for unexpected child processes or outbound connections from the LangGraph process after a cache read.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Context

A Remote Code Execution vulnerability exists in LangGraph's caching layer when applications enable cache backends that inherit from BaseCache and opt nodes into caching via CachePolicy. Prior to langgraph-checkpoint 4.0.0, BaseCache defaults to JsonPlusSerializer(pickle_fallback=True). When msgpack serialization fails, cached values can be deserialized via pickle.loads(...).

Who is affected?

Caching is not enabled by default. Applications are affected only when:

  • The application explicitly enables a cache backend (for example by passing cache=... to StateGraph.compile(...) or otherwise configuring a BaseCache implementation)
  • One or more nodes opt into caching via CachePolicy
  • The attacker can write to the cache backend (for example a network-accessible Redis instance with weak/no auth, shared cache infrastructure reachable by other tenants/services, or a writable SQLite cache file)

Example (enabling a cache backend and opting a node into caching):

from langgraph.cache.memory import InMemoryCache
from langgraph.graph import StateGraph
from langgraph.types import CachePolicy


def my_node(state: dict) -> dict:
    return {"value": state.get("value", 0) + 1}


builder = StateGraph(dict)
builder.add_node("my_node", my_node, cache_policy=CachePolicy(ttl=120))
builder.set_entry_point("my_node")

graph = builder.compile(cache=InMemoryCache())

result = graph.invoke({"value": 1})

With pickle_fallback=True, when msgpack serialization fails, JsonPlusSerializer can fall back to storing values as a ("pickle", <bytes>) tuple and later deserialize them via pickle.loads(...). If an attacker can place a malicious pickle payload into the cache backend such that the LangGraph process reads and deserializes it, this can lead to arbitrary code execution.

Exploitation requires attacker write access to the cache backend. The serializer is not exposed as a network-facing API.

This is fixed in langgraph-checkpoint>=4.0.0 by disabling pickle fallback by default (pickle_fallback=False).

Impact

Arbitrary code execution in the LangGraph process when attacker-controlled cache entries are deserialized.

Root Cause

  • BaseCache default serializer configuration inherited by cache implementations (InMemoryCache, RedisCache, SqliteCache):
  • libs/checkpoint/langgraph/cache/base/__init__.py (pre-fix default: JsonPlusSerializer(pickle_fallback=True))
  • JsonPlusSerializer deserialization sink:
  • libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py
  • loads_typed(...) calls pickle.loads(data_) when type_ == "pickle" and pickle fallback is enabled

Attack preconditions

An attacker must be able to write attacker-controlled bytes into the cache backend such that the LangGraph process later reads and deserializes them.

This typically requires write access to a networked cache (for example a network-accessible Redis instance with weak/no auth or shared cache infrastructure reachable by other tenants/services) or write access to local cache storage (for example a writable SQLite cache file via permissive file permissions or a shared writable volume).

Because exploitation requires write access to the cache storage layer, this is a post-compromise / post-access escalation vector.

Remediation

  • Upgrade to langgraph-checkpoint>=4.0.0.

Resources

  • ZDI-CAN-28385
  • Patch: https://github.com/langchain-ai/langgraph/pull/6677
  • Patch diff: https://patch-diff.githubusercontent.com/raw/langchain-ai/langgraph/pull/6677.patch
  • Credit: Peter Girnus (@gothburz), Demeng Chen, and Brandon Niemczyk (Trend Micro Zero Day Initiative)

Credited to zdi-disclosures.

Questions

Is CVE-2026-27794 exploitable if I do not use caching?

No. Caching is off by default. The app must enable a BaseCache backend and opt nodes in through CachePolicy.

Can a remote attacker exploit it directly?

Not through LangGraph itself. The attacker needs write access to the cache backend, such as an open Redis server or a writable SQLite file.

What does 4.0.0 change?

It sets pickle_fallback to False by default, so cached values are no longer loaded with pickle.loads().

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More LangGraph vulnerabilities

All LangGraph entries