Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAuthenticate and invoke chat-history API
-
ExploitSupply MongoDB operator object as sessionId
-
ExecutionFilter matches other users' documents
-
ImpactRead, modify, or delete victim conversations
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Query language parameterization
|
| Exploitation Conditions | Exploitation requires a specific deployment: multiple users' chat histories stored in one shared MongoDB collection AND an application that feeds an untrusted, attacker-controllable structured sessionId (a JS object, not a validated string) into MongoDBChatMessageHistory in @langchain/mongodb before 1.3.1. The attacker must be an authenticated low-privilege user (PR:L) able to invoke chat-history read/add/clear operations and able to supply a non-string sessionId such as {$regex:...} or {$ne:null}. LIMITING FACTORS: applications that derive sessionId from an authenticated, server-controlled string (the documented correct usage) are not affected; per-user/isolated collections also neutralize cross-tenant impact; and the AT:P attack requirement reflects that the vulnerable wiring is non-default rather than guaranteed. |
| Impact | This is a moderate-severity NoSQL injection (CWE-943) whose real-world risk is tightly gated by deployment architecture rather than being a broad, drive-by threat. The vendor CVSS 4.0 vector (AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:L/VA:N) scores 6.0: network-reachable and low-complexity, but with an explicit attack requirement (AT:P) and a required low-privilege foothold (PR:L), meaning the attacker must already be an authenticated participant able to invoke chat-history operations. No EPSS score was provided in the input and the CVE is not listed in CISA KEV, so there is no signal of automated or widespread exploitation. There is no separately flagged weaponized POC, but the fix PR (#11672) ships a regression test that publicly demonstrates the exact injection technique (passing {$regex:'^victim-'} or {$ne:null} as sessionId), so the mechanism is openly documented. The confidentiality impact is genuinely high (VC:H - reading other users' conversations), while integrity is rated low and availability nil. Net: this is a real, patch-worthy issue for any multi-tenant application that stores several users' histories in one shared MongoDB collection AND wires an untrusted structured sessionId into it - but it is explicitly not exploitable for applications using authenticated, server-controlled string identifiers, which is the documented safe pattern. Treat it as a targeted, configuration-dependent flaw rather than a universally critical one. |
| Exploit ScenarioDerived | A multi-tenant LLM application stores every user's chat history in a single shared MongoDB collection and passes a client-supplied sessionId value straight into MongoDBChatMessageHistory without validating it is a string. An authenticated low-privilege attacker submits a sessionId that is a MongoDB operator object such as {"$regex":"^victim-"} or {"$ne":null}, causing the query filter to match other users' documents so the attacker can read, overwrite, or clear victim conversations. No standalone weaponized exploit is published, but the fix commit's regression test publicly demonstrates the technique. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 06, 2026
NoSQL injection in the @langchain/mongodb provider (part of langchainjs) before version 1.3.1 lets an authenticated low-privilege user read, modify, or delete another user's stored conversation history when multiple users' chat histories live in a shared MongoDB collection and the application passes an untrusted, attacker-controllable structured sessionId into MongoDBChatMessageHistory. The root cause is that the documented string type for sessionId is only enforced by TypeScript at compile time and is erased at runtime, so a value such as {$regex: "^victim-"} is handed straight into the MongoDB query filter and interpreted as a query operator rather than a literal identifier. Impact is tightly gated: applications that derive sessionId from an authenticated, server-controlled string (the documented correct usage) or that isolate histories per user are not affected, and no public exploit code was identified at time of analysis, with no confirmed active exploitation (CISA KEV).
RemediationAI
Vendor-released patch: upgrade @langchain/mongodb to 1.3.1 (release: https://github.com/langchain-ai/langchainjs/releases/tag/@langchain/mongodb@1.3.1), which enforces a runtime non-empty-string check on sessionId and wraps all query filters in $eq; the underlying change is in PR #11672 / commit 946e3d8 and the advisory is GHSA-m6rx-h84q-8r95. Be aware the fix is deliberately breaking: sessionId: "" now throws TypeError instead of silently operating, so audit call sites and supply a real non-empty identifier. If immediate upgrade is not possible, the effective compensating controls are architectural with known trade-offs: never pass a request field directly as sessionId - coerce and validate it to a non-empty string server-side (e.g., map the incoming request to a session record the server already authenticated) and reject objects, arrays, or empty values before constructing MongoDBChatMessageHistory (trade-off: requires touching every chat-history call site and misses any path that bypasses the wrapper); or move each user's history into a per-user collection or database namespace so operator-bearing identifiers cannot reach another tenant's documents (trade-off: schema/migration effort and higher collection count with operational overhead). Applying an explicit { idKey: { $eq: sessionId } } filter in application code mirrors the upstream fix but is easy to omit on future query paths, so treat it as temporary. No public exploit code was identified at time of analysis, but the affected versions remain installed wherever the runtime type check is absent, so prioritize upgrading any multi-tenant deployment that accepts session identifiers from end users.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 3 packages in npm, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The affected component is the MongoDB-backed chat memory module of langchainjs, published as @langchain/mongodb (CPE: cpe:2.3:a:@langchain:mongodb and the parent cpe:2.3:a:langchain-ai:langchainjs). MongoDBChatMessageHistory builds MongoDB find, deleteOne, and insert filters of the form { [idKey]: this.sessionId }; because the interface declares sessionId as a TypeScript string, developers are led to believe the value is validated, but TypeScript types are compile-time only and disappear at runtime. This is CWE-943 (Improper Neutralization of Special Elements in Data Query Logic), the NoSQL-injection analogue of SQL injection: if the calling application forwards a request-supplied object such as {$regex: "^victim-"}, {$ne: null}, or an array, MongoDB treats it as an operator expression, allowing the query to match documents belonging to other sessions in the same collection. The upstream fix (PR #11672, commit 946e3d8) hardens two ways: it adds a runtime guard that throws a TypeError when sessionId is not a non-empty string, and it rewrites every filter to wrap the identifier in an explicit $eq operator so that even a bypassed type check cannot express an operator payload. The same $eq wrapping was applied defensively to MongoDBCache in cache.ts. The patch also carries an intentional breaking change: an empty-string sessionId, which previously silently worked, now throws.
Know when Langchain gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N
Authenticated low-priv attacker (PR:L) over the network reads other users' histories (C:H); modify/delete give limited integrity (I:L); no availability or scope change.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
1DescriptionCVE.org
LangChain is a framework for building LLM-powered applications. Prior to 1.3.1, MongoDBChatMessageHistory does not enforce the documented string type for an untrusted structured session identifier at runtime, allowing the identifier to be interpreted as a MongoDB query condition rather than as a literal value when multiple users' histories are stored in a shared MongoDB collection. An attacker able to invoke chat-history operations can read, modify, or delete another user's stored conversation. Applications using authenticated, server-controlled string identifiers are not affected. This issue is fixed in version 1.3.1.
Blast Radius
ecosystem impact- 2 npm packages depend on @langchain/mongodb (2 direct, 0 indirect)
Ecosystem-wide dependent count for version 1.3.1.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
NoSQL injection exploits databases that don't use traditional SQL syntax-like MongoDB, CouchDB, or Redis-by manipulating queries through unsanitized user input.
Code injection in Langflow CSV Agent node before 1.8.0. The node hardcodes allow_dangerous_code=True, enabling arbitrary
An issue in Harrison Chase langchain v.0.0.194 allows an attacker to execute arbitrary code via the python exec calls in
A remote code execution vulnerability in langchain-ai/langchain (CVSS 10.0). Risk factors: public PoC available. Vendor
A vulnerability in the GraphCypherQAChain class of langchain-ai/langchain version 0.2.5 allows for SQL injection through
A vulnerability in the GraphCypherQAChain class of langchain-ai/langchainjs versions 0.2.5 and all versions with this cl
langchain_experimental (aka LangChain Experimental) 0.1.17 through 0.3.0 for LangChain allows attackers to execute arbit
A vulnerability was found in LangChain langchain_community 0.0.26. Rated critical severity (CVSS 9.8), this vulnerabilit
An issue in LanChain-ai Langchain v.0.0.245 allows a remote attacker to execute arbitrary code via the evaluate function
An issue in langchain v.0.0.171 allows a remote attacker to execute arbitrary code via a JSON file to load_prompt. Rated
An issue in langchain langchain-ai v.0.0.232 and before allows a remote attacker to execute arbitrary code via a crafted
An issue in Harrison Chase langchain v.0.0.194 and before allows a remote attacker to execute arbitrary code via the fro
An issue in LangChain v.0.0.231 allows a remote attacker to execute arbitrary code via the prompt parameter. Rated criti
EUVD-2026-93771
GHSA-m6rx-h84q-8r95
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB