Intel

AIKIDO-2026-565238

@mikro-orm/knex is vulnerable to SQL Injection

CVE-2026-84993Published Jul 28, 2026
July 28, 2026

65

CVE Score

Medium

SQL Injection

Are you affected? Scan for Free

TL;DR

MikroORM validates the field of an orderBy clause against entity metadata but applies no validation to the order direction, which is concatenated into the generated SQL ORDER BY clause after only a toLowerCase() call. An application that binds a request value to the order direction lets an attacker place a raw SQL fragment inside ORDER BY, enabling blind or boolean-based extraction of data the query never selects. The vulnerable code lives in the shared SQL layer, so all SQL drivers are affected while MongoDB is not. The fix allow-lists the direction against the known QueryOrder values in a shared helper on AbstractSqlPlatform, with the MySQL and MSSQL overrides routed through it.

How do I fix this?

Upgrade the @mikro-orm/knex library to the patch version.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your application binds an attacker-influenced value to the order direction of an orderBy clause.

Versions

4.0.0 - 6.6.15

Fixed in 6.6.16

Background info

@mikro-orm/knex is vulnerable to SQL Injection in versions 4.0.0 - 6.6.15.

Get secure today,
quickly and for free.

Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.

No credit card required | Scan results in 32 seconds.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea