LangChain4j vulnerability lets attackers read other tenants’ RAG documents

A metadata filter injection in five LangChain4j vector stores can let request JSON or LLM tool output read other tenants' documents or delete rows. Which versions fix it, when an app is exploitable and what Java teams should check.

Christopher Ort
By i10X News Desk · Reviewed by Christopher Ort · 4 min read
Share
LangChain4j vulnerability illustration: stacked glowing document cards in a vector database with one tenant's stack leaking into another
Image: AI-generated, i10X
On this page
  1. Which LangChain4j stores and versions are affected
  2. When a RAG app is actually exploitable
  3. A checklist for Java teams using LangChain4j
  4. One step further: the second LangChain4j filter injection in six months

LangChain4j, a popular open source Java library for building LLM and RAG applications (about 13,500 stars on GitHub), had a query injection flaw in the metadata filters of five of its vector store integrations. In a multi tenant app, an attacker who can shape a filter value could read documents that belong to other customers, or wipe the store. The project describes the issue in a GitHub security advisory (GHSA-6wgf-c23j-fj2v) and fixed it in four release lines; NVD lists it as CVE-2026-145153 with a CVSS score of 8.1. The twist for AI apps: the hostile value does not have to come from a web form. It can come from the model itself, through tool output.

Which LangChain4j stores and versions are affected

The bug sits in how the pgvector, MariaDB, Milvus (both modules), MongoDB Atlas and Chroma stores turned a metadata Filter into a database query. Values that were not plain strings were written into the query text with toString() and no escaping, and the MongoDB and Chroma stores wrote equality in a short form that let a map value act as a query operator. Both search (including pgvector hybrid search) and removeAll(Filter) are affected.

Fixed builds, by release line:

  • 1.23.0-beta33 (current line; this release also adds a value check in langchain4j-core)
  • 1.19.4-beta29
  • 1.11.12-beta19
  • 1.5.4-beta11

Newer builds such as 1.24.1-beta34 are already on Maven Central. Note one special case: on langchain4j-pgvector before 1.11.0, even plain string values in isIn and isNotIn were not escaped, so careful typing does not protect those versions. Upgrading is the only fix there.

When a RAG app is actually exploitable

Not every LangChain4j app is at risk. The flaw needs untrusted data that reaches a filter as a list, a map, a JsonNode or another object instead of a clean string or number. Two common patterns do exactly that:

  • Filters built from request JSON. An endpoint that takes {"category": ...} and passes the parsed value straight into new IsEqualTo(...) or isIn(...) lets the caller send a nested list or a map instead of a string.
  • Filters built from LLM tool output. If the model picks filter values through a tool call and those arguments flow into the filter untyped, a prompt injection hidden in a retrieved document or a user message can steer the model into emitting an operator such as {"$ne": "x"}. That cancels the tenant condition the app added with and(...). Prompt injection defenses still miss this kind of quiet task tampering, as an Amazon study on injection defenses showed.

Apps that build filters only from strings, numbers, UUIDs or booleans with the typed builder methods are not affected (apart from old pgvector), and neither are filters produced by LanguageModelSqlFilterBuilder, which only emits strings, longs and doubles. The CVSS vector rates attack complexity as high for that reason: the risk depends on how the app is written. When it applies, though, the result is the worst outcome for a shared vector store, cross tenant reads, the same class of harm as the Cloudflare Workers AI leak that returned other tenants’ data.

A checklist for Java teams using LangChain4j

  • Find the version. Run mvn dependency:tree | grep langchain4j or gradle dependencies | grep langchain4j and compare the store modules against the fixed builds above.
  • Search the code for filter construction. Look for new IsEqualTo(, new IsIn(, isIn( and isNotIn( and trace where each value comes from. Anything typed as Object, Map, List or JsonNode that originates from a request or a tool call is a candidate.
  • Convert before you filter. Until you can upgrade, turn every value into a String, number, UUID or Boolean explicitly and reject anything else. The maintainers give the same advice.
  • Treat removeAll(Filter) as dangerous. Never let a user or a model influence the filter of a delete call, and keep backups of embedding stores you cannot rebuild cheaply.
  • Enforce tenancy below the filter. A separate collection, schema or database role per tenant (for pgvector, row level security) keeps one broken filter from exposing everyone.

After the fix, pgvector and MariaDB pass filter values as JDBC parameters, Milvus accepts only supported value types, and MongoDB Atlas and Chroma write an explicit $eq. The extra value check in langchain4j-core 1.23.0 is left out of the backports because it can break existing code, so teams on older lines get the store fixes but not the central guard. More database injection flaws in AI tooling are on our AI Security tracker.

One step further: the second LangChain4j filter injection in six months

This is the second time this year that LangChain4j’s metadata filters let input rewrite a database query. On 17 June 2026 the project published GHSA-2mfg-cc43-9pcj (CVE-2026-55405): in the pgvector and MariaDB stores, filter keys were concatenated into SQL, and in MariaDB string values could escape with a trailing backslash. That fix addressed keys and one escaping gap. The new advisory, 170 days later by our count, covers the values that were not strings, plus the MongoDB Atlas, Chroma and Milvus stores. The underlying cause is the same: building query text by hand instead of using parameters. Only the 4 December fix moves pgvector and MariaDB to bound JDBC parameters.

The consequences reach beyond the developer who wrote the filter. In a SaaS product that keeps all customers in one vector store, the people exposed are the customers whose contracts, tickets or files were embedded, and who have no way to see which filter the vendor used. Operators face a second risk: an injected condition in removeAll can delete every row, and re-embedding a large corpus costs time and API spend. Still open: neither advisory reports exploitation in the wild, and it is unknown how many applications pass loosely typed values into filters.

How we checked

Checked on 4 December 2026, 19:20 CET.

  • Read the LangChain4j advisories GHSA-6wgf-c23j-fj2v (4 December 2026) and GHSA-2mfg-cc43-9pcj (17 June 2026) and the NVD record for CVE-2026-145153.
  • Checked the fixed and newer versions in the Maven Central metadata for langchain4j-pgvector on 4 December 2026.
  • The 170 day gap is our own calculation. The checklist commands are standard Maven and Gradle tooling, not from the advisory. We did not reproduce the injection ourselves.
Christopher Ort

Christopher Ort

Christopher Ort is the editor of i10X News at i10x.ai. He has worked hands-on with AI tools, models and agent workflows for years and leads i10X’s coverage of AI launches, funding and research. He is the author of “The Style Penalty”, an SSRN study on how frontier AI models judge AI-written CVs, covered by heise online and t3n.

Editor's picks

  1. Copilot Fusion Tops Coding Agent Index at $4.13 a Task: Who Gets Fusion Max
  2. Amazon FAR-1: 62B Robot Model Already Runs 500 Robots, but No One Else Can Use It
  3. Anthropic Pretraining Loss Curve: Why Kaplan Says Loss Alone Can’t Pace AI
  4. LangChain4j vulnerability lets attackers read other tenants’ RAG documents
  5. PraisonAI vulnerability lets attackers run agent tools on open servers