GHSA-f5cv-xrv9-r8w7: Express cart SQL Injection Vulnerability
HIGHGHSA-f5cv-xrv9-r8w7 is a HIGH sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Express cart libraries in the npm ecosystem. The issue involves nosql injection in express-cart. Remediation is available by upgrading affected packages to version 1.1.8.
GHSA-f5cv-xrv9-r8w7 at a Glance
How to Fix GHSA-f5cv-xrv9-r8w7
To remediate this vulnerability, upgrade all affected Express cart 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 express-cart@1.1.8
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls express-cart
How to Check if You Are Affected
To determine whether your Node.js application is affected by GHSA-f5cv-xrv9-r8w7, inspect your project dependencies using npm:
npm ls express-cart
Analyze the terminal output to locate any version of Express cart in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.8), your application is affected.
Note: The npm ls express-cart 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 Express cart, 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
GHSA-f5cv-xrv9-r8w7 Affected Express cart Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
express-cart
|
npm |
< 1.1.8
|
1.1.8
|
References
Frequently Asked Questions
What is GHSA-f5cv-xrv9-r8w7?
Which Express cart versions are affected?
What version fixes GHSA-f5cv-xrv9-r8w7?
Is express-cart affected?
What CWE is associated with GHSA-f5cv-xrv9-r8w7?
How can I check npm dependencies for GHSA-f5cv-xrv9-r8w7?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-f5cv-xrv9-r8w7",
"modified" : "2021-09-24T20:58:36Z",
"published" : "2020-09-01T21:17:16Z",
"aliases" : [ ],
"summary" : "NoSQL injection in express-cart",
"details" : "Versions of `express-cart` before 1.1.8 are vulnerable to NoSQL injection. \n\nThe vulnerability is caused by the lack of user input sanitization in the login handlers. In both cases, the customer login and the admin login, parameters from the JSON body are sent directly into the MongoDB query which allows to insert operators. \n\nThese operators can be used to extract the value of the field blindly in the same manner of a blind SQL injection. In this case, the `$regex` operator is used to guess each character of the token from the start.\n\n\n## Recommendation\n\nUpdate to version 1.1.8 or later.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "express-cart"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.1.8"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.1.7"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://hackerone.com/reports/397445"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/nodejs/security-wg"
}, {
"type" : "WEB",
"url" : "https://github.com/nodejs/security-wg/blob/master/vuln/npm/472.json"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/advisories/724"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-08-31T18:33:28Z",
"nvd_published_at" : null
}
}