Vulnerabilities in pkg:npm/@mikro-orm/knex

PACKAGE
Advisory Identifier: GHSA-cfw5-68c4-ffqp
Advisory Summary

CVE-2026-44680 is a HIGH (CVSS 7.6) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting @mikro orm/sql libraries in the npm ecosystem. The issue involves mikroorm has sql injection via runtime-controlled identifiers and json-path keys. Remediation is available by upgrading affected packages to version 7.0.14, 6.6.14.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@mikro-orm/knex

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@mikro-orm/knex. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-cfw5-68c4-ffqp CVE-2026-44680 HIGH MikroORM has SQL injection via runtime-controlled identifiers and JSON-path keys

CVE-2026-44680 at a Glance

CVE Identifier CVE-2026-44680
GHSA Identifier GHSA-cfw5-68c4-ffqp
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 @mikro orm/sql
Package Ecosystem npm
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-44680

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

@mikro-orm/sql fixed: 7.0.14
npm install @mikro-orm/sql@7.0.14
@mikro-orm/knex fixed: 6.6.14
npm install @mikro-orm/knex@6.6.14
Verify Direct and Transitive Dependencies

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

npm ls @mikro-orm/sql

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-44680, inspect your project dependencies using npm:

npm ls @mikro-orm/sql

Analyze the terminal output to locate any version of @mikro orm/sql in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.0.14), your application is affected.

Note: The npm ls @mikro-orm/sql command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

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 @mikro orm/sql, 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 MikroORM's identifier-quoting helper (`Platform.quoteIdentifier` and the postgres/mssql overrides) and its JSON-path emitters (`Platform.getSearchJsonPropertyKey`, `quoteJsonKey`) did not properly escape characters that delimit the SQL identifier or string-literal context they emit into. When application code passes attacker-influenced strings to public ORM APIs that expect an identifier or a JSON-property filter, an attacker can break out of the quoted context and inject arbitrary SQL. ## Affected APIs The vulnerability is reachable when application code passes an attacker-influenced string to any of the following documented APIs: * **Multi-tenant `schema` option** — `em.fork({ schema })`, `qb.withSchema(name)`, `wrap(entity).setSchema(name)`, `em.create(Cls, data, { schema })`. The schema name is concatenated into the SQL identifier and never had its dialect quote character escaped. * **`em.find` / `qb.where` JSON-property filters** — `em.find(Entity, { jsonCol: { [userKey]: value } })`. The user-supplied JSON sub-keys cannot be validated against any metadata (JSON columns are schemaless by design), and were spliced into the SQL string literal of the JSON path expression without escaping. * **`qb.where` / `qb.orderBy` / `qb.groupBy` / `qb.having` / `qb.select` keys** — keys containing `.` or `::` bypassed the structured-where metadata validator in `CriteriaNode`, then flowed through the same broken `quoteIdentifier`. Apps that forwarded raw filter keys from request input were already broken on authorization grounds (e.g. `{ isAdmin: true }`); the SQL injection here is a defence-in-depth failure on top of that. The vulnerability does **not** affect documented escape-hatch APIs (`raw()`, the `sql` tagged template, `qb.raw()`, `em.raw()`) — those are documented as accepting raw SQL and are the application's responsibility to sanitize. ## Impact * **Confidentiality** — read from any table/schema the database user has access to (cross-tenant data leak in multi-tenant deployments). * **Integrity** — on dialects supporting multi-statement queries (MSSQL, MySQL with multi-statement enabled), execute additional arbitrary SQL statements (data modification, in-database privilege escalation). * **Availability** — DROP/TRUNCATE via injected statements where the database user has the privilege. ## Affected dialects All SQL dialects supported by MikroORM. The identifier-quoting bug exists in every dialect's `quoteIdentifier` (the dialect's own quote character — backtick, double quote, or right bracket — was not doubled when embedded in the identifier). The JSON-path bug exists in all dialects' `getSearchJsonPropertyKey`/`quoteJsonKey`. MongoDB driver is **not** affected (no SQL). ## Patches * v7: upgrade to **7.0.14** or later. * v6: upgrade to **6.6.14** or later. Patches: * Identifier quoting: #7653 (master) / #7654 (6.x) * JSON-path keys: #7656 (master) / #7657 (6.x) ## Workarounds If users cannot upgrade immediately: * For multi-tenant apps using `em.fork({ schema })` / `wrap().setSchema()` / `qb.withSchema()`: validate the schema name against a strict allowlist (e.g. `^[A-Za-z_][\w$]*$`) **before** passing it to MikroORM. * For applications that pass `where` / `orderBy` filters from request input: validate every key against the entity's known properties before constructing the filter; do not pass keys containing `.` or `::` from user input. * For applications that allow filtering on JSON columns from request input: validate every JSON sub-key against an allowlist (or against `^[a-zA-Z_][\w]*$`) before passing it to `em.find`. ## Credits Reported and patched by Martin Adámek (project maintainer) during an internal security review.

CVE-2026-44680 Affected @mikro orm/sql Versions

2 component(s)
Fixed Versions:
7.0.146.6.14
Product / Package Ecosystem Affected Versions Fixed Version
@mikro-orm/sql
npm
< 7.0.14
7.0.14
@mikro-orm/knex
npm
< 6.6.14
6.6.14

References

Frequently Asked Questions

What is CVE-2026-44680?
CVE-2026-44680 is a security vulnerability in @mikro orm/sql involving MikroORM has SQL injection via runtime-controlled identifiers and JSON-path keys under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which @mikro orm/sql versions are affected?
Affected versions include releases prior to 7.0.14, 6.6.14 across affected packages: @mikro-orm/sql, @mikro-orm/knex.
What version fixes CVE-2026-44680?
Upgrading to 7.0.14, 6.6.14 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @mikro-orm/sql affected?
Yes, @mikro-orm/sql is affected in releases prior to 7.0.14. Upgrade your dependency to 7.0.14 or later.
Is @mikro-orm/knex affected?
Yes, @mikro-orm/knex is affected in releases prior to 6.6.14. Upgrade your dependency to 6.6.14 or later.
What is the CVSS score of CVE-2026-44680?
CVE-2026-44680 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-44680?
CVE-2026-44680 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 npm dependencies for CVE-2026-44680?
Run the dependency tree command: 'npm ls @mikro-orm/sql'. 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-cfw5-68c4-ffqp",
  "modified" : "2026-06-08T23:27:29Z",
  "published" : "2026-05-08T19:17:45Z",
  "aliases" : [ "CVE-2026-44680" ],
  "summary" : "MikroORM has SQL injection via runtime-controlled identifiers and JSON-path keys",
  "details" : "## Summary\n\nMikroORM's identifier-quoting helper (`Platform.quoteIdentifier` and the postgres/mssql overrides) and its JSON-path emitters (`Platform.getSearchJsonPropertyKey`, `quoteJsonKey`) did not properly escape characters that delimit the SQL identifier or string-literal context they emit into. When application code passes attacker-influenced strings to public ORM APIs that expect an identifier or a JSON-property filter, an attacker can break out of the quoted context and inject arbitrary SQL.\n\n## Affected APIs\n\nThe vulnerability is reachable when application code passes an attacker-influenced string to any of the following documented APIs:\n\n* **Multi-tenant `schema` option** — `em.fork({ schema })`, `qb.withSchema(name)`, `wrap(entity).setSchema(name)`, `em.create(Cls, data, { schema })`. The schema name is concatenated into the SQL identifier and never had its dialect quote character escaped.\n* **`em.find` / `qb.where` JSON-property filters** — `em.find(Entity, { jsonCol: { [userKey]: value } })`. The user-supplied JSON sub-keys cannot be validated against any metadata (JSON columns are schemaless by design), and were spliced into the SQL string literal of the JSON path expression without escaping.\n* **`qb.where` / `qb.orderBy` / `qb.groupBy` / `qb.having` / `qb.select` keys** — keys containing `.` or `::` bypassed the structured-where metadata validator in `CriteriaNode`, then flowed through the same broken `quoteIdentifier`. Apps that forwarded raw filter keys from request input were already broken on authorization grounds (e.g. `{ isAdmin: true }`); the SQL injection here is a defence-in-depth failure on top of that.\n\nThe vulnerability does **not** affect documented escape-hatch APIs (`raw()`, the `sql` tagged template, `qb.raw()`, `em.raw()`) — those are documented as accepting raw SQL and are the application's responsibility to sanitize.\n\n## Impact\n\n* **Confidentiality** — read from any table/schema the database user has access to (cross-tenant data leak in multi-tenant deployments).\n* **Integrity** — on dialects supporting multi-statement queries (MSSQL, MySQL with multi-statement enabled), execute additional arbitrary SQL statements (data modification, in-database privilege escalation).\n* **Availability** — DROP/TRUNCATE via injected statements where the database user has the privilege.\n\n## Affected dialects\n\nAll SQL dialects supported by MikroORM. The identifier-quoting bug exists in every dialect's `quoteIdentifier` (the dialect's own quote character — backtick, double quote, or right bracket — was not doubled when embedded in the identifier). The JSON-path bug exists in all dialects' `getSearchJsonPropertyKey`/`quoteJsonKey`.\n\nMongoDB driver is **not** affected (no SQL).\n\n## Patches\n\n* v7: upgrade to **7.0.14** or later.\n* v6: upgrade to **6.6.14** or later.\n\nPatches:\n* Identifier quoting: #7653 (master) / #7654 (6.x)\n* JSON-path keys: #7656 (master) / #7657 (6.x)\n\n## Workarounds\n\nIf users cannot upgrade immediately:\n\n* For multi-tenant apps using `em.fork({ schema })` / `wrap().setSchema()` / `qb.withSchema()`: validate the schema name against a strict allowlist (e.g. `^[A-Za-z_][\\w$]*$`) **before** passing it to MikroORM.\n* For applications that pass `where` / `orderBy` filters from request input: validate every key against the entity's known properties before constructing the filter; do not pass keys containing `.` or `::` from user input.\n* For applications that allow filtering on JSON columns from request input: validate every JSON sub-key against an allowlist (or against `^[a-zA-Z_][\\w]*$`) before passing it to `em.find`.\n\n## Credits\n\nReported and patched by Martin Adámek (project maintainer) during an internal security review.",
  "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" : "npm",
      "name" : "@mikro-orm/sql"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.0.14"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 7.0.13"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@mikro-orm/knex"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.6.14"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.6.13"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mikro-orm/mikro-orm/security/advisories/GHSA-cfw5-68c4-ffqp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-44680"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mikro-orm/mikro-orm/pull/7653"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mikro-orm/mikro-orm/pull/7654"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mikro-orm/mikro-orm/pull/7656"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mikro-orm/mikro-orm/pull/7657"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mikro-orm/mikro-orm"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-08T19:17:45Z",
    "nvd_published_at" : "2026-05-26T17:16:46Z"
  }
}