Remote Code Execution (RCE) Affecting mongodb-query-parser package, versions <2.0.0


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Remote Code Execution (RCE) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-MONGODBQUERYPARSER-548939
  • published18 Feb 2020
  • disclosed17 Feb 2020
  • creditBen Selwyn-Smith

Introduced: 17 Feb 2020

CVE NOT AVAILABLE CWE-94  (opens in a new tab)

How to fix?

Upgrade mongodb-query-parser to version 2.0.0 or higher.

Overview

mongodb-query-parser is a library for safe parsing and validation for MongoDB queries.

Affected versions of this package are vulnerable to Remote Code Execution (RCE). Does not sanitize queries from function declarations, ternary and comma syntax.

PoC

Parsing the following payload executes touch test-file:

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

CVSS Scores

version 3.1