Summary
LangChain4j before 1.5.4-beta11, 1.11.12-beta19, 1.19.4-beta29 and 1.23.0-beta33 contains an injection vulnerability in embedding store metadata filters. Non-String filter values are written into queries via toString() without escaping (CWE-89, CWE-943). Affected stores include pgvector, MariaDB, Milvus, MongoDB Atlas and Chroma.
The attack is network-based, requires no authentication and no user interaction, but has high complexity: the attacker must control loosely typed filter values, such as nested Lists or Maps from request JSON or LLM tool output. CVSS 3.1 score is 8.1 (high).
Successful exploitation allows injecting SQL or query operators to read other tenants' documents or delete rows via removeAll, with high impact on confidentiality, integrity and availability. The vulnerability is not listed in the CISA KEV catalog.
Who is affected
Organizations building Java applications (e.g. RAG or multi-tenant AI systems) using LangChain4j modules for pgvector, MariaDB, Milvus, MongoDB Atlas or Chroma.
What to do
- Upgrade LangChain4j modules to the fixed version for your branch: 1.5.4-beta11, 1.11.12-beta19, 1.19.4-beta29 or 1.23.0-beta33.
- For MongoDB Atlas and Chroma modules and branches not listed in the record, check fixed versions in the official advisory GHSA-6wgf-c23j-fj2v.
- Review dependencies (Maven/Gradle) across projects to identify affected modules and versions.
- Review code that builds metadata filters from user input or LLM tool output and ensure only expected scalar types are passed.
- Review database and store logs for unexpected queries or deletions and verify tenant data isolation.
Affected products and versions
CVSS vector, explained
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- Network (from the internet)
- Attack complexity
- High
- Privileges required
- None (no login)
- User interaction
- Not required
- Scope
- Vulnerable component only
- Confidentiality
- High impact
- Integrity
- High impact
- Availability
- High impact
Weakness type (CWE)
- CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
- CWE-943 Improper Neutralization of Special Elements in Data Query Logic
References
- github.com/langchain4j/langchain4j/security/advisories/GHSA-6wgf-c23j-fj2v vendor advisory
- github.com/langchain4j/langchain4j/commit/055468af94754c981958bbadad45eb282d86efce patch
- github.com/langchain4j/langchain4j/commit/8f6e2210f1a9f8ad92a53e6211861d2b0fbd2802 patch
- www.vulncheck.com/advisories/langchain4j-before-1.5.4-beta11-1.11.12-beta19-1.19.4-beta29-
Sources: CVE.org (CNA and CISA ADP), CISA KEV, FIRST EPSS. Always check the vendor's official advisory.