# GHSA-J87F-X5H5-GR75: Insecure deserialization in JsonPlusSerializer can lead to arbitrary code execution

- Database: GitHub
- Severity: CVSS 7.7 (High)
- Published: 2026-08-21
- Modified: 2026-08-21

## Affected versions

- @langchain/langgraph (npm): fixed in 0.4.10
- @langchain/langgraph-checkpoint (npm): fixed in 0.1.3
- @langchain/langgraph (npm): from 1.0.0, fixed in 1.4.12
- @langchain/langgraph-checkpoint (npm): from 1.0.0, fixed in 1.1.4

## Description

## Context

An unsafe-deserialization vulnerability exists in LangGraph.js checkpoint restoration. `JsonPlusSerializer`, the default serializer used by `@langchain/langgraph-checkpoint`, accepts `lc: 2` constructor records from persisted checkpoint JSON. Before the fix, it used a serialized property name to invoke a method on a native constructor.

Checkpoint JSON must be treated as untrusted. An attacker who can place structured data into a checkpoint and later cause that checkpoint to be restored can use nested constructor records to create a callable and invoke it during deserialization.

## Attack surface

The vulnerable code path was in `JsonPlusSerializer._reviver()` in `libs/checkpoint/src/serde/jsonplus.ts`. Constructor records were revived bottom-up and dispatched dynamically:

```ts
constructor[record.method](...record.args)
```

Although the constructor type itself was selected from a small built-in set, the method name and arguments came from serialized data. JavaScript constructors expose an inherited `constructor` property that resolves to `Function`. A nested record could therefore produce a callable from attacker-controlled source text; an outer callback-taking native method could then invoke that callable.

Two relevant callback-taking paths were:

- `Uint8Array.from(values, mappingFunction)` on supported Node.js versions;
- `Map.groupBy(values, callback)` on Node.js 22 and later.

The exploit does not require attacker control of checkpoint storage directly. It requires only a structured attacker-controlled value to cross a checkpoint persistence boundary and a later restoration operation.

## Who is affected?

Applications are affected when all of the following are true:

1. They use an affected `@langchain/langgraph-checkpoint` release and the default `JsonPlusSerializer` (usually the case when a first-party checkpointer is used)
2. An attacker can submit structured data that reaches checkpoint metadata, persisted message state, or another serialized checkpoint value (usually true when deploying `langgraph-api`)
3. The application later restores that checkpoint.

Relevant structured input paths include run/thread metadata and message fields such as `additional_kwargs`. Ordinary string-only message content does not by itself create this serialization record shape.

## Impact

Successful exploitation allows arbitrary JavaScript execution in the host process restoring the checkpoint. The generated code executes with the service process's authority and may access resources available to that process, including application credentials, checkpoint and store backends, readable/writable files, internal network services, and in-memory tenant/application data.

## Security hardening changes

The fix removes serialized property lookup and dynamic method invocation from `lc: 2` checkpoint deserialization.

The serializer now reconstructs only a closed set of persisted forms:

- `undefined`
- `DeltaSnapshot`
- `Set`
- `Map`
- `RegExp`
- `Error`
- `Uint8Array`

Each supported type validates its constructor identifier, method state, and argument shape before direct reconstruction. Unknown, malformed, and method-bearing constructor records are preserved as inert data.

For backward compatibility, the legacy `Uint8Array` `method: "from"` encoding is accepted only as a format tag. It requires exactly one array of integer byte values from 0 through 255 and is reconstructed with `new Uint8Array(bytes)`. The serialized method and any additional arguments are never invoked or forwarded.

## Affected packages and versions

### Affected packages

- `@langchain/langgraph-checkpoint`
- Packages that embed or depend on its default checkpoint serializer, including `@langchain/langgraph`

### Affected versions

- v0 release line: `@langchain/langgraph<=0.4.9`, `@langchain/langgraph-checkpoint<=0.1.2`
- v1 release line: `@langchain/langgraph<=1.4.11`, `@langchain/langgraph-checkpoint<=1.1.3`

## Remediation

Upgrade to a patched release of `@langchain/langgraph-checkpoint` and update direct checkpoint consumers to require the patched version line.

Until upgrading is possible:

- do not persist untrusted structured objects in checkpoint metadata or message state
- restrict run/thread creation and checkpoint-restoration endpoints to trusted callers
- do not treat authentication as a substitute for upgrading, because any authorized caller able to plant structured checkpoint data may trigger the vulnerable path
- isolate the process and its credentials according to normal least-privilege practices

## References

- https://github.com/langchain-ai/langgraphjs/security/advisories/GHSA-j87f-x5h5-gr75

Page: https://cve.now/GHSA-J87F-X5H5-GR75

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
