GHSA-wfp9-vr4j-f49j: Sequelize SQL Injection Vulnerability

HIGH
CWE-89
Published
Advisory Summary

GHSA-wfp9-vr4j-f49j is a HIGH sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Sequelize libraries in the npm ecosystem. The issue involves nosql injection in sequelize. Remediation is available by upgrading affected packages to version 4.12.0.

GHSA-wfp9-vr4j-f49j at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-wfp9-vr4j-f49j
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Sequelize
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-wfp9-vr4j-f49j

To remediate this vulnerability, upgrade all affected Sequelize dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

sequelize fixed: 4.12.0
npm install sequelize@4.12.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls sequelize

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-wfp9-vr4j-f49j, inspect your project dependencies using npm:

npm ls sequelize

Analyze the terminal output to locate any version of Sequelize in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.12.0), your application is affected.

Note: The npm ls sequelize command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Sequelize, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Versions of `sequelize` prior to 4.12.0 are vulnerable to NoSQL Injection. Query operators such as `$gt` are not properly sanitized and may allow an attacker to alter data queries, leading to NoSQL Injection. ## Recommendation Upgrade to version 4.12.0 or later

GHSA-wfp9-vr4j-f49j Affected Sequelize Versions

1 component(s)
Fixed Versions:
4.12.0
Product / Package Ecosystem Affected Versions Fixed Version
sequelize
npm
< 4.12.0
4.12.0

References

Frequently Asked Questions

What is GHSA-wfp9-vr4j-f49j?
GHSA-wfp9-vr4j-f49j is a security vulnerability in Sequelize involving NoSQL Injection in sequelize under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Sequelize versions are affected?
Affected versions include releases prior to 4.12.0 across affected packages: sequelize.
What version fixes GHSA-wfp9-vr4j-f49j?
Upgrading to 4.12.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sequelize affected?
Yes, sequelize is affected in releases prior to 4.12.0. Upgrade your dependency to 4.12.0 or later.
What CWE is associated with GHSA-wfp9-vr4j-f49j?
GHSA-wfp9-vr4j-f49j is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check npm dependencies for GHSA-wfp9-vr4j-f49j?
Run the dependency tree command: 'npm ls sequelize'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-wfp9-vr4j-f49j",
  "modified" : "2023-04-21T19:34:39Z",
  "published" : "2019-06-04T20:04:27Z",
  "aliases" : [ ],
  "summary" : "NoSQL Injection in sequelize",
  "details" : "Versions of `sequelize` prior to 4.12.0 are vulnerable to NoSQL Injection. Query operators such as `$gt` are not properly sanitized and may allow an attacker to alter data queries, leading to NoSQL Injection.\n\n\n## Recommendation\n\nUpgrade to version 4.12.0 or later",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "sequelize"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.12.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/issues/7310"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/pull/8240"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/commit/ccb99daedb69e8750a241436415ccac8abef358d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sequelize/sequelize"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-SEQUELIZE-174147"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2019-06-04T20:04:00Z",
    "nvd_published_at" : null
  }
}