Case · DiggingBeagle record

LangChain MongoDB chat history accepted query-shaped session IDs across user boundaries

GHSA-m6rx-h84q-8r95 describes query injection through untrusted structured MongoDBChatMessageHistory session IDs, with cross-user conversation exposure possible under shared-collection conditions.

Scope

@langchain/mongodb through 1.3.0, only where callers can control structured session IDs and multiple users store histories in the same collection; fixed in 1.3.1.

Assessment profile

Assessment method
Exploitation
not established
Evidence
Grade B
Remediation
patch available
AI role
AGAINST AI
Basis and provenance

Maintainer-origin GHSA establishes a conditional cross-session query-injection defect and the 1.3.1 fixed release. The demonstrated technical precondition is a user-controlled structured session value in a shared MongoDB collection, not a confirmed customer compromise.

Assessed Oct 11, 2026 using diggingbeagle.assessment/1.

At a glance

Mechanism and trust boundary

  1. 01

    User-controlled session ID

    An application forwards an untrusted structured value as a supposed chat-session identifier.

    Boundary: External request value to MongoDB query construction

  2. 02

    Shared conversation collection

    The structured value changes the query and may select another user’s chat history.

    Boundary: One user chat-session identity to another user stored memory

Timeline

  1. Oct 5, 2026
    disclosure

    Maintainer advisory and 1.3.1 fix

    Advisory described structured session ID injection and identified the fixed @langchain/mongodb version.

Claims & evidence

CLM-LC-PATCHThe affected @langchain/mongodb versions are through 1.3.0 and the advisory names version 1.3.1 as patched.supported

Basis: reported finding

Link to claim
CLM-LC-EXPOSURE-PREREQCross-user reads, changes or deletion are possible only for applications passing untrusted identifiers to chat-history operations and storing users’ histories in a shared collection; server-controlled typed identifiers avoid this path.supported

Basis: reported finding

Link to claim
CLM-LC-QUERY-IDENTIFIERThe LangChain advisory states that MongoDBChatMessageHistory could treat an untrusted structured session identifier as a MongoDB query condition rather than a literal string.supported

Basis: reported finding

Link to claim

Implications

Upgrading @langchain/mongodb to 1.3.1 fixes the disclosed adapter behavior. Independently binding chat-history lookups to a server-derived authenticated principal, a strict scalar session ID and tenant-specific authorization guards against applications passing attacker-shaped query objects; a package patch alone does not implement each application’s tenant separation policy.

Unknowns and contradictions

  • Whether the vulnerable class was exposed in widely deployed agent products.
  • Confirmed application-level data exposure or victim prevalence.
  • Whether similar memory adapters enforce session tenancy server-side.

Sources and citation

Material revision history

  1. Oct 11, 2026 · Published version · first publication · revision 123