Failure to sanitize quotes which can lead to sql injection in squel
All versions of squel are vulnerable to sql injection.
The squel 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.
Proof of concept demonstrating the injection of a single quote into a generated sql statement from user provided input.
> console.log(squel.insert().into('buh').setFields({foo: "bar'baz"}).toString());
INSERT INTO buh (foo) VALUES ('bar'baz')
Recommendation
There is no fix at this time and the issue has been reported publicly. Consider using another query builder that provides strong guarantees for input sanitization to prevent sql injection attacks.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| npm package | squel | <= 5.13.0 | no fix |
References
- Weakness (CWE)
CWE-74, CWE-89- Platform
- npm
- Package
squel- Disclosed
- 14.06.2019
- Updated
- 11.10.2026 10:22
Sources and licenses
OSV / GitHub Advisory Database - GHSA-4qhx-g9wp-g9m6 - CC BY 4.0
Vulnerability history: squel
All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.
This is the only known vulnerability of this package.
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.