CVE-2016-1000225: Sequelize SQL Injection Vulnerability

CRITICAL
Advisory Identifier: GHSA-5v9h-q3gj-c32x
CVSS 9.8
CWE-89
Published
Advisory Summary

CVE-2016-1000225 is a CRITICAL (CVSS 9.8) 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 sql injection via geojson in sequelize. Remediation is available by upgrading affected packages to version 3.23.6.

CVE-2016-1000225 at a Glance

CVE Identifier CVE-2016-1000225
GHSA Identifier GHSA-5v9h-q3gj-c32x
Severity CRITICAL
CVSS v3.1 Base Score 9.8
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

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2016-1000225

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: 3.23.6
npm install sequelize@3.23.6
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 CVE-2016-1000225, 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 3.23.6), 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

Affected versions of `sequelize` are vulnerable to SQL Injection in Models that have fields with the `GEOMETRY` DataType. This vulnerability occurs because single quotes in document values are not escaped for GeoJSON documents using `ST_GeomFromGeoJSON`, and MySQL GeoJSON documents using `GeomFromText`. ## Recommendation Update to version 3.23.6 or later.

CVE-2016-1000225 Affected Sequelize Versions

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

References

Frequently Asked Questions

What is CVE-2016-1000225?
CVE-2016-1000225 is a security vulnerability in Sequelize involving SQL Injection via GeoJSON 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 3.23.6 across affected packages: sequelize.
What version fixes CVE-2016-1000225?
Upgrading to 3.23.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sequelize affected?
Yes, sequelize is affected in releases prior to 3.23.6. Upgrade your dependency to 3.23.6 or later.
What is the CVSS score of CVE-2016-1000225?
CVE-2016-1000225 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2016-1000225?
CVE-2016-1000225 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 CVE-2016-1000225?
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-5v9h-q3gj-c32x",
  "modified" : "2021-09-23T21:29:13Z",
  "published" : "2020-09-01T15:27:40Z",
  "aliases" : [ "CVE-2016-1000225" ],
  "summary" : "SQL Injection via GeoJSON in sequelize",
  "details" : "Affected versions of `sequelize` are vulnerable to SQL Injection in Models that have fields with the `GEOMETRY` DataType. This vulnerability occurs because single quotes in document values are not escaped for GeoJSON documents using `ST_GeomFromGeoJSON`, and MySQL GeoJSON documents using `GeomFromText`.\n\n\n## Recommendation\n\nUpdate to version 3.23.6 or later.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "sequelize"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.4.0"
      }, {
        "fixed" : "3.23.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-1000225"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/issues/6194"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/pull/6302"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/pull/6306"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/commit/14e3deaf3ad27f12900e5275db1d448844c9de3e"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/commit/18ac91040d9c57351d26ba998f460e214255b704"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/commit/562d52585902090f4e53eb21c61314098c29d795"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/commit/f93af43a1d86400487f5e3d9762f1a4b7cf6b1e1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sequelize/sequelize"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/npm:sequelize:20160718"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:11:32Z",
    "nvd_published_at" : null
  }
}