CVE-2026-142191: Knex through 3.3.0 SQL Injection via MSSQL dropTableIfExists, dropViewIfExists and createTableIfNotExists
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 objectid() literal in dropTableIfExists, dropViewIfExists, or createTableIfNotExists and execute arbitrary T-SQL with the database connection's privileges.
Affected Software
Event History
Frequently Asked Questions
Which deployments are affected?
Applications using Knex through version 3.3.0 with the MSSQL dialect are affected when they call dropTableIfExists, dropViewIfExists, or createTableIfNotExists using table or view names that an attacker can influence.
What must an attacker control to exploit this issue?
The attacker must be able to supply a table or view name containing a single quote to one of the affected schema operations. This closes the object_id() literal and can allow arbitrary T-SQL to run with the privileges of the application's database connection.
How can teams identify potentially vulnerable code paths?
Review MSSQL Knex schema operations for calls to dropTableIfExists, dropViewIfExists, and createTableIfNotExists. Prioritize calls where object names originate from request data or any other attacker-controlled input.