Null Pointer Dereference Vulnerability in NumPy Package

numpy Updated 02 Oct 2025

Summary

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

DEBIAN-CVE-2021-41495: Null Pointer Dereference vulnerability exists in numpy.sort in NumPy &lt and 1.19 in the PyArray_DescrNew function due to missing return-value validation, which allows attackers to conduct DoS attacks by repetitively cre... 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 Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

NumPy is a widely-used library in Python for numerical computing, providing support for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays. It is a fundamental package for scientific computing in Python, often used in data analysis, machine learning, and engineering applications. The vulnerability in question affects versions of NumPy prior to 1.19, where a null pointer dereference can occur during the sorting process due to insufficient validation of return values.

Vulnerability Detail

The vulnerability, identified as CVE-2021-41495, arises from a null pointer dereference in the numpy.sort function within NumPy versions less than 1.19. This issue is caused by a lack of validation for return values in the PyArray_DescrNew function. Attackers can exploit this vulnerability to conduct Denial of Service (DoS) attacks by repeatedly creating sort arrays, which may lead to memory exhaustion. While the absence of validation is a concern, it is important to note that an error can only occur if the user has the ability to exhaust memory, indicating that they already possess certain privileges. Constructing a targeted attack to exploit this specific memory exhaustion scenario is considered practically impossible.

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 temporary measure, users can avoid creating excessively large sort arrays that may lead to memory exhaustion. Implementing checks in the code to limit the size of arrays being sorted can help prevent triggering the vulnerability.

Conclusion

The null pointer dereference vulnerability in NumPy (CVE-2021-41495) poses a risk of Denial of Service attacks due to insufficient validation in the sorting function. Users are encouraged to update to the latest version of NumPy to mitigate this risk and consider implementing temporary workarounds if an immediate update is not feasible.

See every vulnerability recorded for numpy →

Share this vulnerability

FAQ

CVE-2021-41495 is a vulnerability in NumPy that allows for a null pointer dereference, potentially leading to Denial of Service attacks.

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

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. Check your application against this vulnerability using the Vulert playground at Vulert Scanner.

As a workaround, limit the size of arrays being sorted in your application to prevent triggering the vulnerability.

Using an affected version of NumPy poses a risk, especially in applications that handle large data sets. It is advisable to implement workarounds until an update can be applied.

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