CVE-2024-6376: @mongodb js/connection form Ejson Shell Parser Vulnerability

HIGH
Advisory Identifier: GHSA-jxr4-4prv-mh83
CVSS 7.0
CWE-94 CWE-20
Published
Advisory Summary

CVE-2024-6376 is a HIGH (CVSS 7.0) ejson shell parser vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting @mongodb js/connection form libraries in the npm ecosystem. The issue involves ejson shell parser in mongodb compass maybe bypassed. Remediation is available by upgrading affected packages to version 1.20.1.

CVE-2024-6376 at a Glance

CVE Identifier CVE-2024-6376
GHSA Identifier GHSA-jxr4-4prv-mh83
Severity HIGH
CVSS v3.1 Base Score 7.0
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product @mongodb js/connection form
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-6376

To remediate this vulnerability, upgrade all affected @mongodb js/connection form 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-js/connection-form fixed: 1.20.1
npm install @mongodb-js/connection-form@1.20.1
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-js/connection-form

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-6376, inspect your project dependencies using npm:

npm ls @mongodb-js/connection-form

Analyze the terminal output to locate any version of @mongodb js/connection form in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.20.1), your application is affected.

Note: The npm ls @mongodb-js/connection-form 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In @mongodb js/connection form, 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

MongoDB Compass may be susceptible to code injection due to insufficient sandbox protection settings with the usage of ejson shell parser in Compass' connection handling. This issue affects MongoDB Compass versions prior to version 1.42.2.

CVE-2024-6376 Affected @mongodb js/connection form Versions

1 component(s)
Fixed Versions:
1.20.1
Product / Package Ecosystem Affected Versions Fixed Version
@mongodb-js/connection-form
npm
< 1.20.1
1.20.1

References

Frequently Asked Questions

What is CVE-2024-6376?
CVE-2024-6376 is a security vulnerability in @mongodb js/connection form involving ejson shell parser in MongoDB Compass maybe bypassed under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which @mongodb js/connection form versions are affected?
Affected versions include releases prior to 1.20.1 across affected packages: @mongodb-js/connection-form.
What version fixes CVE-2024-6376?
Upgrading to 1.20.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @mongodb-js/connection-form affected?
Yes, @mongodb-js/connection-form is affected in releases prior to 1.20.1. Upgrade your dependency to 1.20.1 or later.
What is the CVSS score of CVE-2024-6376?
CVE-2024-6376 has a CVSS v3.1 base score of 7.0 (HIGH) with vector string CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-6376?
CVE-2024-6376 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check npm dependencies for CVE-2024-6376?
Run the dependency tree command: 'npm ls @mongodb-js/connection-form'. 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-jxr4-4prv-mh83",
  "modified" : "2025-02-27T20:59:12Z",
  "published" : "2024-07-01T15:32:47Z",
  "aliases" : [ "CVE-2024-6376" ],
  "summary" : "ejson shell parser in MongoDB Compass maybe bypassed",
  "details" : "MongoDB Compass may be susceptible to code injection due to insufficient sandbox protection settings with the usage of ejson shell parser in Compass' connection handling. This issue affects MongoDB Compass versions prior to version 1.42.2.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@mongodb-js/connection-form"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.20.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-6376"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongodb-js/compass/commit/b1f8050d49d66be3bc499cb317a1e1de45390e51"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mongodb-js/compass"
  }, {
    "type" : "WEB",
    "url" : "https://jira.mongodb.org/browse/COMPASS-7496"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-02-27T20:59:11Z",
    "nvd_published_at" : "2024-07-01T15:15:17Z"
  }
}