Skip to content
HighVulnerability

GHSA-2mfg-cc43-9pcj: LangChain4j: SQL injection via metadata filters in langchain4j-mariadb and langchain4j-pgvector

Published
Record updated
View JSON
Affected
  • dev.langchain4j:langchain4j-pgvector >= 1.12.1-beta21, <= 1.16.2-beta26, fixed in 1.16.3-beta26
  • dev.langchain4j:langchain4j-pgvector >= 1.6.0-beta12, <= 1.11.7-beta19, fixed in 1.11.8-beta19
  • dev.langchain4j:langchain4j-pgvector >= 1.3.0-beta9, <= 1.5.0-beta11, fixed in 1.5.1-beta11
  • and 2 more
Known exploitation
Not listed in the CISA Known Exploited Vulnerabilities catalog at the last check.
EPSS
0.5%

Summary

The langchain4j-mariadb and langchain4j-pgvector embedding stores build metadata-filter SQL by concatenating filter keys, and in MariaDB string values, without adequate escaping. A crafted key in EmbeddingSearchRequest.filter() can inject arbitrary SQL into search() and removeAll(Filter) operations. Applications that let attacker-influenced filter keys reach these stores, such as LLM-generated filters, are exposed to blind data exfiltration, denial of service and deletion of arbitrary rows. Applications using only hard-coded filter keys are not reachable.

Mitigation

Fixed in langchain4j-mariadb and langchain4j-pgvector 1.16.3-beta26. Workarounds: do not pass untrusted input as metadata filter keys, and restrict filter keys to a known allow-list at the application layer.