Vulnerabilities in pkg:pypi/mpmath

PACKAGE
Advisory Identifier: GHSA-f865-m6cq-j9vx
Advisory Summary

CVE-2021-29063 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Mpmath libraries in the PyPI ecosystem. The issue involves redos in mpmath. Remediation is available by upgrading affected packages to version 1.3.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/mpmath

1 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-f865-m6cq-j9vx CVE-2021-29063 HIGH ReDOS in Mpmath

CVE-2021-29063 at a Glance

CVE Identifier CVE-2021-29063
GHSA Identifier GHSA-f865-m6cq-j9vx
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product Mpmath
Package Ecosystem PyPI
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-29063

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

mpmath fixed: 1.3.0
pip install mpmath>=1.3.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show mpmath

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2021-29063, inspect your installed packages using pip:

pip show mpmath

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

Note: The pip show mpmath command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In Mpmath, 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

A Regular Expression Denial of Service (ReDOS) vulnerability was discovered in Mpmath v1.0.0 when the mpmathify function is called.

CVE-2021-29063 Affected Mpmath Versions

1 component(s)
Fixed Versions:
1.3.0
Product / Package Ecosystem Affected Versions Fixed Version
mpmath
PyPI
< 1.3.0
1.3.0

References

NVD — CVE-2021-29063 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-29063
Mpmath Source Repository REPOSITORY
https://github.com/fredrik-johansson/mpmath/issues/548
Mpmath Source Repository REPOSITORY
https://github.com/mpmath/mpmath/pull/570
Mpmath Source Repository REPOSITORY
https://github.com/npm/hosted-git-info/pull/76
Security Fix Commit FIX COMMIT
https://github.com/fredrik-johansson/mpmath/commit/46d44c3c8f3244017fe1eb102d564eb4ab8ef750
Security Fix Commit FIX COMMIT
https://github.com/fredrik-johansson/mpmath/commit/c811b37c65a4372a7ce613111d2a508c204f9833
Security Fix Commit FIX COMMIT
https://github.com/mpmath/mpmath/commit/c811b37c65a4372a7ce613111d2a508c204f9833
www.npmjs.com/package/hosted-git-... WEB
https://www.npmjs.com/package/hosted-git-info
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MS2U6GLXQSRZJE2HVUAUMVFR2DWQLCZG
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/EIUX3XWY2K3MSO7QXMZXQQYAURARSPC5
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3M5O55E7VUDMXCPQR6MQTOIFDKHP36AA
Mpmath Source Repository REPOSITORY
https://github.com/yetingli/SaveResults/blob/main/js/hosted-git-info.js
Mpmath Source Repository REPOSITORY
https://github.com/yetingli/PoCs/blob/main/CVE-2021-29063/Mpmath.md
Mpmath Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/mpmath/PYSEC-2021-427.yaml
Mpmath Release RELEASE
https://github.com/mpmath/mpmath/releases/tag/1.3.0
Mpmath Source Repository REPOSITORY
https://github.com/fredrik-johansson/mpmath
GitHub Advisory / Wiki ADVISORY
https://github.com/advisories/GHSA-f865-m6cq-j9vx

Frequently Asked Questions

What is CVE-2021-29063?
CVE-2021-29063 is a security vulnerability in Mpmath involving ReDOS in Mpmath under CWE-770: Allocation of Resources Without Limits or Throttling.
Which Mpmath versions are affected?
Affected versions include releases prior to 1.3.0 across affected packages: mpmath.
What version fixes CVE-2021-29063?
Upgrading to 1.3.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mpmath affected?
Yes, mpmath is affected in releases prior to 1.3.0. Upgrade your dependency to 1.3.0 or later.
What is the CVSS score of CVE-2021-29063?
CVE-2021-29063 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-29063?
CVE-2021-29063 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check PyPI dependencies for CVE-2021-29063?
Run the dependency tree command: 'pip show mpmath'. 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-f865-m6cq-j9vx",
  "modified" : "2024-10-03T21:26:29Z",
  "published" : "2021-08-09T20:44:51Z",
  "aliases" : [ "CVE-2021-29063" ],
  "summary" : "ReDOS in Mpmath",
  "details" : "A Regular Expression Denial of Service (ReDOS) vulnerability was discovered in Mpmath v1.0.0 when the mpmathify function is called.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "mpmath"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29063"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fredrik-johansson/mpmath/issues/548"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mpmath/mpmath/pull/570"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/npm/hosted-git-info/pull/76"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fredrik-johansson/mpmath/commit/46d44c3c8f3244017fe1eb102d564eb4ab8ef750"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fredrik-johansson/mpmath/commit/c811b37c65a4372a7ce613111d2a508c204f9833"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mpmath/mpmath/commit/c811b37c65a4372a7ce613111d2a508c204f9833"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/hosted-git-info"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MS2U6GLXQSRZJE2HVUAUMVFR2DWQLCZG"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/EIUX3XWY2K3MSO7QXMZXQQYAURARSPC5"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3M5O55E7VUDMXCPQR6MQTOIFDKHP36AA"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yetingli/SaveResults/blob/main/js/hosted-git-info.js"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yetingli/PoCs/blob/main/CVE-2021-29063/Mpmath.md"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/mpmath/PYSEC-2021-427.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mpmath/mpmath/releases/tag/1.3.0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/fredrik-johansson/mpmath"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-f865-m6cq-j9vx"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-06-22T16:00:52Z",
    "nvd_published_at" : "2021-06-21T20:15:00Z"
  }
}