79% vs 51%: independent neobanks lag on app security. Read the report

Deep Dive

Deep Dive

LangChain4j Metadata Filter SQL Injection (CVE-2026-145153)

LangChain4j wrote non-string metadata filter values into vector-store queries, letting crafted filters read other tenants' data; fixed in 1.23.0.

TL;DR

  • LangChain4j wrote non-string metadata filter values into vector-store queries with toString(), so a list or map can change the query. CVE-2026-145153 is CVSS v4.0 9.2 Critical (VulnCheck CNA) and CVSS v3.1 8.1 High (GitHub).
  • The pgvector, MariaDB, Milvus, Milvus v2, MongoDB Atlas and Chroma integrations are affected in the ranges in the table. The central value check was added in 1.23.0.
  • No public proof of concept and no in-the-wild exploitation are reported. CISA's SSVC assessment records exploitation as none, and the CVE is not in the Known Exploited Vulnerabilities catalog, which was at version 2026.12.03 on 2026-12-04.
  • Upgrade to 1.23.0-beta33 or later, or to 1.19.4-beta29, 1.11.12-beta19 or 1.5.4-beta11 on an older line. "How do I fix it?" gives the dependency commands and the filter changes.

Am I affected?

You are affected if an application uses one of the vulnerable embedding-store integrations, passes a loosely typed value into a metadata filter, and reaches the affected operations. All of these must hold:

  • The application depends on a vulnerable langchain4j-pgvector, langchain4j-mariadb, langchain4j-milvus, langchain4j-milvus-v2, langchain4j-mongodb-atlas or langchain4j-chroma release.
  • The application builds a metadata filter from data an attacker can influence. The advisory names lists and maps parsed from request JSON, and values returned by a language model's tool calls.
  • A filter value is not a String, number, UUID or Boolean. A List, Map, JsonNode or StringBuilder reaches toString().
  • The application calls search, pgvector hybrid search, or removeAll(Filter) with that filter.

An application that builds every filter value with the typed MetadataFilterBuilder methods from a string, number, UUID or Boolean is not affected in the fixed lines. The exception is pgvector before 1.11.0: its isIn and isNotIn did not escape String values either, so a plain string could close the literal there.

Release line Affected versions Fixed version
1.20 to 1.22 1.20.0-beta30 to 1.22.0-beta32 1.23.0-beta33
1.12 to 1.19 1.12.1-beta21 to 1.19.3-beta29 1.19.4-beta29
1.6 to 1.11 1.6.0-beta12 to 1.11.11-beta19 1.11.12-beta19
1.5 and earlier before 1.5.4-beta11 1.5.4-beta11

The CVE record rates the flaw CVSS v4.0 9.2 Critical, CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N.

langchain4j-milvus-v2 exists only from 1.19.0-beta29, so earlier releases cannot use that integration. The current release is 1.24.1, published on 2026-11-26.

Check the LangChain4j version the build resolves:

mvn dependency:tree -Dincludes=dev.langchain4j
./gradlew dependencyInsight --dependency langchain4j --configuration runtimeClasspath

Check which integrations the project declares:

grep -rn "dev.langchain4j" pom.xml build.gradle build.gradle.kts 2>/dev/null

Find the filter construction and removal calls that can carry an untrusted value:

grep -rnE "new Is(EqualTo|NotEqualTo|In|NotIn)|metadataKey\(" src/
grep -rn "removeAll(" src/

A match is not proof of exploitability. The exposure depends on where the filter value comes from and whether the application reaches the vulnerable store.

How do I fix it?

Upgrade the affected store integration to 1.23.0-beta33 or later, or to the fixed release for the line the project uses. Then convert every filter value to a supported type before it reaches the filter. The upgrade alone closes the query construction. The type conversion also keeps untrusted objects away from future stores.

  1. Use langchain4j-core 1.23.0 with store integrations 1.23.0-beta33. These artifacts use different version strings.
  2. If the project must stay on an older line, use 1.19.4-beta29, 1.11.12-beta19 or 1.5.4-beta11, which are the fixed releases for those lines.
  3. Rebuild the application and confirm the resolved version.
  4. Convert filter values to String, a number, a UUID, a Boolean, an enum or a date/time type. Do not pass a collection, map, JsonNode or StringBuilder as a value.
  5. Keep authorization checks outside the filter, because an injected filter can override the conditions the application added.
<dependency>
  <groupId>dev.langchain4j</groupId>
  <artifactId>langchain4j-pgvector</artifactId>
  <version>1.23.0-beta33</version>
</dependency>
implementation 'dev.langchain4j:langchain4j-pgvector:1.23.0-beta33'

Replace the integration artifact with the store the project uses. The langchain4j-core module uses 1.23.0 for the central value check. The 1.19.4-beta29, 1.11.12-beta19 and 1.5.4-beta11 integration backports fix each store but do not add that breaking core check.

If you cannot upgrade yet, sanitize the values at the boundary:

  1. Reject any filter value that is not a String, number, UUID, Boolean, enum or date/time type.
  2. Copy lists and maps into a list of strings or numbers before building IsIn or IsNotIn.
  3. Do not pass a map as an IsEqualTo value. On MongoDB Atlas and Chroma, a map was written as a query object, so a key such as $ne became an operator.
  4. On pgvector before 1.11.0, upgrade instead of relying on string escaping, because isIn and isNotIn did not escape strings there.

What is the root cause?

The filter API accepts any object as a comparison value. The store mappers wrote a non-string value into the query text with toString() instead of binding it as a parameter. The value is therefore query syntax, not data.

The vulnerable code is PgVectorFilterMapper.java at 1.22.0. formatValue() escapes a String by doubling single quotes and quotes a UUID, but it returns any other object's toString() unchanged:

String formatValue(Object value) {
    if (value instanceof String stringValue) {
        final String escapedValue = stringValue.replace("'", "''");
        return "'" + escapedValue + "'";
    } else if (value instanceof UUID) {
        return "'" + value + "'";
    } else {
        return value.toString();
    }
}

formatCollectionValue() handles the values of isIn and isNotIn. It escapes a String, but for any other object it wraps toString() in single quotes without escaping the result:

String formatCollectionValue(Object value) {
    if (value instanceof String stringValue) {
        final String escapedValue = stringValue.replace("'", "''");
        return '\'' + escapedValue + '\'';
    } else {
        return '\'' + value.toString() + '\'';
    }
}

The filter classes accept the value as Object. new IsEqualTo(String, Object), new IsIn(String, Collection<?>) and MetadataFilterBuilder.isIn(Collection<?>) all preserve whatever object the caller passes. The pgvector mapper then calls formatValue() or formatCollectionValue() and joins the result into the SQL.

MariaDB had the same shape. Its formatValue() quotes a String or UUID and returns value.toString() for anything else. MongoDB Atlas and Chroma wrote IsEqualTo in the short form {key: value}, so a map value such as {"$ne": "x"} was read as a query operator rather than a literal.

The advisory gives a nested-list example for pgvector. A list element whose toString() contains a quote and SQL syntax closes the quoted literal and adds a condition. The exact string is in the public advisory; this post describes the mechanism and does not reproduce a working payload.

How is it exploited?

An attacker who controls a loosely typed filter value turns it into query syntax, and the database executes the result with the privileges of the application's store connection. The attack needs no user interaction and no database account.

  1. The application accepts a filter value from request JSON, a form field, a tool call or another source the attacker can influence.
  2. The value is a list, map or other object, not a string or number, and the application passes it into IsEqualTo, IsIn or IsNotIn.
  3. The mapper writes toString() into the query text, either unquoted or inside a quoted literal it does not escape.
  4. The database parses the injected text as SQL or as a query operator. It runs the search or the removeAll with the injected condition.
  5. The attacker reads rows that belong to other tenants, overrides the application's and() conditions, or deletes every row the connection can reach.

The advisory lists search, pgvector hybrid search and removeAll(Filter) as the affected operations. A read returns another tenant's documents through the normal search result. A delete through removeAll removes every row that matches the injected filter, which can be all rows in the store.

The attack does not require a public exploit. It requires that the application treats a filter value as data while the store treats it as query text.

How does the attack flow?

A loosely typed filter value becomes part of the query text, so the database executes an attacker condition in place of the intended metadata comparison.

flowchart LR A["Attacker sends a list or map filter value"] --> B["application builds IsEqualTo or IsIn"] B --> C["mapper writes value.toString into the query"] C --> D["no parameter binding and no type check"] D --> E["database runs the injected SQL or operator"] E --> F["other tenants' rows are read or all rows are deleted"]

What can an attacker do?

An attacker can read other tenants' or users' rows through search, override the conditions the application joined with and(), and delete rows through removeAll(Filter). The advisory lists those three outcomes for an application that passes untrusted, loosely typed values into a filter.

The impact needs all of these conditions:

  • The application uses an affected LangChain4j store integration.
  • The attacker can influence at least one filter value, directly or through model output the application trusts.
  • The value reaches the store as a non-string object, or as a string in pgvector before 1.11.0 for isIn and isNotIn.
  • The application calls search, hybrid search or removeAll with that filter.
  • The store connection can reach the rows the attacker wants. Cross-tenant reads need several tenants in the same store, and mass deletion needs a delete path that uses the filter.

The advisory does not report code execution, a server takeover or a denial of service. The demonstrated impact is data disclosure, query-condition bypass and data deletion.

Why does the fix work?

The fix binds filter values as parameters in the SQL stores, restricts the other stores to supported value types, and adds a central type check in langchain4j-core 1.23.0.

In pgvector and MariaDB, formatValue() no longer writes the value into the query. It appends the value to a parameter list and returns a ? placeholder:

-    String formatValue(Object value) {
-        if (value instanceof String stringValue) {
-            final String escapedValue = stringValue.replace("'", "''");
-            return "'" + escapedValue + "'";
-        } else if (value instanceof UUID) {
-            return "'" + value + "'";
-        } else {
-            return value.toString();
-        }
-    }
+    private static String formatValue(Object value, List<String> parameters) {
+        parameters.add(String.valueOf(value));
+        return "?";
+    }

The mapper returns a WhereClause that carries the SQL and its parameters, and the store sets each parameter on the JDBC statement. A value can no longer change the SQL text. Milvus and Milvus v2 now accept only supported value types. MongoDB Atlas and Chroma write equality with an explicit $eq, so a map value is a literal, not a query object.

The second commit adds ensureTypeIsSupported() in langchain4j-core. It accepts String, UUID, Boolean, the numeric wrapper types, enums and a list of date/time types:

private static final List<Class<?>> SUPPORTED_COMPARISON_VALUE_TYPES = List.of(
        String.class, UUID.class, Boolean.class, Integer.class, Long.class, Float.class, Double.class,
        Byte.class, Short.class, BigInteger.class, BigDecimal.class,
        LocalDate.class, LocalDateTime.class, LocalTime.class, OffsetDateTime.class, OffsetTime.class,
        ZonedDateTime.class, Instant.class, Year.class, YearMonth.class, MonthDay.class, Date.class);

The check runs when a filter is created, so an unsupported object fails before it reaches a store. It is in 1.23.0 and is not in the backports because it changes behavior for existing callers. The store-level fixes are complete for the six integrations in the advisory; the central check extends the same rule to other stores.

How do I check if I was compromised?

No indicators of compromise are published for CVE-2026-145153. A successful injection looks like a normal search or delete, so review the filter inputs and the database query log rather than a file signature.

Find the code paths that build filters from request data or model output, then review what types reach them:

grep -rnE "new Is(EqualTo|NotEqualTo|In|NotIn)|metadataKey\(" src/
grep -rn "removeAll(" src/

Search application and database logs for filter values that contain SQL syntax or MongoDB operators:

grep -rniE "(or 1=1|--|\\\$ne|\\\$gt|union select)" logs/ 2>/dev/null

In the database audit log, look for metadata-filter queries that contain a boolean tautology, a comment marker, a $ operator or a nested array where the application normally writes a scalar. A hit is a lead, not proof, because a legitimate value can contain the same characters.

A delete through removeAll can remove rows without leaving application-level evidence beyond the missing data. Compare row counts and backup history for each tenant if the store is shared.

Timeline

  • 2026-10-28: The fix commits were merged: 055468af for the store mappers and 8f6e2210 for the core type check. LangChain4j 1.23.0 was released the same day.
  • 2026-10-30: LangChain4j 1.19.4 and 1.11.12 were released.
  • 2026-11-02: LangChain4j 1.5.4 was released.
  • 2026-12-04: The GitHub advisory GHSA-6wgf-c23j-fj2v and the CVE record were published.

The fix merged 37 days before the advisory. The last fixed backport shipped 32 days before it.

The LangChain4j fix merged 37 days before the advisory
Figure 1: The two fix commits, the fixed releases and the advisory. Source: LangChain4j commits 055468af and 8f6e2210, Maven Central release dates, and the GitHub advisory, checked December 4, 2026

FAQ

Does this affect an application that only uses String filter values?

No, in the fixed lines. A filter built only from String, number, UUID, Boolean, enum or date/time values does not reach the unsupported-value path. The exception is pgvector before 1.11.0, where isIn and isNotIn did not escape String values either; upgrade that integration.

Which embedding stores are affected?

Six integrations in the advisory: pgvector, MariaDB, Milvus, Milvus v2, MongoDB Atlas and Chroma. The core type check in 1.23.0 also covers other stores that use the same filter API.

Is there a public proof of concept?

No. The advisory describes the filter API, the affected operations and example value shapes, but it publishes no end-to-end exploit. This post does not add one.

Can an attacker delete data, or only read it?

Both. removeAll(Filter) passes the same filter into a delete query, so an injected condition can delete every row the connection can reach. Search returns the read impact, including other tenants' documents.

Is CVE-2026-145153 in CISA KEV?

No. The Known Exploited Vulnerabilities catalog was at version 2026.12.03 on 2026-12-04, and the CVE is not listed. CISA's SSVC assessment records exploitation as none and automatable as no.

Is 1.24.1 fixed?

Yes, with langchain4j-core 1.24.1 and a store integration at 1.24.1-beta34. On the 1.23 line, use integrations 1.23.0-beta33 or later. Projects on older lines should use the matching integration fix: 1.19.4-beta29, 1.11.12-beta19 or 1.5.4-beta11.

References

  • LangChain4j, "Injection via non-String metadata filter values in the pgvector, MariaDB, Milvus, MongoDB Atlas and Chroma embedding stores", GHSA-6wgf-c23j-fj2v, published 2026-12-04 (checked December 4, 2026): https://github.com/langchain4j/langchain4j/security/advisories/GHSA-6wgf-c23j-fj2v
  • CVE Program, "CVE-2026-145153" record, published 2026-12-04 (checked December 4, 2026): https://www.cve.org/CVERecord?id=CVE-2026-145153
  • LangChain4j, commit 055468af, "Bind metadata filter values as parameters (pgvector, MariaDB) and map them strictly (Milvus, MongoDB Atlas, Chroma)", 2026-10-28 (checked December 4, 2026): https://github.com/langchain4j/langchain4j/commit/055468af94754c981958bbadad45eb282d86efce
  • LangChain4j, commit 8f6e2210, "Validate the types of metadata filter comparison values", 2026-10-28 (checked December 4, 2026): https://github.com/langchain4j/langchain4j/commit/8f6e2210f1a9f8ad92a53e6211861d2b0fbd2802
  • LangChain4j, PgVectorFilterMapper.java at 1.22.0, the vulnerable source (checked December 4, 2026): https://github.com/langchain4j/langchain4j/blob/1.22.0/langchain4j-pgvector/src/main/java/dev/langchain4j/store/embedding/pgvector/PgVectorFilterMapper.java
  • LangChain4j, MariaDbFilterMapper.java at 1.22.0, the vulnerable source (checked December 4, 2026): https://github.com/langchain4j/langchain4j/blob/1.22.0/langchain4j-mariadb/src/main/java/dev/langchain4j/store/embedding/mariadb/MariaDbFilterMapper.java
  • Maven Central, dev.langchain4j:langchain4j-core metadata and release dates for 1.5.4, 1.11.12, 1.19.4, 1.23.0 and 1.24.1 (checked December 4, 2026): https://central.sonatype.com/artifact/dev.langchain4j/langchain4j-core
  • GitHub, LangChain4j repository with 13,480 stars and 2,730 forks (checked December 4, 2026): https://github.com/langchain4j/langchain4j
  • CISA, Known Exploited Vulnerabilities catalog, version 2026.12.03 (checked December 4, 2026): https://www.cisa.gov/known-exploited-vulnerabilities-catalog

  • Maven Central, published core and pgvector integration artifact metadata and POMs (checked December 5, 2026): https://repo1.maven.org/maven2/dev/langchain4j/langchain4j-core/maven-metadata.xml ; https://repo1.maven.org/maven2/dev/langchain4j/langchain4j-pgvector/maven-metadata.xml

Free scan

Scan your own app for free

or book a demo

Keep reading

Related articles

Browse the blog