@mikro-orm/knex is vulnerable to SQL Injection
65
CVE Score
Medium
SQL Injection
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.
Upgrade the @mikro-orm/knex library to the patch version.
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.
4.0.0 - 6.6.15
Fixed in 6.6.16@mikro-orm/knex is vulnerable to SQL Injection in versions 4.0.0 - 6.6.15.
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.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.