CVE-2026-48121: LangGraph MongoDB: NoSQL injection leaks tenant checkpoints
GHSA-98xf-r82g-9mhx MEDIUMA NoSQL injection flaw in `@langchain/langgraph-checkpoint-mongodb` (≤1.3.0) allows attackers to bypass multi-tenant isolation by injecting MongoDB query operators — such as `$gt` or `$ne` — into checkpoint identifier fields that flow unvalidated into database queries. With 3,296 downstream npm dependents, any multi-tenant LangGraph JS application that passes user-controlled values into `config.configurable` (thread_id, checkpoint_ns, checkpoint_id) without prior string coercion is exposed to cross-tenant checkpoint state disclosure, including agent conversation history, metadata, and pending writes. No public exploit code exists and EPSS data is unavailable, but the attack pattern is trivial to execute against any affected endpoint — an attacker needs only to supply a JSON object with MongoDB operators where a string identifier is expected. Upgrade immediately to `@langchain/langgraph-checkpoint-mongodb@1.3.1`, which adds runtime validation rejecting non-string identifiers before any query path executes.
What is the risk?
CVSS 6.7 Medium with an Adjacent attack vector reduces headline severity, but real-world exposure depends entirely on deployment topology. In cloud-hosted multi-tenant agent platforms where API consumers can influence graph invocation parameters, the effective risk is HIGH — an authenticated but low-privileged user can read another tenant's checkpoint state with a single crafted request. The low attack complexity and absence of any exploit barrier (no tooling required, operator payloads are trivial JSON) elevate practical risk above the CVSS score suggests. Applications using exclusively server-generated thread identifiers are not affected. Applications sourcing identifiers from request bodies or query parameters without schema validation are immediately exposed.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| LangGraph | npm | <= 1.3.0 | 1.3.1 |
Do you use LangGraph? You're affected.
How severe is it?
What is the attack surface?
What should I do?
6 steps-
Patch immediately: Upgrade to
@langchain/langgraph-checkpoint-mongodb@1.3.1— the patch adds runtime validation rejecting non-string checkpoint identifier values before query execution. No API changes are required for valid callers. -
Input validation at API boundaries: Enforce strict string type validation on
thread_id,checkpoint_ns, andcheckpoint_idbefore passing values intoconfig.configurable. Reject requests containing objects or arrays for these fields. -
Schema enforcement: Add JSON schema or Zod validation middleware to reject non-primitive identifier fields at the route handler level, before values reach LangGraph invocation.
-
Audit existing logs: Review application logs for requests where identifier fields contained JSON objects — this pattern indicates prior exploitation attempts.
-
Workaround if patching is delayed: Coerce all configurable identifier fields to strings (
String(value)) at the point where user input entersconfig.configurable. -
Detection: Alert on MongoDB queries containing operator keys (
$gt,$ne,$regex, etc.) in fields expected to hold string identifiers.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-48121?
A NoSQL injection flaw in `@langchain/langgraph-checkpoint-mongodb` (≤1.3.0) allows attackers to bypass multi-tenant isolation by injecting MongoDB query operators — such as `$gt` or `$ne` — into checkpoint identifier fields that flow unvalidated into database queries. With 3,296 downstream npm dependents, any multi-tenant LangGraph JS application that passes user-controlled values into `config.configurable` (thread_id, checkpoint_ns, checkpoint_id) without prior string coercion is exposed to cross-tenant checkpoint state disclosure, including agent conversation history, metadata, and pending writes. No public exploit code exists and EPSS data is unavailable, but the attack pattern is trivial to execute against any affected endpoint — an attacker needs only to supply a JSON object with MongoDB operators where a string identifier is expected. Upgrade immediately to `@langchain/langgraph-checkpoint-mongodb@1.3.1`, which adds runtime validation rejecting non-string identifiers before any query path executes.
Is CVE-2026-48121 actively exploited?
No confirmed active exploitation of CVE-2026-48121 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-48121?
1. Patch immediately: Upgrade to `@langchain/langgraph-checkpoint-mongodb@1.3.1` — the patch adds runtime validation rejecting non-string checkpoint identifier values before query execution. No API changes are required for valid callers. 2. Input validation at API boundaries: Enforce strict string type validation on `thread_id`, `checkpoint_ns`, and `checkpoint_id` before passing values into `config.configurable`. Reject requests containing objects or arrays for these fields. 3. Schema enforcement: Add JSON schema or Zod validation middleware to reject non-primitive identifier fields at the route handler level, before values reach LangGraph invocation. 4. Audit existing logs: Review application logs for requests where identifier fields contained JSON objects — this pattern indicates prior exploitation attempts. 5. Workaround if patching is delayed: Coerce all configurable identifier fields to strings (`String(value)`) at the point where user input enters `config.configurable`. 6. Detection: Alert on MongoDB queries containing operator keys (`$gt`, `$ne`, `$regex`, etc.) in fields expected to hold string identifiers.
What systems are affected by CVE-2026-48121?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, stateful multi-tenant AI agents, LangGraph JS applications with MongoDB persistence, multi-tenant LLM chat applications.
What is the CVSS score for CVE-2026-48121?
CVE-2026-48121 has a CVSS v3.1 base score of 6.7 (MEDIUM).
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0036 Data from Information Repositories AML.T0049 Exploit Public-Facing Application AML.T0080 AI Agent Context Poisoning Compliance Controls Affected
What are the technical details?
Original Advisory
## 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: ```ts 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 - Issue: https://github.com/langchain-ai/langgraphjs/issues/2351 - Fix PR: https://github.com/langchain-ai/langgraphjs/pull/2397
Exploitation Scenario
An attacker registered as a standard user on a multi-tenant LangGraph-based AI agent platform crafts an API request to the agent invocation endpoint. Instead of passing a valid string `thread_id`, they supply a JSON body with `{"thread_id": {"$gt": ""}, "checkpoint_ns": {"$ne": null}}`. The backend forwards this payload directly into `config.configurable` without type coercion. `MongoDBSaver.getTuple()` constructs a `find()` query using these operator payloads, causing MongoDB to return the first matching checkpoint across all tenants rather than the attacker's scoped thread. The attacker receives another user's full agent checkpoint state — including conversation history, intermediate tool results, and any sensitive data embedded in the state graph — with no privilege escalation required beyond their existing authenticated session.
Weaknesses (CWE)
CWE-943 — 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.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:A/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N References
Timeline
Related Vulnerabilities
CVE-2025-64104 7.3 langgraph-checkpoint-sqlite: SQL Injection exposes database
Same package: langgraph CVE-2025-67644 7.3 langgraph-checkpoint-sqlite: SQL Injection exposes database
Same package: langgraph CVE-2025-8709 7.3 langgraph-checkpoint-sqlite: SQL Injection exposes database
Same package: langgraph CVE-2026-28277 6.8 langgraph: Deserialization enables RCE
Same package: langgraph CVE-2026-27794 6.6 langgraph-checkpoint: Deserialization enables RCE
Same package: langgraph