Skip to content

cumulative-distribution-function Infinite Loop vulnerability

High severity GitHub Reviewed Published Apr 30, 2021 in DrPaulBrewer/cumulative-distribution-function • Updated Jan 29, 2023

Package

npm cumulative-distribution-function (npm)

Affected versions

< 2.0.0

Patched versions

2.0.0

Description

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:

References

Reviewed Apr 30, 2021
Published by the National Vulnerability Database Apr 30, 2021
Published to the GitHub Advisory Database May 4, 2021
Last updated Jan 29, 2023

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

EPSS score

0.259%
(65th percentile)

CVE ID

CVE-2021-29486

GHSA ID

GHSA-58qp-5328-v7mh

Source code

No known source code
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.