SQL Injection Affecting squel package, versions <6.0.2


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDnpm:squel:20180322
  • published9 May 2018
  • disclosed22 Mar 2018
  • creditSean Lynch

Introduced: 22 Mar 2018

CVE NOT AVAILABLE CWE-89  (opens in a new tab)

How to fix?

Upgrade squel to version 6.0.2 or higher.

Overview

squel is a SQL query string builder

Affected versions of this package are vulnerable to SQL Injection. The package does not properly escape user provided input when provided using the setFields method. This could lead to sql injection if the query was then executed.

PoC

> console.log(squel.insert().into('buh').setFields({foo: "bar'baz"}).toString());
INSERT INTO buh (foo) VALUES ('bar\'baz')

CVSS Base Scores

version 3.1