Vulnerabilities in pkg:npm/cumulative-distribution-function

PACKAGE
Advisory Identifier: GHSA-58qp-5328-v7mh
Advisory Summary

CVE-2021-29486 is a HIGH (CVSS 7.5) cumulative-distribution-function infinite loop vulnerability vulnerability (CWE-20: Improper Input Validation) affecting Cumulative distribution function libraries in the npm ecosystem. The issue involves cumulative-distribution-function infinite loop vulnerability. Remediation is available by upgrading affected packages to version 2.0.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/cumulative-distribution-function

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/cumulative-distribution-function. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-58qp-5328-v7mh CVE-2021-29486 HIGH cumulative-distribution-function Infinite Loop vulnerability

CVE-2021-29486 at a Glance

CVE Identifier CVE-2021-29486
GHSA Identifier GHSA-58qp-5328-v7mh
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-20: Improper Input Validation
Affected Product Cumulative distribution function
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.1/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-2021-29486

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

cumulative-distribution-function fixed: 2.0.0
npm install cumulative-distribution-function@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 cumulative-distribution-function

How to Check if You Are Affected

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

npm ls cumulative-distribution-function

Analyze the terminal output to locate any version of Cumulative distribution function 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 cumulative-distribution-function 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Cumulative distribution function, 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

### Impact * Apps using this library on improper data may crash or go into an infinite-loop * In the case of a nodejs server-app using this library to act on invalid non-numeric data, the nodejs server may crash. This may affect other users of this server and/or require the server to be rebooted for proper operation. * In the case of a browser app using this library to act on invalid non-numeric data, that browser may crash or lock up. A flaw enabling an infinite-loop was discovered in the code for evaluating the cumulative-distribution-function of input data. Although the documentation explains that numeric data is required, some users may confuse an array of strings like ["1","2","3","4","5"] for numeric data [1,2,3,4,5] when it is in fact string data. An infinite loop is possible when the cumulative-distribution-function is evaluated for a given point when the input data is string data rather than type `number`. This vulnerability enables an infinite-cpu-loop denial-of-service-attack on any app using npm:cumulative-distribution-function v1.0.3 or earlier if the attacker can supply malformed data to the library. The vulnerability could also manifest if a data source to be analyzed changes data type from Arrays of number (proper) to Arrays of string (invalid, but undetected by earlier version of the library). ### Patches Users should upgrade to at least v2.0.0, or the latest version. Tests for several types of invalid data have been created, and version 2.0.0 has been tested to reject this invalid data by throwing a `TypeError()` instead of processing it. Developers using this library may wish to adjust their app's code slightly to better tolerate or handle this TypeError. Apps performing proper numeric data validation before sending data to this library should be mostly unaffected by this patch. ### Workarounds The vulnerability can be mitigated in older versions by ensuring that only finite numeric data of type `Array[number]` or `number` is passed to `cumulative-distribution-function` and its `f(x)` function, respectively. ### For more information If you have any questions or comments about this advisory: * Open an issue in the Github repository at https://github.com/DrPaulBrewer/cumulative-distribution-function

CVE-2021-29486 Affected Cumulative distribution function Versions

1 component(s)
Fixed Versions:
2.0.0
Product / Package Ecosystem Affected Versions Fixed Version
cumulative-distribution-function
npm
< 2.0.0
2.0.0

References

Frequently Asked Questions

What is CVE-2021-29486?
CVE-2021-29486 is a security vulnerability in Cumulative distribution function involving cumulative-distribution-function Infinite Loop vulnerability under CWE-20: Improper Input Validation.
Which Cumulative distribution function versions are affected?
Affected versions include releases prior to 2.0.0 across affected packages: cumulative-distribution-function.
What version fixes CVE-2021-29486?
Upgrading to 2.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cumulative-distribution-function affected?
Yes, cumulative-distribution-function is affected in releases prior to 2.0.0. Upgrade your dependency to 2.0.0 or later.
What is the CVSS score of CVE-2021-29486?
CVE-2021-29486 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-29486?
CVE-2021-29486 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2021-29486?
Run the dependency tree command: 'npm ls cumulative-distribution-function'. 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-58qp-5328-v7mh",
  "modified" : "2022-08-11T00:22:08Z",
  "published" : "2021-05-04T17:43:36Z",
  "aliases" : [ "CVE-2021-29486" ],
  "summary" : "cumulative-distribution-function Infinite Loop vulnerability",
  "details" : "### Impact\n\n* Apps using this library on improper data may crash or go into an infinite-loop\n* In the case of a nodejs server-app using this library to act on invalid non-numeric data, the nodejs server may crash.  This may affect other users of this server and/or require the server to be rebooted for proper operation.  \n* In the case of a browser app using this library to act on invalid non-numeric data, that browser may crash or lock up.\n\nA flaw enabling an infinite-loop was discovered in the code for evaluating the cumulative-distribution-function\nof input data.   Although the documentation explains that numeric data is required, some users may confuse an array\nof strings like [\"1\",\"2\",\"3\",\"4\",\"5\"] for numeric data [1,2,3,4,5] when it is in fact string data.  An infinite loop is possible when the \ncumulative-distribution-function  is evaluated for a given point when the input data is string data rather than type `number`.  \n\nThis vulnerability enables an infinite-cpu-loop denial-of-service-attack on any app using npm:cumulative-distribution-function v1.0.3 or earlier if the attacker can supply malformed data to the library.  The vulnerability could also manifest if a data source to\nbe analyzed changes data type from Arrays of number (proper) to Arrays of string (invalid, but undetected by earlier version of the library).\n\n### Patches\n\nUsers should upgrade to at least v2.0.0, or the latest version.\n\nTests for several types of invalid data have been created, and version 2.0.0 has been tested to reject this invalid data by\nthrowing a `TypeError()` instead of processing it.  Developers using this library may wish to adjust their app's code slightly to better tolerate or handle this TypeError.  Apps performing proper numeric data validation before sending data to this library should be mostly unaffected by this patch.  \n\n### Workarounds\n\nThe vulnerability can be mitigated in older versions by ensuring that only finite numeric data of type `Array[number]` or `number` is passed to `cumulative-distribution-function` and its `f(x)` function, respectively.  \n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in the Github repository at https://github.com/DrPaulBrewer/cumulative-distribution-function",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "cumulative-distribution-function"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/DrPaulBrewer/cumulative-distribution-function/security/advisories/GHSA-58qp-5328-v7mh"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29486"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DrPaulBrewer/cumulative-distribution-function/issues/7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DrPaulBrewer/cumulative-distribution-function/pull/8"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/cumulative-distribution-function"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-30T17:36:06Z",
    "nvd_published_at" : "2021-04-30T18:15:00Z"
  }
}