Buffer Overflow Vulnerability in NumPy Package: CVE-2021-41496

numpy Updated 02 Oct 2025

Summary

17/12/2021
N/A
No i
Unrated
Not published

DEBIAN-CVE-2021-41496: Buffer overflow in the array_from_pyobj function of fortranobject.c in NumPy < 1.19, which allows attackers to conduct a Denial of Service attacks by carefully constructing an array with negative values. Affects numpy versions 1:1.19.5-1 – 1:2.3.3+ds-1. No fix is published. How to fix ↓

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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

NumPy is a widely used open-source library in Python, essential for numerical computations. It provides support for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays. This library is integral to scientific computing and data analysis in Python. However, a vulnerability has been identified in versions prior to 1.19, which could potentially allow attackers to exploit the library under certain conditions.

Vulnerability Detail

The vulnerability, identified as CVE-2021-41496, arises from a buffer overflow in the 'array_from_pyobj' function located in 'fortranobject.c' within NumPy versions less than 1.19. This flaw allows attackers to conduct Denial of Service (DoS) attacks by crafting an array with negative dimensions. Although the vendor does not classify this as a vulnerability, it is important to note that such negative dimensions can only be created by a privileged user or internally, which raises concerns about the integrity of the application.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a workaround, avoid using negative dimensions when constructing arrays in NumPy. Ensure that all dimensions are non-negative to prevent triggering the buffer overflow.

Conclusion

In summary, CVE-2021-41496 is a buffer overflow vulnerability in the NumPy package that can lead to Denial of Service attacks. Users are encouraged to update to version 1.19 or higher to mitigate this risk. Additionally, avoiding negative dimensions in array construction can serve as a temporary workaround.

See every vulnerability recorded for numpy →

Share this vulnerability

FAQ

CVE-2021-41496 is a buffer overflow vulnerability in the NumPy library that can lead to Denial of Service attacks.

All versions of NumPy prior to 1.19 are affected by this vulnerability.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

If an immediate update is not possible, ensure that your code does not use negative dimensions when creating arrays as a temporary workaround.

The vendor considers the urgency of this vulnerability as unimportant, but it still poses a risk if exploited by a privileged user.

Related vulnerabilities

Recent vulnerabilities recorded for numpy.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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