CVE-2026-55405: LangChain4j SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-2mfg-cc43-9pcj
CVSS 7.6
CWE-89
Published
Advisory Summary

CVE-2026-55405 is a HIGH (CVSS 7.6) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting LangChain4j libraries in the Maven ecosystem. The issue involves sql injection via metadata filters in langchain4j-mariadb and langchain4j-pgvector. Remediation is available by upgrading affected packages to version 1.2.1-beta8, 1.5.1-beta11, 1.11.8-beta19, 1.16.3-beta26.

CVE-2026-55405 at a Glance

CVE Identifier CVE-2026-55405
GHSA Identifier GHSA-2mfg-cc43-9pcj
Severity HIGH
CVSS v3.1 Base Score 7.6
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product LangChain4j
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.6

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2026-55405

To remediate this vulnerability, upgrade all affected LangChain4j dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

dev.langchain4j:langchain4j-mariadb fixed: 1.2.1-beta8
<dependency>
    <groupId>dev.langchain4j</groupId>
    <artifactId>langchain4j-mariadb</artifactId>
    <version>1.2.1-beta8</version>
</dependency>
dev.langchain4j:langchain4j-mariadb fixed: 1.5.1-beta11
<dependency>
    <groupId>dev.langchain4j</groupId>
    <artifactId>langchain4j-mariadb</artifactId>
    <version>1.5.1-beta11</version>
</dependency>
dev.langchain4j:langchain4j-mariadb fixed: 1.11.8-beta19
<dependency>
    <groupId>dev.langchain4j</groupId>
    <artifactId>langchain4j-mariadb</artifactId>
    <version>1.11.8-beta19</version>
</dependency>
dev.langchain4j:langchain4j-mariadb fixed: 1.16.3-beta26
<dependency>
    <groupId>dev.langchain4j</groupId>
    <artifactId>langchain4j-mariadb</artifactId>
    <version>1.16.3-beta26</version>
</dependency>
dev.langchain4j:langchain4j-pgvector fixed: 1.2.1-beta8
<dependency>
    <groupId>dev.langchain4j</groupId>
    <artifactId>langchain4j-pgvector</artifactId>
    <version>1.2.1-beta8</version>
</dependency>
dev.langchain4j:langchain4j-pgvector fixed: 1.5.1-beta11
<dependency>
    <groupId>dev.langchain4j</groupId>
    <artifactId>langchain4j-pgvector</artifactId>
    <version>1.5.1-beta11</version>
</dependency>
dev.langchain4j:langchain4j-pgvector fixed: 1.11.8-beta19
<dependency>
    <groupId>dev.langchain4j</groupId>
    <artifactId>langchain4j-pgvector</artifactId>
    <version>1.11.8-beta19</version>
</dependency>
dev.langchain4j:langchain4j-pgvector fixed: 1.16.3-beta26
<dependency>
    <groupId>dev.langchain4j</groupId>
    <artifactId>langchain4j-pgvector</artifactId>
    <version>1.16.3-beta26</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=dev.langchain4j

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2026-55405, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=dev.langchain4j

Analyze the terminal output to locate any version of LangChain4j in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.1-beta8), your application is affected.

Note: The mvn dependency:tree -Dincludes=dev.langchain4j command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In LangChain4j, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary 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. ### Details **pgvector — JSON mode (default, `COMBINED_JSON` / `COMBINED_JSONB`).** `JSONFilterMapper` places the key inside a single-quoted SQL literal (the JSON key of the `->>` operator) with no escaping: (metadata->>'<key>')::text A key containing a single quote breaks out, e.g. `metadataKey("')::text IS NOT NULL OR pg_sleep(1) IS NOT NULL --")` injects a live `pg_sleep(1)` (observable as a delay; exploitable for blind data extraction). **pgvector — column mode (`COLUMN_PER_KEY`).** `ColumnFilterMapper` used the key as a bare, unquoted, unvalidated SQL identifier (`<key>::<type>`), so a key such as `1=1 OR true --` injects directly. **MariaDB — JSON mode (default).** `JSONFilterMapper` placed the key inside the JSON path literal `'$.<key>'` unescaped (same break-out mechanism). Additionally, `MariaDbFilterMapper.formatValue()` escaped `'` but not `\`; because MariaDB treats backslash as an escape character by default, a string value ending in a backslash could also break out of its literal. **MariaDB — column mode (`COLUMN_PER_KEY`).** `ColumnFilterMapper` fell back to the raw, unescaped key when the driver could not quote it as an identifier (e.g. a character). The filter key is the runtime injection surface; both stores' `search()` (including pgvector's HYBRID mode) and `removeAll(Filter)` are affected. Add/upsert operations a parameterized and not affected. ### Impact Applications that allow attacker-influenced metadata filter keys (e.g. use LLM-generated filters) to reach these stores are exposed to SQL injection: blind data exfiltration, denial of service via sleep functions, and — through `remove deletion of arbitrary rows. Applications using only hard-coded, developer-defined filter keys are not reachable. ### Patches Fixed in `langchain4j-mariadb` and `langchain4j-pgvector` 1.16.3-beta26: - JSON filter keys are escaped before being embedded in the SQL string lit quotes doubled, correct for PostgreSQL `standard_conforming_strings = on`; MariaDB: backslash and single quote). - MariaDB string values escape both `\` and `'`. - Column-mode keys are validated/quoted as identifiers and rejected when u concatenated as raw SQL. ### Workarounds - Do not pass untrusted input as metadata filter keys. - Restrict filter keys to a known allow-list at the application layer. ### References - pgvector: `JSONFilterMapper`, `ColumnFilterMapper` - MariaDB: `JSONFilterMapper`, `MariaDbFilterMapper`, `ColumnFilterMapper`

CVE-2026-55405 Affected LangChain4j Versions

8 component(s)
Fixed Versions:
1.2.1-beta81.5.1-beta111.11.8-beta191.16.3-beta26
Product / Package Ecosystem Affected Versions Fixed Version
dev.langchain4j:langchain4j-mariadb
Maven
< 1.2.1-beta8
1.2.1-beta8
dev.langchain4j:langchain4j-mariadb
Maven
≥ 1.3.0-beta9
< 1.5.1-beta11
1.5.1-beta11
dev.langchain4j:langchain4j-mariadb
Maven
≥ 1.6.0-beta12
< 1.11.8-beta19
1.11.8-beta19
dev.langchain4j:langchain4j-mariadb
Maven
≥ 1.12.1-beta21
< 1.16.3-beta26
1.16.3-beta26
dev.langchain4j:langchain4j-pgvector
Maven
< 1.2.1-beta8
1.2.1-beta8
dev.langchain4j:langchain4j-pgvector
Maven
≥ 1.3.0-beta9
< 1.5.1-beta11
1.5.1-beta11
dev.langchain4j:langchain4j-pgvector
Maven
≥ 1.6.0-beta12
< 1.11.8-beta19
1.11.8-beta19
dev.langchain4j:langchain4j-pgvector
Maven
≥ 1.12.1-beta21
< 1.16.3-beta26
1.16.3-beta26

References

Frequently Asked Questions

What is CVE-2026-55405?
CVE-2026-55405 is a security vulnerability in LangChain4j involving SQL injection via metadata filters in langchain4j-mariadb and langchain4j-pgvector under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which LangChain4j versions are affected?
Affected versions include releases prior to 1.2.1-beta8, 1.5.1-beta11, 1.11.8-beta19, 1.16.3-beta26 across affected packages: dev.langchain4j:langchain4j-mariadb, dev.langchain4j:langchain4j-pgvector.
What version fixes CVE-2026-55405?
Upgrading to 1.2.1-beta8, 1.5.1-beta11, 1.11.8-beta19, 1.16.3-beta26 (or the latest patched release for your respective branch) resolves the vulnerability.
Is langchain4j-mariadb affected?
Yes, dev.langchain4j:langchain4j-mariadb is affected in releases prior to 1.2.1-beta8, 1.5.1-beta11, 1.11.8-beta19, 1.16.3-beta26. Upgrade your dependency to 1.2.1-beta8, 1.5.1-beta11, 1.11.8-beta19, 1.16.3-beta26 or later.
Is langchain4j-pgvector affected?
Yes, dev.langchain4j:langchain4j-pgvector is affected in releases prior to 1.2.1-beta8, 1.5.1-beta11, 1.11.8-beta19, 1.16.3-beta26. Upgrade your dependency to 1.2.1-beta8, 1.5.1-beta11, 1.11.8-beta19, 1.16.3-beta26 or later.
What is the CVSS score of CVE-2026-55405?
CVE-2026-55405 has a CVSS v3.1 base score of 7.6 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L.
What CWE is associated with CVE-2026-55405?
CVE-2026-55405 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Maven dependencies for CVE-2026-55405?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=dev.langchain4j'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2mfg-cc43-9pcj",
  "modified" : "2026-06-17T18:39:56Z",
  "published" : "2026-06-17T18:39:56Z",
  "aliases" : [ "CVE-2026-55405" ],
  "summary" : "LangChain4j: SQL injection via metadata filters in langchain4j-mariadb and langchain4j-pgvector",
  "details" : "### Summary\nThe MariaDB and pgvector embedding stores build metadata-filter SQL by string-concatenating\nfilter **keys** (and, in MariaDB, string **values**) directly into the query without adequate\nescaping. A crafted metadata key in `EmbeddingSearchRequest.filter()` can break out of its SQL\ncontext and inject arbitrary SQL into the statements executed by the stores' search and\n`removeAll(Filter)` operations.\n\n### Details\n**pgvector — JSON mode (default, `COMBINED_JSON` / `COMBINED_JSONB`).** `JSONFilterMapper`\nplaces the key inside a single-quoted SQL literal (the JSON key of the `->>` operator) with no\nescaping:\n\n    (metadata->>'<key>')::text\n\nA key containing a single quote breaks out, e.g.\n`metadataKey(\"')::text IS NOT NULL OR pg_sleep(1) IS NOT NULL --\")` injects a live `pg_sleep(1)`\n(observable as a delay; exploitable for blind data extraction).\n\n**pgvector — column mode (`COLUMN_PER_KEY`).** `ColumnFilterMapper` used the key as a bare,\nunquoted, unvalidated SQL identifier (`<key>::<type>`), so a key such as `1=1 OR true --`\ninjects directly.\n\n**MariaDB — JSON mode (default).** `JSONFilterMapper` placed the key inside the JSON path literal\n`'$.<key>'` unescaped (same break-out mechanism). Additionally, `MariaDbFilterMapper.formatValue()`\nescaped `'` but not `\\`; because MariaDB treats backslash as an escape character by default, a\nstring value ending in a backslash could also break out of its literal.\n\n**MariaDB — column mode (`COLUMN_PER_KEY`).** `ColumnFilterMapper` fell back to the raw,\nunescaped key when the driver could not quote it as an identifier (e.g. a\ncharacter).\n\nThe filter key is the runtime injection surface; both stores' `search()` (including pgvector's\nHYBRID mode) and `removeAll(Filter)` are affected. Add/upsert operations a\nparameterized and not affected.\n\n### Impact\nApplications that allow attacker-influenced metadata filter keys (e.g. use\nLLM-generated filters) to reach these stores are exposed to SQL injection: blind data\nexfiltration, denial of service via sleep functions, and — through `remove\ndeletion of arbitrary rows. Applications using only hard-coded, developer-defined filter keys\nare not reachable.\n\n### Patches\nFixed in `langchain4j-mariadb` and `langchain4j-pgvector` 1.16.3-beta26:\n- JSON filter keys are escaped before being embedded in the SQL string lit\n  quotes doubled, correct for PostgreSQL `standard_conforming_strings = on`; MariaDB: backslash\n  and single quote).\n- MariaDB string values escape both `\\` and `'`.\n- Column-mode keys are validated/quoted as identifiers and rejected when u\n  concatenated as raw SQL.\n\n### Workarounds\n- Do not pass untrusted input as metadata filter keys.\n- Restrict filter keys to a known allow-list at the application layer.\n\n### References\n- pgvector: `JSONFilterMapper`, `ColumnFilterMapper`\n- MariaDB: `JSONFilterMapper`, `MariaDbFilterMapper`, `ColumnFilterMapper`",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "dev.langchain4j:langchain4j-mariadb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.1-beta8"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.2.0-beta8"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "dev.langchain4j:langchain4j-mariadb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.3.0-beta9"
      }, {
        "fixed" : "1.5.1-beta11"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.5.0-beta11"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "dev.langchain4j:langchain4j-mariadb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.6.0-beta12"
      }, {
        "fixed" : "1.11.8-beta19"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.11.7-beta19"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "dev.langchain4j:langchain4j-mariadb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.12.1-beta21"
      }, {
        "fixed" : "1.16.3-beta26"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.16.2-beta26"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "dev.langchain4j:langchain4j-pgvector"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.1-beta8"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.2.0-beta8"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "dev.langchain4j:langchain4j-pgvector"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.3.0-beta9"
      }, {
        "fixed" : "1.5.1-beta11"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.5.0-beta11"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "dev.langchain4j:langchain4j-pgvector"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.6.0-beta12"
      }, {
        "fixed" : "1.11.8-beta19"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.11.7-beta19"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "dev.langchain4j:langchain4j-pgvector"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.12.1-beta21"
      }, {
        "fixed" : "1.16.3-beta26"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.16.2-beta26"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/langchain4j/langchain4j/security/advisories/GHSA-2mfg-cc43-9pcj"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/langchain4j/langchain4j"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-17T18:39:56Z",
    "nvd_published_at" : null
  }
}