CVE-2016-20018 Knex.js has a limited SQL injection vulnerability

High 7.5 Published Updated

Attackers can exploit a SQL injection flaw in Knex.js to bypass WHERE clauses, potentially reading or modifying database records.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2016-20018?

CVE-2016-20018 is a high-severity SQL injection vulnerability in n/a, published on 19 Dec 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Knex Knex.js through 2.3.0 has a limited SQL injection vulnerability that can be exploited to ignore the WHERE clause of a SQL query.

Weakness: CWE-89

Which versions are affected by CVE-2016-20018?

2 open source packages ship an affected version, including knex. It affects 1 product.

PackageAffectedFixed in
knex npmAll versions2.4.0
knex npmAll versions2.4.0

Products include Knexjs Knex.

How do I fix CVE-2016-20018?

Upgrade knex to 2.4.0 or later.

Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.

Is CVE-2016-20018 being exploited?

There is no known exploitation of CVE-2016-20018 in the wild and no public exploit code.

Sources

Also known as CLEANSTART-2026-MA00525, CLSA-2026-1774830252, CVE-2023-22494, GHSA-4jv9-3563-23j3, ROOT-APP-NPM-CVE-2016-20018.

Is CVE-2016-20018 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free