Skip to content

LangGraph has NoSQL parameter injection in MongoDBSaver, allowing cross-tenant state access

Moderate severity GitHub Reviewed Published May 21, 2026 in langchain-ai/langgraphjs

Package

npm @langchain/langgraph-checkpoint-mongodb (npm)

Affected versions

<= 1.3.0

Patched versions

1.3.1

Description

Summary

A NoSQL injection vulnerability existed in MongoDBSaver where checkpoint identifier fields from config.configurable were used in MongoDB queries without strict type enforcement. In vulnerable versions, attacker-controlled object payloads (for example MongoDB operators like $gt and $ne) could be interpreted as query operators instead of literal identifier values.

This could bypass intended thread scoping and return checkpoints from other tenants.

Attack surface

The vulnerable path was in MongoDBSaver.getTuple(), where thread_id, checkpoint_ns, and checkpoint_id were used in MongoDB find() queries. The same unvalidated values were then reused to fetch pending writes.

Applications were exposed when untrusted input was forwarded into config.configurable (for example, directly from request bodies or query parameters) without string coercion or schema validation.

Who is affected?

Applications are vulnerable if they:

  • Use @langchain/langgraph-checkpoint-mongodb with multi-tenant or user-isolated thread models.
  • Accept user-controlled values for thread_id, checkpoint_ns, or checkpoint_id.
  • Pass those values into app.invoke(), app.stream(), or direct saver methods without validation.

Applications are generally not vulnerable if they:

  • Use server-issued identifiers only.
  • Source thread_id from trusted URL params that remain strings.
  • Enforce schema validation that rejects non-string identifier fields.

Impact

An attacker with control over configurable checkpoint identifiers could read checkpoint data outside their authorized thread boundary.

Potentially exposed data includes:

  • Checkpoint state
  • Metadata
  • Pending writes

This is a confidentiality issue with cross-tenant data disclosure risk.

Exploit example

An attacker-controlled request can inject MongoDB operators:

graph = new StateGraph(...)
  .compile({
    checkpointer: new MongoDBSaver()
  });

graph.invoke(..., {
  configurable: {  
    "thread_id": { "$gt": "" },
    "checkpoint_ns": { "$ne": null }
  }
});

If this payload is forwarded into config.configurable, the resulting query may match checkpoints outside the intended tenant/thread scope.

Security hardening changes

Version 1.3.1 hardens @langchain/langgraph-checkpoint-mongodb by adding runtime validation for configurable checkpoint identifiers and rejecting invalid values before MongoDB query/write paths execute.

The patch also includes regression tests covering object/operator payloads across affected methods.

Migration guide

Upgrade to @langchain/langgraph-checkpoint-mongodb@1.3.1 or later.

No API migration is required for valid callers. However, applications that currently pass non-string identifier values in config.configurable will now receive explicit errors and should normalize/validate inputs.

As defense in depth, validate identifier fields at API boundaries and avoid passing raw client objects into graph config.

Resources

References

@hntrl hntrl published to langchain-ai/langgraphjs May 21, 2026
Published to the GitHub Advisory Database Jun 12, 2026
Reviewed Jun 12, 2026

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Adjacent
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:A/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(8th percentile)

Weaknesses

Improper Neutralization of Special Elements in Data Query Logic

The product generates a query intended to access or manipulate data in a data store such as a database, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended logic of the query. Learn more on MITRE.

CVE ID

CVE-2026-48121

GHSA ID

GHSA-98xf-r82g-9mhx

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.