AAK-MCP-LANGCHAIN-MONGO-CVE-2026-106119-001: LangChain.js MongoDB chat history through 1.3.0: an object session id reaches another user's conversation
- Severity
- MEDIUM
- Category
- Supply Chain (
supply-chain) - Scanner
agent_audit_kit/scanners/mcp_cve_pins_2026_07.py- Auto-fixable
- No.
- SARIF name
LangChainMongoChatHistoryQueryInjection
What it detects
@langchain/mongodb's MongoDBChatMessageHistory keeps agent conversations in MongoDB, keyed by session id. Through 1.3.0 it put the session id into its findOne, updateOne and deleteOne filters as given, without enforcing the documented string type, so a structured id was read as a query condition. Where several users' histories share one collection, a caller who controls the id can read, change or delete another user's conversation (CVE-2026-106119, CVSS 4.0 6.0, CWE-943, GHSA-m6rx-h84q-8r95). An application that passes only authenticated, server-controlled string ids is not affected. 1.3.1 rejects a non-string id and wraps it in $eq (langchainjs#11672).
How to fix
Upgrade @langchain/mongodb to 1.3.1 or later and pin it. Until then, give MongoDBChatMessageHistory only a session id your server derives as a string, never one taken from a request.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-LANGCHAIN-MONGO-CVE-2026-106119-001
Limitations
Reports @langchain/mongodb below 1.3.1 where a package.json, lockfile or MCP config states the version, taking the lowest version a range allows. latest and other tags state no version and are not reported. It reads the version, not where the session id comes from, so a project that passes only server-side string ids is reported without being exposed. The Python langchain-mongodb is a different package and is not read. A file over 2 MB, or a lockfile over 32 MiB, is not read. A declaration nested more than 64 levels deep in package.json, a TOML manifest or an MCP config (an MCP server more than 62) is still judged, and reported without a line; a lockfile entry keeps its line at any depth.
References
- CVE: CVE-2026-106119
- OWASP Agentic Top 10: ASI04 (Agentic Supply Chain Vulnerabilities), ASI06 (Memory & Context Poisoning)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-SUPPLY-04 (Known Vulnerable Dep)
- CSA AI Controls Matrix (AICM): STA-08, AIS-07, DSP-04
All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-LANGCHAIN-MONGO-CVE-2026-106119-001.md: the page then shows that text, with the registry reference appended under it.