# CVE-2019-10757: knex SQL Injection in MSSQL dialect

Source: https://junglewise.ai/threats/cve-2019-10757-knex-sql-injection-in-mssql-dialect  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2019-10-21. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2019-10757 · Severity: low · CVSS 3.1 · Published 2019-10-21

knex is a popular query builder library used by developers to safely construct database queries for PostgreSQL, MySQL, and SQLite3. A flaw in the MSSQL dialect allows attackers to inject arbitrary SQL commands by crafting specially malformed identifiers, potentially allowing them to steal, modify, or delete database contents. The vulnerability requires network access to an application using the affected library but does not require authentication or user interaction.

Technologies: [knex (npm)](https://junglewise.ai/threats/technologies/knex). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2019-10757 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2019-10757 being exploited in the wild.

**How severe is CVE-2019-10757?** Low severity, with a CVSS score of 3.1, published 21 October 2019.

**Which products and versions are affected?** knex (npm) SEMVER:introduced=0,fixed=0.19.5.

**Is there a fix for CVE-2019-10757?** Yes. knex (npm): upgrade to 0.19.5 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2019-10757 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2019-10757?** Check whether you run knex (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- knex (npm): upgrade to 0.19.5 or later

  ```sh
  npm install knex@0.19.5
  ```


## Technical details

This is a SQL Injection vulnerability (CWE-89) in knex.js versions prior to 0.19.5, specifically affecting the MSSQL dialect implementation. The root cause is incorrect escaping of database identifiers, which allows an attacker to break out of the intended identifier context and inject arbitrary SQL. The attack is remotely exploitable over the network, requires no authentication or privileges, and does not require user interaction—an attacker can directly send malicious input through an application using the vulnerable library. Successful exploitation allows complete compromise of the database: attackers can read sensitive data, modify records, delete data, or execute administrative commands depending on database permissions. The fix is to upgrade to knex version 0.19.5 or later.

## Affected products

- knex knex < 0.19.5

## Identifiers

- CVE-2019-10757
- GHSA-58v4-qwx5-7f59

## Timeline

- 2019-10-07: disclosed
- 2019-10-21: advisory
- 2019-10-08: patched: Fix released in version 0.19.5

## References

- [https://snyk.io/vuln/SNYK-JS-KNEX-471962](https://snyk.io/vuln/SNYK-JS-KNEX-471962)

## Related threats

- [Knex.js SQL injection via object WHERE clause](https://junglewise.ai/threats/cve-2016-20018-knex-js-sql-injection-via-object-where-clause)
