GHSA-CFW5-68C4-FFQP
Vulnerability from github – Published: 2026-05-08 19:17 – Updated: 2026-05-08 19:17Summary
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
schemaoption —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.whereJSON-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.selectkeys — keys containing.or::bypassed the structured-where metadata validator inCriteriaNode, then flowed through the same brokenquoteIdentifier. 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/orderByfilters 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 toem.find.
Credits
Reported and patched by Martin Adámek (project maintainer) during an internal security review.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 7.0.13"
},
"package": {
"ecosystem": "npm",
"name": "@mikro-orm/sql"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "7.0.14"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 6.6.13"
},
"package": {
"ecosystem": "npm",
"name": "@mikro-orm/knex"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "6.6.14"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-44680"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": true,
"github_reviewed_at": "2026-05-08T19:17:45Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "## Summary\n\nMikroORM\u0027s 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** \u2014 `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** \u2014 `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** \u2014 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()`) \u2014 those are documented as accepting raw SQL and are the application\u0027s responsibility to sanitize.\n\n## Impact\n\n* **Confidentiality** \u2014 read from any table/schema the database user has access to (cross-tenant data leak in multi-tenant deployments).\n* **Integrity** \u2014 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** \u2014 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\u0027s `quoteIdentifier` (the dialect\u0027s own quote character \u2014 backtick, double quote, or right bracket \u2014 was not doubled when embedded in the identifier). The JSON-path bug exists in all dialects\u0027 `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\u0027s 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\u00e1mek (project maintainer) during an internal security review.",
"id": "GHSA-cfw5-68c4-ffqp",
"modified": "2026-05-08T19:17:45Z",
"published": "2026-05-08T19:17:45Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/mikro-orm/mikro-orm/security/advisories/GHSA-cfw5-68c4-ffqp"
},
{
"type": "WEB",
"url": "https://github.com/mikro-orm/mikro-orm/pull/7654"
},
{
"type": "WEB",
"url": "https://github.com/mikro-orm/mikro-orm/pull/7657"
},
{
"type": "PACKAGE",
"url": "https://github.com/mikro-orm/mikro-orm"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L",
"type": "CVSS_V3"
}
],
"summary": "MikroORM has SQL injection via runtime-controlled identifiers and JSON-path keys"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.