SQL Injection Vulnerability in squel

squel Updated 02 Oct 2025

Summary

14/06/2019
CRITICAL
No i
Critical
Not published

GHSA-4qhx-g9wp-g9m6: Failure to sanitize quotes which can lead to sql injection in squel. Affects squel versions < 5.13.0. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

squel is an npm package that provides a query builder for constructing SQL statements. It allows developers to programmatically generate SQL queries in a convenient and safe manner. However, all versions of squel are vulnerable to SQL injection attacks.

Vulnerability Detail

The vulnerability in squel arises from a failure to properly sanitize user-provided input when using the setFields method. This can lead to SQL injection if the generated query is executed without proper sanitization. An attacker could exploit this vulnerability to manipulate the SQL statement and potentially perform unauthorized actions on the database.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, developers can manually sanitize user input before passing it to the setFields method. This involves escaping special characters and ensuring that the input is properly formatted for SQL queries. Here's an example of how to sanitize user input in JavaScript:

const sanitizedInput = userInput.replace(/'/g, "''");

squel.insert().into('buh').setFields({ foo: sanitizedInput }).toString();

Conclusion

The SQL injection vulnerability in squel can pose a significant risk to applications that utilize this package for generating SQL queries. It is crucial to take appropriate measures to mitigate this vulnerability, such as using alternative query builders or manually sanitizing user input. For further assistance and support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for squel →

Share this vulnerability

FAQ

squel is an npm package that provides a query builder for constructing SQL statements. It offers a convenient way to generate SQL queries programmatically.

SQL injection is a type of security vulnerability where an attacker can manipulate SQL statements by injecting malicious input. This can lead to unauthorized access, data breaches, and other malicious activities.

The vulnerability in squel occurs due to the lack of proper input sanitization when using the setFields method. This allows an attacker to inject malicious SQL code into the generated query.

The potential consequences of this vulnerability include unauthorized access to the database, data manipulation or deletion, and potential exposure of sensitive information.

No, there is currently no fix available for this vulnerability. It is recommended to use an alternative query builder that provides strong input sanitization.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback