LangChain: MongoDBChatMessageHistory query injection can allow cross-session access
## Impact `MongoDBChatMessageHistory` did not enforce the documented string type for session identifiers at runtime. In affected applications, a structured session identifier could be interpreted as a MongoDB query condition rather than as a literal identifier. Applications are affected when they pass untrusted session identifier input to `MongoDBChatMessageHistory` and store multiple users’ histories in the same collection. An attacker who can invoke chat-history operations may be able to read, modify, or delete another user’s stored conversation. Applications that derive the session identifier from an authenticated, server-controlled value and enforce its type are not affected by this path. ## Patches The issue is fixed in `@langchain/mongodb` version **1.3.1**. Users of affected versions should upgrade to version 1.3.1 or later. The patched version validates session identifiers at runtime and ensures they are compared as literal values in MongoDB queries. ## Workarounds If an immediate upgrade is not possible, applications must reject session identifiers that are not non-empty strings. Session identifiers should be derived from an authenticated, server-controlled value and must not be passed directly from an untrusted request field. Upgrading remains the recommended remediation.
- Products
- @langchain/mongodb
- Affected versions
- Not specified
- Fixed versions
- 1.3.1
- CVEs
- CVE-2026-106119
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 28 Oct 2026, 10:03 UTC · Revision 1
Source evidence
LangChain: MongoDBChatMessageHistory query injection can allow cross-session access
core-osv · Original sourcePublished 8 Oct 2026, 17:52 UTC
## Impact `MongoDBChatMessageHistory` did not enforce the documented string type for session identifiers at runtime. In affected applications, a structured session identifier could be interpreted as a MongoDB query condition rather than as a literal identifier. Applications are affected when they pass untrusted session identifier input to `MongoDBChatMessageHistory` and store multiple users’ histories in the same collection. An attacker who can invoke chat-history operations may be able to read, modify, or delete another user’s stored conversation. Applications that derive the session identifier from an authenticated, server-controlled value and enforce its type are not affected by this path. ## Patches The issue is fixed in `@langchain/mongodb` version **1.3.1**. Users of affected versions should upgrade to version 1.3.1 or later. The patched version validates session identifiers at runtime and ensures they are compared as literal values in MongoDB queries. ## Workarounds If an immediate upgrade is not possible, applications must reject session identifiers that are not non-empty strings. Session identifiers should be derived from an authenticated, server-controlled value and must not be passed directly from an untrusted request field. Upgrading remains the recommended remediation.
osv:GHSA-m6rx-h84q-8r95
@langchain/mongodb
Fixed versions: 1.3.1
Complete source record
{
"id": "692cf2efe89c329958221f76a902d7f0486eaa5d10930d51cb22a4e097e256a9",
"url": "https://osv.dev/vulnerability/GHSA-m6rx-h84q-8r95",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "LangChain: MongoDBChatMessageHistory query injection can allow cross-session access",
"summary": "## Impact `MongoDBChatMessageHistory` did not enforce the documented string type for session identifiers at runtime. In affected applications, a structured session identifier could be interpreted as a MongoDB query condition rather than as a literal identifier. Applications are affected when they pass untrusted session identifier input to `MongoDBChatMessageHistory` and store multiple users’ histories in the same collection. An attacker who can invoke chat-history operations may be able to read, modify, or delete another user’s stored conversation. Applications that derive the session identifier from an authenticated, server-controlled value and enforce its type are not affected by this path. ## Patches The issue is fixed in `@langchain/mongodb` version **1.3.1**. Users of affected versions should upgrade to version 1.3.1 or later. The patched version validates session identifiers at runtime and ensures they are compared as literal values in MongoDB queries. ## Workarounds If an immediate upgrade is not possible, applications must reject session identifiers that are not non-empty strings. Session identifiers should be derived from an authenticated, server-controlled value and must not be passed directly from an untrusted request field. Upgrading remains the recommended remediation.",
"evidence": "osv:GHSA-m6rx-h84q-8r95",
"products": [
{
"name": {
"value": "@langchain/mongodb",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "1.3.1",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
}
],
"severity": "medium",
"structured": {
"id": "GHSA-m6rx-h84q-8r95",
"aliases": [
"CVE-2026-106119",
"GHSA-m6rx-h84q-8r95"
],
"metrics": [
{
"type": "CVSS_V4",
"score": "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"
}
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0"
},
{
"fixed": "1.3.1"
}
]
}
],
"package": {
"name": "@langchain/mongodb",
"purl": "pkg:npm/%40langchain/mongodb",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-m6rx-h84q-8r95/GHSA-m6rx-h84q-8r95.json",
"last_known_affected_version_range": "<= 1.3.0"
}
}
],
"modified": "2026-10-08T18:00:08.902627724Z",
"provider": "osv",
"references": [
"https://github.com/langchain-ai/langchainjs/security/advisories/GHSA-m6rx-h84q-8r95",
"https://nvd.nist.gov/vuln/detail/CVE-2026-106119",
"https://github.com/langchain-ai/langchainjs/pull/11672",
"https://github.com/langchain-ai/langchainjs/commit/946e3d856ff1f8ce7f7b9374c83f680a6ada79af",
"https://github.com/langchain-ai/langchainjs",
"https://github.com/langchain-ai/langchainjs/releases/tag/@langchain/mongodb@1.3.1"
],
"provider_metadata": {
"cwe_ids": [
"CWE-943"
],
"severity": "MODERATE",
"github_reviewed": true,
"nvd_published_at": "2026-10-06T19:17:42Z",
"github_reviewed_at": "2026-10-08T17:52:22Z"
}
},
"related_cves": [
{
"value": "CVE-2026-106119",
"evidence": "/aliases"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 104433,
"published_at": "2026-10-08T17:52:22+00:00"
}