@mikro-orm/knex is vulnerable to SQL Injection
65
Medium Risk
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.
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.
@mikro-orm/knex is vulnerable to SQL Injection in versions 4.0.0 - 6.6.15.
Upgrade the @mikro-orm/knex library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant