CVE-2023-22579: Sequelize Unsafe Fall-through Vulnerability

CRITICAL
Advisory Identifier: GHSA-vqfx-gj96-3w95
CVSS 9.9
CWE-843
Published
Advisory Summary

CVE-2023-22579 is a CRITICAL (CVSS 9.9) unsafe fall-through vulnerability (CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')) affecting Sequelize libraries in the npm ecosystem. The issue involves unsafe fall-through in getwhereconditions. Remediation is available by upgrading affected packages to version 6.28.1, 7.0.0-alpha.20.

CVE-2023-22579 at a Glance

CVE Identifier CVE-2023-22579
GHSA Identifier GHSA-vqfx-gj96-3w95
Severity CRITICAL
CVSS v3.1 Base Score 9.9
CWE Classification CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')
Affected Product Sequelize
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.9

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

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

How to Fix CVE-2023-22579

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: 6.28.1
npm install sequelize@6.28.1
@sequelize/core fixed: 7.0.0-alpha.20
npm install @sequelize/core@7.0.0-alpha.20
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-2023-22579, 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 6.28.1), 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-843: Access of Resource Using Incompatible Type ('Type Confusion'), where the product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type. 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

### Impact Providing an invalid value to the `where` option of a query caused Sequelize to ignore that option instead of throwing an error. A finder call like the following did not throw an error: ```ts User.findAll({ where: new Date(), }); ``` As this option is typically used with plain javascript objects, be aware that this only happens at the top level of this option. ### Patches This issue has been patched in [`sequelize@6.28.1`](https://github.com/sequelize/sequelize/pull/15699) & [`@sequelize/core@7.0.0.alpha-20`](https://github.com/sequelize/sequelize/pull/15375) ### References A discussion thread about this issue is open at https://github.com/sequelize/sequelize/discussions/15698 CVE: CVE-2023-22579 Snyk: https://security.snyk.io/vuln/SNYK-JS-SEQUELIZE-3324090

CVE-2023-22579 Affected Sequelize Versions

2 component(s)
Fixed Versions:
6.28.17.0.0-alpha.20
Product / Package Ecosystem Affected Versions Fixed Version
sequelize
npm
< 6.28.1
6.28.1
@sequelize/core
npm
< 7.0.0-alpha.20
7.0.0-alpha.20

References

Frequently Asked Questions

What is CVE-2023-22579?
CVE-2023-22579 is a security vulnerability in Sequelize involving Unsafe fall-through in getWhereConditions under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion').
Which Sequelize versions are affected?
Affected versions include releases prior to 6.28.1, 7.0.0-alpha.20 across affected packages: sequelize, @sequelize/core.
What version fixes CVE-2023-22579?
Upgrading to 6.28.1, 7.0.0-alpha.20 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sequelize affected?
Yes, sequelize is affected in releases prior to 6.28.1. Upgrade your dependency to 6.28.1 or later.
Is @sequelize/core affected?
Yes, @sequelize/core is affected in releases prior to 7.0.0-alpha.20. Upgrade your dependency to 7.0.0-alpha.20 or later.
What is the CVSS score of CVE-2023-22579?
CVE-2023-22579 has a CVSS v3.1 base score of 9.9 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2023-22579?
CVE-2023-22579 is classified under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion') (The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.).
How can I check npm dependencies for CVE-2023-22579?
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-vqfx-gj96-3w95",
  "modified" : "2023-02-23T16:58:56Z",
  "published" : "2023-02-23T16:58:56Z",
  "aliases" : [ "CVE-2023-22579" ],
  "summary" : "Unsafe fall-through in getWhereConditions",
  "details" : "### Impact\n\nProviding an invalid value to the `where` option of a query caused Sequelize to ignore that option instead of throwing an error. \n\nA finder call like the following did not throw an error:\n\n```ts\nUser.findAll({\n  where: new Date(),\n});\n```\n\nAs this option is typically used with plain javascript objects, be aware that this only happens at the top level of this option.\n\n### Patches\n\nThis issue has been patched in [`sequelize@6.28.1`](https://github.com/sequelize/sequelize/pull/15699) & [`@sequelize/core@7.0.0.alpha-20`](https://github.com/sequelize/sequelize/pull/15375)\n\n### References\n\nA discussion thread about this issue is open at https://github.com/sequelize/sequelize/discussions/15698\n\nCVE:  CVE-2023-22579\nSnyk: https://security.snyk.io/vuln/SNYK-JS-SEQUELIZE-3324090",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "sequelize"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.28.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@sequelize/core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.0.0-alpha.20"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/security/advisories/GHSA-vqfx-gj96-3w95"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-22579"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/pull/15375"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/pull/15699"
  }, {
    "type" : "WEB",
    "url" : "https://csirt.divd.nl/CVE-2023-22579"
  }, {
    "type" : "WEB",
    "url" : "https://csirt.divd.nl/DIVD-2022-00020"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sequelize/sequelize"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/discussions/15698"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/releases/tag/v6.28.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sequelize/sequelize/releases/tag/v7.0.0-alpha.20"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-843" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-02-23T16:58:56Z",
    "nvd_published_at" : null
  }
}