CVE-2019-2391: Bson Deserialization Of Untrusted Data Vulnerability

MODERATE
Advisory Identifier: GHSA-4jwp-vfvf-657p
CVSS 5.4
CWE-502
Published
Advisory Summary

CVE-2019-2391 is a MODERATE (CVSS 5.4) deserialization of untrusted data vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Bson libraries in the npm ecosystem. The issue involves deserialization of untrusted data in bson. Remediation is available by upgrading affected packages to version 1.1.4.

CVE-2019-2391 at a Glance

CVE Identifier CVE-2019-2391
GHSA Identifier GHSA-4jwp-vfvf-657p
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Bson
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.4

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

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

How to Fix CVE-2019-2391

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.1.4
npm install bson@1.1.4
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-2019-2391, 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.1.4), 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-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. 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

Incorrect parsing of certain JSON input may result in js-bson not correctly serializing BSON. This may cause unexpected application behaviour including data disclosure.

CVE-2019-2391 Affected Bson Versions

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

References

Frequently Asked Questions

What is CVE-2019-2391?
CVE-2019-2391 is a security vulnerability in Bson involving Deserialization of Untrusted Data in bson under CWE-502: Deserialization of Untrusted Data.
Which Bson versions are affected?
Affected versions include releases prior to 1.1.4 across affected packages: bson.
What version fixes CVE-2019-2391?
Upgrading to 1.1.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is bson affected?
Yes, bson is affected in releases prior to 1.1.4. Upgrade your dependency to 1.1.4 or later.
What is the CVSS score of CVE-2019-2391?
CVE-2019-2391 has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2019-2391?
CVE-2019-2391 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check npm dependencies for CVE-2019-2391?
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-4jwp-vfvf-657p",
  "modified" : "2023-06-20T14:22:16Z",
  "published" : "2022-02-10T23:30:20Z",
  "aliases" : [ "CVE-2019-2391" ],
  "summary" : "Deserialization of Untrusted Data in bson",
  "details" : "Incorrect parsing of certain JSON input may result in js-bson not correctly serializing BSON. This may cause unexpected application behaviour including data disclosure.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "bson"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-2391"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mongodb/js-bson"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongodb/js-bson/releases/tag/v1.1.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-07T17:19:18Z",
    "nvd_published_at" : "2020-03-31T14:15:00Z"
  }
}