GHSA-f5cv-xrv9-r8w7: Express cart SQL Injection Vulnerability

HIGH
CWE-89
Published
Advisory Summary

GHSA-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

CVE Identifier N/A
GHSA Identifier GHSA-f5cv-xrv9-r8w7
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 Express cart
Package Ecosystem npm
Published Date
Last Updated

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.

express-cart fixed: 1.1.8
npm install express-cart@1.1.8
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 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

Versions of `express-cart` before 1.1.8 are vulnerable to NoSQL injection. The 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. These 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. ## Recommendation Update to version 1.1.8 or later.

GHSA-f5cv-xrv9-r8w7 Affected Express cart Versions

1 component(s)
Fixed Versions:
1.1.8
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?
GHSA-f5cv-xrv9-r8w7 is a security vulnerability in Express cart involving NoSQL injection in express-cart under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Express cart versions are affected?
Affected versions include releases prior to 1.1.8 across affected packages: express-cart.
What version fixes GHSA-f5cv-xrv9-r8w7?
Upgrading to 1.1.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is express-cart affected?
Yes, express-cart is affected in releases prior to 1.1.8. Upgrade your dependency to 1.1.8 or later.
What CWE is associated with GHSA-f5cv-xrv9-r8w7?
GHSA-f5cv-xrv9-r8w7 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-f5cv-xrv9-r8w7?
Run the dependency tree command: 'npm ls express-cart'. 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-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
  }
}