# GHSA-6WGF-C23J-FJ2V: Injection via non-String metadata filter values in the pgvector, MariaDB, Milvus, MongoDB Atlas and Chroma embedding stores

- Database: GitHub
- Severity: CVSS 8.1 (High)
- Published: 2026-12-04
- Modified: 2026-12-04

## Affected versions

- dev.langchain4j:langchain4j-pgvector (Maven): fixed in 1.5.4-beta11
- dev.langchain4j:langchain4j-pgvector (Maven): from 1.6.0-beta12, fixed in 1.11.12-beta19
- dev.langchain4j:langchain4j-pgvector (Maven): from 1.12.1-beta21, fixed in 1.19.4-beta29
- dev.langchain4j:langchain4j-pgvector (Maven): from 1.20.0-beta30, fixed in 1.23.0-beta33
- dev.langchain4j:langchain4j-mariadb (Maven): fixed in 1.5.4-beta11
- dev.langchain4j:langchain4j-mariadb (Maven): from 1.6.0-beta12, fixed in 1.11.12-beta19
- dev.langchain4j:langchain4j-mariadb (Maven): from 1.12.1-beta21, fixed in 1.19.4-beta29
- dev.langchain4j:langchain4j-mariadb (Maven): from 1.20.0-beta30, fixed in 1.23.0-beta33
- dev.langchain4j:langchain4j-milvus (Maven): fixed in 1.5.4-beta11
- dev.langchain4j:langchain4j-milvus (Maven): from 1.6.0-beta12, fixed in 1.11.12-beta19
- dev.langchain4j:langchain4j-milvus (Maven): from 1.12.1-beta21, fixed in 1.19.4-beta29
- dev.langchain4j:langchain4j-milvus (Maven): from 1.20.0-beta30, fixed in 1.23.0-beta33
- dev.langchain4j:langchain4j-mongodb-atlas (Maven): fixed in 1.5.4-beta11
- dev.langchain4j:langchain4j-mongodb-atlas (Maven): from 1.6.0-beta12, fixed in 1.11.12-beta19
- dev.langchain4j:langchain4j-mongodb-atlas (Maven): from 1.12.1-beta21, fixed in 1.19.4-beta29
- dev.langchain4j:langchain4j-mongodb-atlas (Maven): from 1.20.0-beta30, fixed in 1.23.0-beta33
- dev.langchain4j:langchain4j-chroma (Maven): fixed in 1.5.4-beta11
- dev.langchain4j:langchain4j-chroma (Maven): from 1.6.0-beta12, fixed in 1.11.12-beta19
- dev.langchain4j:langchain4j-chroma (Maven): from 1.12.1-beta21, fixed in 1.19.4-beta29
- dev.langchain4j:langchain4j-chroma (Maven): from 1.20.0-beta30, fixed in 1.23.0-beta33
- dev.langchain4j:langchain4j-milvus-v2 (Maven): fixed in 1.19.4-beta29
- dev.langchain4j:langchain4j-milvus-v2 (Maven): from 1.20.0-beta30, fixed in 1.23.0-beta33

## Description

### Summary
Several embedding stores built the query for a metadata `Filter` by writing the filter values into the query text. A value that was not a `String` was written with `toString()`, without escaping. The filter API accepts any object as a value: `new IsEqualTo(String, Object)`, `new IsIn(String, Collection<?>)` and `MetadataFilterBuilder.isIn(Collection<?>)`. So an application that passes loosely typed data into a filter lets that data change the query. Examples of such data are a `List` or `Map` parsed from request JSON, or from LLM tool output.

### Details
- **langchain4j-pgvector:** in `isIn` / `isNotIn`, a non-String value was written as `'` + `value.toString()` + `'`, without escaping. A nested list such as `isIn(List.of(List.of("x') or 1=1 --")))` closes the literal. Scalar comparisons were not affected (the query failed). Before 1.11.0, `isIn` / `isNotIn` did not escape `String` values either, so a plain `String` such as `x') or 1=1 --` closed the literal too. This affects all versions before 1.11.0, including the 1.5.x line up to 1.5.3-beta11.
- **langchain4j-mariadb:** a value that was not a `String`, `UUID` or `Collection` was written with `toString()`, without quotes. Examples are a `Map` whose text starts with a JDBC escape (`{fn ...}`), or a `StringBuilder`. This applies to comparison filters and to `isIn` / `isNotIn`.
- **langchain4j-milvus** and **langchain4j-milvus-v2:** non-String values were written into the filter expression with `toString()`, without quotes.
- **langchain4j-mongodb-atlas** and **langchain4j-chroma:** `IsEqualTo` was written in the short form `{key: value}`, so a `Map` value such as `{"$ne": "x"}` was read as a query operator.

The affected operations are `search` (including pgvector hybrid search) and `removeAll(Filter)`.

These are not affected:
- Applications that build filters only from `String`, number, `UUID` or `Boolean` values, for example with the typed `MetadataFilterBuilder` methods. Exception: `langchain4j-pgvector` before 1.11.0, see above.
- Filters built by `LanguageModelSqlFilterBuilder`: it only produces `String`, `Long` and `Double` values.

### Impact
For an application that passes untrusted, loosely typed values into a metadata filter:
- **Reading other tenants' or users' rows through `search`.** An injected `or` overrides the conditions the application added with `and(...)`.
- **Deleting all rows through `removeAll(Filter)`.**

### Patches
Fixed in these versions (`langchain4j-milvus-v2` exists only since 1.19.0-beta29):
- `1.23.0-beta33`
- `1.19.4-beta29`
- `1.11.12-beta19`
- `1.5.4-beta11`

The fix is the same in all of them:
- pgvector and MariaDB bind filter values as JDBC parameters.
- Milvus and Milvus v2 accept only supported value types.
- MongoDB Atlas and Chroma write equality with an explicit `$eq`.

In addition, `langchain4j-core` 1.23.0 checks filter values when a filter is created. This check is not in the backports, because it is a breaking change. It accepts only:
- `String`, `UUID` and `Boolean`
- numbers: `Integer`, `Long`, `Float`, `Double`, `Byte`, `Short`, `BigInteger` and `BigDecimal`
- enums
- date/time values

This also protects other embedding stores, including stores outside this repository.

### Workarounds
- Pass only `String`, number, `UUID` or `Boolean` values into metadata filters. On `langchain4j-pgvector` before 1.11.0 this is not enough, because `String` values in `isIn` / `isNotIn` are not escaped there either: upgrade.
- Do not pass collections, maps, `JsonNode`s or other objects from request data or LLM output into a filter without converting each value first.

### References
- Fix: https://github.com/langchain4j/langchain4j/pull/6895 and https://github.com/langchain4j/langchain4j/pull/6896
- [GHSA-2mfg-cc43-9pcj](https://github.com/advisories/GHSA-2mfg-cc43-9pcj): an earlier, related issue with filter keys

## References

- https://github.com/langchain4j/langchain4j/security/advisories/GHSA-6wgf-c23j-fj2v

Page: https://cve.now/GHSA-6WGF-C23J-FJ2V

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
