Skip to main content

LangChain MongoDB EUVDEUVD-2026-93771

| CVE-2026-106119 MEDIUM
Improper Neutralization of Special Elements in Data Query Logic (CWE-943)
2026-10-06 GitHub_M GHSA-m6rx-h84q-8r95
6.0
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Authenticate and invoke chat-history API
  2. Exploit
    Supply MongoDB operator object as sessionId
  3. Execution
    Filter matches other users' documents
  4. Impact
    Read, 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.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.5% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

MongoDB < 1.3.1
langchainjs < 1.5.14

Affected Packages

npm @langchain/mongodb fix: 1.3.1
euvd langchainjs fix: 1.5.14
euvd mongodb fix: 1.3.1

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

Vendor (GitHub_M) PRIMARY 6.0 MEDIUM
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
vuln.today AI 7.1 HIGH

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.

3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N
4.0 AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
Low
User Interaction
None
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
Low
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

1
Patch available
Oct 06, 2026 - 20:04 EUVD

DescriptionCVE.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
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 2 npm packages depend on @langchain/mongodb (2 direct, 0 indirect)

Ecosystem-wide dependent count for version 1.3.1.

Threat Intelligence Overview

EPSS Score
0.5%
Top 62% exploitable
Prevalence
Medium
widely-used LLM framework, but needs specific shared-collection MongoDB chat-history integration
Threat Intel
1
1 source
Data Quality
4 sources
Confidence: Medium
EUVD NVD CVE.org EPSS Vulnrichment GHSA GitHub

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.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.5%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

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.

CVE-2026-27966 CRITICAL POC
9.8 Feb 26

Code injection in Langflow CSV Agent node before 1.8.0. The node hardcodes allow_dangerous_code=True, enabling arbitrary

CVE-2023-36095 CRITICAL POC
9.8 Aug 05

An issue in Harrison Chase langchain v.0.0.194 allows an attacker to execute arbitrary code via the python exec calls in

CVE-2025-2828 CRITICAL POC
10.0 Jun 23

A remote code execution vulnerability in langchain-ai/langchain (CVSS 10.0). Risk factors: public PoC available. Vendor

CVE-2024-8309 CRITICAL POC
9.8 Oct 29

A vulnerability in the GraphCypherQAChain class of langchain-ai/langchain version 0.2.5 allows for SQL injection through

CVE-2024-7042 CRITICAL POC
9.8 Oct 29

A vulnerability in the GraphCypherQAChain class of langchain-ai/langchainjs versions 0.2.5 and all versions with this cl

CVE-2024-46946 CRITICAL POC
9.8 Sep 19

langchain_experimental (aka LangChain Experimental) 0.1.17 through 0.3.0 for LangChain allows attackers to execute arbit

CVE-2024-2057 CRITICAL POC
9.8 Mar 01

A vulnerability was found in LangChain langchain_community 0.0.26. Rated critical severity (CVSS 9.8), this vulnerabilit

CVE-2023-39631 CRITICAL POC
9.8 Sep 01

An issue in LanChain-ai Langchain v.0.0.245 allows a remote attacker to execute arbitrary code via the evaluate function

CVE-2023-36281 CRITICAL POC
9.8 Aug 22

An issue in langchain v.0.0.171 allows a remote attacker to execute arbitrary code via a JSON file to load_prompt. Rated

CVE-2023-39659 CRITICAL POC
9.8 Aug 15

An issue in langchain langchain-ai v.0.0.232 and before allows a remote attacker to execute arbitrary code via a crafted

CVE-2023-38896 CRITICAL POC
9.8 Aug 15

An issue in Harrison Chase langchain v.0.0.194 and before allows a remote attacker to execute arbitrary code via the fro

CVE-2023-38860 CRITICAL POC
9.8 Aug 15

An issue in LangChain v.0.0.231 allows a remote attacker to execute arbitrary code via the prompt parameter. Rated criti

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy