CVE-2016-10556: Sequelize SQL Injection Vulnerability
HIGHCVE-2016-10556 is a HIGH (CVSS 7.5) 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 in sequelize. Remediation is available by upgrading affected packages to version 3.20.0.
CVE-2016-10556 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2016-10556
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.
npm install sequelize@3.20.0
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-10556, 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.20.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
CVE-2016-10556 Affected Sequelize Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
sequelize
|
npm |
< 3.20.0
|
3.20.0
|
References
Frequently Asked Questions
What is CVE-2016-10556?
Which Sequelize versions are affected?
What version fixes CVE-2016-10556?
Is sequelize affected?
What is the CVSS score of CVE-2016-10556?
What CWE is associated with CVE-2016-10556?
How can I check npm dependencies for CVE-2016-10556?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9c2p-jw8p-f84v",
"modified" : "2023-09-11T21:48:29Z",
"published" : "2019-02-18T23:54:24Z",
"aliases" : [ "CVE-2016-10556" ],
"summary" : "SQL Injection in sequelize",
"details" : "Affected versions of `sequelize` cast arrays to strings and fail to properly escape the resulting SQL statement, resulting in a SQL injection vulnerability.\n\n\n## Proof of Concept\nIn Postgres, SQLite, and Microsoft SQL Server there is an issue where arrays are treated as strings and improperly escaped.\n\nExample Query:\n```\ndatabase.query('SELECT * FROM TestTable WHERE Name IN (:names)', {\n replacements: {\n names: directCopyOfUserInput\n }\n});\n```\n\nIf the user inputs the value of `:names` as:\n```\n[\"test\", \"'); DELETE TestTable WHERE Id = 1 --')\"]\n```\n\nThe resulting SQL statement will be:\n```sql\nSELECT Id FROM Table WHERE Name IN ('test', '\\'); DELETE TestTable WHERE Id = 1 --')\n```\nAs the backslash has no special meaning in PostgreSQL, MSSQL, or SQLite, the statement will delete the record in TestTable with an Id of 1.\n\n\n## Recommendation\n\nUpdate to version 3.20.0 or later.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "sequelize"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.20.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.19.3"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-10556"
}, {
"type" : "WEB",
"url" : "https://github.com/sequelize/sequelize/issues/5671"
}, {
"type" : "WEB",
"url" : "https://github.com/sequelize/sequelize/commit/23952a2b020cc3571f090e67dae7feb084e1be71"
}, {
"type" : "WEB",
"url" : "https://github.com/sequelize/sequelize/commits/v3.20.0?after=62e4dacb28a779a190a3e042b971dcd8c7926e49+34&branch=v3.20.0&qualified_name=refs%2Ftags%2Fv3.20.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T21:28:12Z",
"nvd_published_at" : null
}
}