CVE-2021-29063: Regular Expression Denial of Service (ReDOS) in mpmath

mpmath Updated 02 Oct 2025

Summary

21/06/2021
Yes i
High
7.5

CVE-2021-29063: A Regular Expression Denial of Service (ReDOS) vulnerability was discovered in Mpmath v1.0.0 when the mpmathify function is called. Affects mpmath across 2 version ranges.

< 1.3.0 < 46d44c3c8f3244017fe1eb102d564eb4ab8ef750

Fixed in 46d44c3c8f3244017fe1eb102d564eb4ab8ef750. How to fix ↓

Also tracked for

The same CVE-2021-29063 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Mpmath is a Python library that provides arbitrary-precision arithmetic and mathematical functions. It is commonly used for numerical computations and symbolic mathematics. The library offers a wide range of mathematical functions and supports high-precision floating-point arithmetic. However, a vulnerability has been discovered in version 1.0.0 of mpmath when the mpmathify function is called.

Vulnerability Detail

The vulnerability, known as Regular Expression Denial of Service (ReDOS), allows an attacker to exploit the mpmathify function, leading to a denial of service condition. By providing specially crafted input, an attacker can cause the function to enter into an inefficient regular expression matching process, resulting in excessive CPU usage and potentially causing the application to become unresponsive. This vulnerability can be triggered remotely by an attacker with the ability to control the input to the mpmathify function.

How To Fix

Minimum fixed version

46d44c3c8f3244017fe1eb102d564eb4ab8ef750

This is the first release that contains the fix.

pip install --upgrade "mpmath==46d44c3c8f3244017fe1eb102d564eb4ab8ef750"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is strongly advised to update to the latest version of mpmath to mitigate the risk.

Conclusion

In conclusion, the mpmath library is vulnerable to a Regular Expression Denial of Service (ReDOS) attack when the mpmathify function is called. This vulnerability can lead to a denial of service condition and should be addressed by updating to mpmath version 1.3.0 or later. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for mpmath →

Share this vulnerability

FAQ

Mpmath is a Python library that provides arbitrary-precision arithmetic and mathematical functions.

This vulnerability can lead to a denial of service condition, potentially causing the application to become unresponsive.

To fix this vulnerability, update the mpmath package to version 1.3.0 or later.

There is no known workaround for this vulnerability. It is recommended to update to the latest version of mpmath.

Yes, this vulnerability can be triggered remotely by an attacker with the ability to control the input to the mpmathify function.

Related vulnerabilities

Recent vulnerabilities recorded for mpmath.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

46d44c3c8f3244017fe1eb102d564eb4ab8ef750

This is the first release that contains the fix.

pip install --upgrade "mpmath==46d44c3c8f3244017fe1eb102d564eb4ab8ef750"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback