# CVE-2026-142191: Knex through 3.3.0 SQL Injection via MSSQL dropTableIfExists, dropViewIfExists and createTableIfNotExists

Source: https://aplosec.si/cve/CVE-2026-142191/

[AploSec](https://aplosec.si/) / [Disclosures](https://aplosec.si/disclosures/) / CVE-2026-142191

High 7.7 · Reported · No fix listed · CWE-89 · npm

# Knex through 3.3.0 SQL Injection via MSSQL dropTableIfExists, dropViewIfExists and createTableIfNotExists

CVE-2026-142191 · published 2026-12-02

In plain words: this type of bug lets someone change the queries sent to the database (SQL injection). No fixed release is listed yet.

## Summary

CVE-2026-142191 affects knex (npm) <= 3.3.0: SQL Injection via MSSQL dropTableIfExists, dropViewIfExists and createTableIfNotExists (CWE-89). No fixed release is listed. CVSS 4.0 base score 7.7 (High), assigned by VulnCheck. Published 2026-12-02 by VulnCheck. Credit: Zachariah Mithani (AploSec).

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.

## Evidence

Reported to the maintainer. The public advisory and references below describe the evidence and preconditions; reporting status alone does not establish independent reproduction.

## Remediation

No fixed release is listed in the advisory. Check the references for upstream status.

## References

- [VulnCheck advisoryhttps://www.vulncheck.com/advisories/knex-through-3.3.0-sql-injection-via-mssql-droptableifexists-dropviewifexists-and-createtableifnotexists](https://www.vulncheck.com/advisories/knex-through-3.3.0-sql-injection-via-mssql-droptableifexists-dropviewifexists-and-createtableifnotexists)

- [Vulnerable codehttps://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/schema/mssql-compiler.js#L10-L22)

- [Vulnerable codehttps://github.com/knex/knex/blob/3.3.0/lib/dialects/mssql/index.js#L132-L138](https://github.com/knex/knex/blob/3.3.0/lib/dialects/mssql/index.js#L132-L138)

- [CVE recordhttps://www.cve.org/CVERecord?id=CVE-2026-142191](https://www.cve.org/CVERecord?id=CVE-2026-142191)

**Severity:** High 7.7 CVSS 4.0, scored by VulnCheck in the [CVE record](https://www.cve.org/CVERecord?id=CVE-2026-142191)

**Package:** knex

**Ecosystem:** npm

**Affected:** <= 3.3.0

**Fixed:** None

**Weakness:** CWE-89

**CNA:** VulnCheck

**Credit:** Zachariah Mithani (AploSec) finder
