LangChain4j
LangChain4j: SQL injection via metadata filters in langchain4j-mariadb and langchain4j-pgvector
LangChain4j is a Java library for building LLM-powered applications on the JVM. Prior to 1.2.1-beta8, 1.5.1-beta11, 1.11.8-beta19, and 1.16.3-beta26, the MariaDB and pgvector embedding stores build metadata-filter SQL by string-concatenating filter keys, and in MariaDB string values, directly into the query without adequate escaping. A crafted metadata key in EmbeddingSearchRequest.filter() can break out of its SQL context and inject arbitrary SQL into the statements executed by the stores' search and removeAll(Filter) operations, enabling blind data exfiltration, denial of service via sleep functions, and deletion of arbitrary rows through removeAll(Filter). This issue is fixed in langchain4j-mariadb and langchain4j-pgvector versions 1.2.1-beta8, 1.5.1-beta11, 1.11.8-beta19, and 1.16.3-beta26.
Affected versions and mitigation
From the CVE record and the vendor's references.Affected
- < 1.2.1-beta8
- >= 1.3.0-beta9, < 1.5.1-beta11
- >= 1.6.0-beta12, < 1.11.8-beta19
- >= 1.12.1-beta21, < 1.16.3-beta26
Fixed in 1.2.1-beta8, 1.5.1-beta11, 1.11.8-beta19, 1.16.3-beta26
Mitigation
Upgrade langchain4j to 1.2.1-beta8 or 1.5.1-beta11 or 1.11.8-beta19 or 1.16.3-beta26 or later.
References
Timeline
Days relative to CVE publicationNo public PoC found yet; not in CISA KEV.
PoC repositories
Found on GitHub.No PoC repositories found yet.