GHSA-97mg-3cr6-3x4c: Mongodb query parser Remote Code Execution Vulnerability

CRITICAL
Published
Advisory Summary

GHSA-97mg-3cr6-3x4c is a CRITICAL remote code execution vulnerability (General Security Weakness) affecting Mongodb query parser libraries in the npm ecosystem. The issue involves remote code execution in mongodb-query-parser. Remediation is available by upgrading affected packages to version 2.0.0.

GHSA-97mg-3cr6-3x4c at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-97mg-3cr6-3x4c
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Mongodb query parser
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-97mg-3cr6-3x4c

To remediate this vulnerability, upgrade all affected Mongodb query parser dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mongodb-query-parser fixed: 2.0.0
npm install mongodb-query-parser@2.0.0
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 mongodb-query-parser

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-97mg-3cr6-3x4c, inspect your project dependencies using npm:

npm ls mongodb-query-parser

Analyze the terminal output to locate any version of Mongodb query parser in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0), your application is affected.

Note: The npm ls mongodb-query-parser 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 General Security Weakness. In Mongodb query parser, 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 `mongodb-query-parser` prior to 2.0.0 are vulnerable to Remote Code Execution. The package fails to sanitize queries, allowing attackers to execute arbitrary code in the system. Parsing the following payload executes `touch test-file`: ```'(function () { return (clearImmediate.constructor("return process;")()).mainModule.require("child_process").execSync("touch test-file").toString()})()'``` ## Recommendation Upgrade to version 2.0.0 or later.

GHSA-97mg-3cr6-3x4c Affected Mongodb query parser Versions

1 component(s)
Fixed Versions:
2.0.0
Product / Package Ecosystem Affected Versions Fixed Version
mongodb-query-parser
npm
< 2.0.0
2.0.0

References

Frequently Asked Questions

What is GHSA-97mg-3cr6-3x4c?
GHSA-97mg-3cr6-3x4c is a security vulnerability in Mongodb query parser involving Remote Code Execution in mongodb-query-parser under General Security Weakness.
Which Mongodb query parser versions are affected?
Affected versions include releases prior to 2.0.0 across affected packages: mongodb-query-parser.
What version fixes GHSA-97mg-3cr6-3x4c?
Upgrading to 2.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mongodb-query-parser affected?
Yes, mongodb-query-parser is affected in releases prior to 2.0.0. Upgrade your dependency to 2.0.0 or later.
What CWE is associated with GHSA-97mg-3cr6-3x4c?
GHSA-97mg-3cr6-3x4c is classified under General Security Weakness.
How can I check npm dependencies for GHSA-97mg-3cr6-3x4c?
Run the dependency tree command: 'npm ls mongodb-query-parser'. 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-97mg-3cr6-3x4c",
  "modified" : "2020-08-31T18:59:39Z",
  "published" : "2020-09-04T17:27:23Z",
  "aliases" : [ ],
  "summary" : "Remote Code Execution in mongodb-query-parser",
  "details" : "Versions of `mongodb-query-parser` prior to 2.0.0 are vulnerable to Remote Code Execution. The package fails to sanitize queries, allowing attackers to execute arbitrary code in the system.  Parsing the following payload executes `touch test-file`: \n\n```'(function () { return (clearImmediate.constructor(\"return process;\")()).mainModule.require(\"child_process\").execSync(\"touch test-file\").toString()})()'```\n\n\n\n## Recommendation\n\nUpgrade to version 2.0.0 or later.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mongodb-query-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1448"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:59:39Z",
    "nvd_published_at" : null
  }
}