Vulnerabilities in pkg:npm/bson

PACKAGE
Advisory Identifier: GHSA-8462-q7x7-g2x4
Advisory Summary

CVE-2018-13863 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Bson libraries in the npm ecosystem. The issue involves js-bson vulnerable to redos. Remediation is available by upgrading affected packages to version 1.0.5.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/bson

3 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/bson. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-8462-q7x7-g2x4 CVE-2018-13863 HIGH js-bson vulnerable to REDoS
GHSA-4jwp-vfvf-657p CVE-2019-2391 MODERATE Deserialization of Untrusted Data in bson
GHSA-v8w9-2789-6hhr CVE-2020-7610 CRITICAL Deserialization of Untrusted Data in bson

CVE-2018-13863 at a Glance

CVE Identifier CVE-2018-13863
GHSA Identifier GHSA-8462-q7x7-g2x4
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Bson
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix CVE-2018-13863

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

bson fixed: 1.0.5
npm install bson@1.0.5
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 bson

How to Check if You Are Affected

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

npm ls bson

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

Note: The npm ls bson 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Bson, 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

The MongoDB bson JavaScript module (also known as js-bson) versions 0.5.0 to 1.0.x before 1.0.5 is vulnerable to a Regular Expression Denial of Service (ReDoS) in lib/bson/decimal128.js. The flaw is triggered when the Decimal128.fromString() function is called to parse a long untrusted string.

CVE-2018-13863 Affected Bson Versions

1 component(s)
Fixed Versions:
1.0.5
Product / Package Ecosystem Affected Versions Fixed Version
bson
npm
≥ 0.5.0
< 1.0.5
1.0.5

References

Frequently Asked Questions

What is CVE-2018-13863?
CVE-2018-13863 is a security vulnerability in Bson involving js-bson vulnerable to REDoS under CWE-400: Uncontrolled Resource Consumption.
Which Bson versions are affected?
Affected versions include releases prior to 1.0.5 across affected packages: bson.
What version fixes CVE-2018-13863?
Upgrading to 1.0.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is bson affected?
Yes, bson is affected in releases prior to 1.0.5. Upgrade your dependency to 1.0.5 or later.
What is the CVSS score of CVE-2018-13863?
CVE-2018-13863 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2018-13863?
CVE-2018-13863 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2018-13863?
Run the dependency tree command: 'npm ls bson'. 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-8462-q7x7-g2x4",
  "modified" : "2023-09-05T23:09:22Z",
  "published" : "2018-09-17T20:44:58Z",
  "aliases" : [ "CVE-2018-13863" ],
  "summary" : "js-bson vulnerable to REDoS",
  "details" : "The MongoDB bson JavaScript module (also known as js-bson) versions 0.5.0 to 1.0.x before 1.0.5 is vulnerable to a Regular Expression Denial of Service (ReDoS) in lib/bson/decimal128.js. The flaw is triggered when the Decimal128.fromString() function is called to parse a long untrusted string.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "bson"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.5.0"
      }, {
        "fixed" : "1.0.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-13863"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongodb/js-bson/commit/bd61c45157c53a1698ff23770160cf4783e9ea4a"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-8462-q7x7-g2x4"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mongodb/js-bson"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/npm:bson:20180225"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-185", "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:24:09Z",
    "nvd_published_at" : null
  }
}