CVE-2026-145153 in LangChain4jinfo

Summary

by MITRE • 12/04/2026

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 that writes non-String values into queries via toString() without escaping. Attackers who control loosely typed filter values, such as nested Lists or Maps from request JSON or LLM tool output, can inject SQL or query operators in pgvector, MariaDB, Milvus, MongoDB Atlas, or Chroma stores to read other tenants' documents or delete rows via removeAll.

If you want to get best quality of vulnerability data, you may have to visit VulDB.

Analysis

by VulDB Data Team • 12/04/2026

The vulnerability identified in LangChain4j versions prior to 1.5.4-beta11, 1.11.12-beta19, 1.19.4-beta29, and 1.23.0-beta33 represents a critical injection flaw within the embedding store metadata filtering mechanism. This security issue stems from an improper neutralization of special elements used in queries, specifically categorized under CWE-77: Injection via toString(). When developers utilize LangChain4j to interact with vector databases such as pgvector, MariaDB, Milvus, MongoDB Atlas, or Chroma, the library constructs query filters based on metadata provided by the application. The core technical flaw lies in how these libraries handle non-string data types during this process. Instead of properly serializing or escaping values that are not explicitly strings, the framework invokes the toString() method on objects to convert them into string representations for inclusion in database queries. This approach fails to account for the structural nature of complex Java objects like nested Lists and Maps, which can contain characters or syntaxes that hold special meaning within SQL or NoSQL query languages.

The operational impact of this vulnerability is severe because it allows attackers who control loosely typed filter values to execute arbitrary code against the underlying database infrastructure. In many modern AI applications using LangChain4j, metadata filters are derived from user inputs processed by Large Language Models (LLMs) or extracted directly from request JSON payloads. If an attacker can influence these input sources, they can inject malicious structures into the filter parameters. For instance, a nested List might be converted to a string format that mimics SQL array syntax or MongoDB query operators. When this malformed value is passed through the vulnerable toString() implementation and executed against the vector store, it bypasses intended security boundaries. This enables unauthorized access to sensitive data stored in other tenants' documents due to insufficient isolation between multi-tenant environments, as well as potential denial of service or data destruction via commands like removeAll if the database permissions allow such operations.

This vulnerability aligns with ATT&CK technique T1059: Command and Scripting Interpreter, specifically when SQL injection is used for command execution within the context of a vector database management system. It also reflects CWE-20: Improper Input Validation, as the framework does not adequately validate or sanitize complex object structures before embedding them into query strings. The risk is exacerbated by the fact that many developers assume that using an ORM-like abstraction layer such as LangChain4j provides automatic protection against injection attacks. However, because the library relies on dynamic type conversion without strict schema enforcement for metadata filters, it creates a blind spot where untrusted data can be interpreted as executable code by the database engine.

To mitigate this vulnerability, organizations must immediately upgrade to patched versions of LangChain4j that address the serialization logic in their embedding store implementations. Until an update is applied, developers should implement strict input validation on all metadata filter values before they are passed to LangChain4j functions. This includes enforcing type constraints so that only primitive types or explicitly escaped strings are accepted for filtering operations. Additionally, application code should avoid passing complex nested structures like Lists and Maps directly into query filters unless the underlying database driver provides explicit support for safe parameterized queries with those data types. Where possible, metadata values should be pre-processed to ensure they do not contain characters that could alter query logic, such as parentheses, brackets, or quotes. Regular security audits of vector database integration layers are recommended to identify similar patterns where dynamic object serialization might lead to injection vulnerabilities in other parts of the application stack.

Responsible

VulnCheck

Reservation

12/04/2026

Disclosure

12/04/2026

Moderation

accepted

CPE

ready

EPSS

0.00837

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!