NoSQL Injection in express-cart

express-cart Updated 02 Oct 2025

Summary

01/09/2020
HIGH
Yes i
High
Not published

GHSA-f5cv-xrv9-r8w7: NoSQL injection in express-cart. Affects express-cart versions < 1.1.8. Fixed in 1.1.8. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

express-cart is an npm package that provides a shopping cart functionality for Express.js applications. It allows users to manage their shopping carts and make purchases through an API. However, versions of express-cart before 1.1.8 are vulnerable to NoSQL injection.

Vulnerability Detail

The vulnerability in express-cart is due to the lack of user input sanitization in the login handlers. Both the customer login and admin login endpoints accept parameters from the JSON body and directly use them in MongoDB queries without proper validation. This allows an attacker to insert operators and perform NoSQL injection attacks. By using the $regex operator, an attacker can guess each character of the token from the start, similar to a blind SQL injection.

How To Fix

Minimum fixed version

1.1.8

This is the first release that contains the fix.

npm install express-cart@1.1.8

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating to the latest version is not possible, a temporary workaround is to manually sanitize and validate the user input before using it in MongoDB queries. This can be done by checking the input for any special characters or operators and rejecting or escaping them.

Conclusion

express-cart versions before 1.1.8 are vulnerable to NoSQL injection. It is crucial to update to the latest version or apply proper input sanitization to prevent exploitation of this vulnerability. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for express-cart →

Share this vulnerability

FAQ

NoSQL injection is a type of vulnerability where an attacker can manipulate non-relational database queries to execute unintended actions or gain unauthorized access to data.

express-cart is an npm package that provides shopping cart functionality for Express.js applications, allowing users to manage their shopping carts and make purchases through an API.

The NoSQL injection in express-cart occurs due to the lack of input sanitization in the login handlers. Attackers can insert operators in the JSON body parameters, which are then used in MongoDB queries without proper validation.

This vulnerability allows an attacker to perform NoSQL injection attacks, potentially leading to unauthorized access to sensitive data or the ability to execute unintended actions on the application.

To protect your application, it is recommended to update express-cart to version 1.1.8 or later. Additionally, always validate and sanitize user input before using it in database queries to prevent injection attacks.

Related vulnerabilities

Recent vulnerabilities recorded for express-cart.

How To Fix

Minimum fixed version

1.1.8

This is the first release that contains the fix.

npm install express-cart@1.1.8

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback