Description
Knex through 3.3.0 contains an sql injection vulnerability in the MSSQL dialect that allows attackers to inject T-SQL via table or view names. Attackers can supply names containing a single quote to close the object_id() literal in dropTableIfExists, dropViewIfExists, or createTableIfNotExists and execute arbitrary T-SQL with the database connection's privileges.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| @mikro-orm | knex | 0 ≤3.3.0 | — |
References
- https://github.com/knex/knex/blob/3.3.0/lib/dialects/mssql/schema/mssql-compiler.js#L10-L22
- https://github.com/knex/knex/blob/3.3.0/lib/dialects/mssql/index.js#L132-L138
- https://www.vulncheck.com/advisories/knex-through-3.3.0-sql-injection-via-mssql-droptableifexists-dropviewifexists-and-createtableifnotexists