Remote Code Execution in mongodb-query-parser

mongodb-query-parser Updated 02 Oct 2025

Summary

04/09/2020
CRITICAL
Yes i
Critical
Not published

GHSA-97mg-3cr6-3x4c: Remote Code Execution in mongodb-query-parser. Affects mongodb-query-parser versions < 2.0.0. Fixed in 2.0.0. 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The mongodb-query-parser package is an npm package used for parsing MongoDB queries. It is responsible for sanitizing and processing queries to ensure the security and integrity of the system. However, versions prior to 2.0.0 are vulnerable to Remote Code Execution. This vulnerability allows attackers to execute arbitrary code in the system by exploiting the package's failure to properly sanitize queries.

Vulnerability Detail

The vulnerability in mongodb-query-parser arises from the lack of query sanitization. Attackers can inject malicious code into queries, which will then be executed by the system. This can lead to various security risks, including unauthorized access, data breaches, and system compromise. An example payload that can be used to exploit this vulnerability is:

'(function () { return (clearImmediate.constructor("return process;")()).mainModule.require("child_process").execSync("touch test-file").toString()})()'

When this payload is parsed by the vulnerable package, it will execute the command touch test-file, demonstrating the potential for arbitrary code execution.

How To Fix

Minimum fixed version

2.0.0

This is the first release that contains the fix.

npm install mongodb-query-parser@2.0.0

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

Workaround

There is no known workaround for this vulnerability. Upgrading to the fixed version is the only solution.

Conclusion

The mongodb-query-parser package prior to version 2.0.0 is vulnerable to Remote Code Execution. It is crucial to upgrade to the fixed version to mitigate the risk of arbitrary code execution and ensure the security of the system. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for mongodb-query-parser →

Share this vulnerability

FAQ

This vulnerability allows attackers to execute arbitrary code in the system, which can lead to unauthorized access, data breaches, and system compromise.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide your package-lock.json file and the playground will analyze it for any open-source vulnerabilities, including this one.

While specific exploits may not be publicly available, the vulnerability itself allows for remote code execution. Attackers can craft malicious payloads to exploit this vulnerability and execute arbitrary code in the system.

Yes, a patch is available in version 2.0.0 of the mongodb-query-parser package. Upgrading to this version will fix the vulnerability and prevent remote code execution.

There is no specific evidence of this vulnerability being exploited in the wild. However, it is important to promptly address and fix vulnerabilities to prevent potential exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for mongodb-query-parser.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

2.0.0

This is the first release that contains the fix.

npm install mongodb-query-parser@2.0.0

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