Null Pointer Dereference vulnerability in numpy.sort in NumPy

numpy Updated 02 Oct 2025

Summary

17/12/2021
N/A
No i
Medium
5.3

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 < 92ebe1e9a6aeb47a881a1226b08218175776f9ea. 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 Your last release was probably never penetration tested 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 popular library for numerical computing in Python. It provides support for large, multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays. The vulnerability affects the numpy.sort function in NumPy versions prior to 1.19. It is caused by missing return-value validation in the PyArray_DescrNew function, leading to a null pointer dereference. This vulnerability can be exploited to conduct denial-of-service (DoS) attacks by repeatedly creating sort arrays.

Vulnerability Detail

The vulnerability, identified as CVE-2021-41495, arises due to the absence of return-value validation in the PyArray_DescrNew function. While the missing validation is a concern, it is important to note that an error can only occur if the user exhausts memory. Therefore, the user would already need to have privileged access to exploit this vulnerability. Additionally, constructing an attack specifically targeting the memory exhaustion at this particular point 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 this vulnerability requires memory exhaustion to be exploited, implementing a workaround may not be necessary. However, to mitigate the risk, it is advisable to ensure that the system has sufficient memory resources available to prevent potential DoS attacks.

Conclusion

In conclusion, the null pointer dereference vulnerability in numpy.sort in NumPy versions prior to 1.19 can be mitigated by updating the affected package and ensuring sufficient memory resources. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for numpy →

Share this vulnerability

FAQ

NumPy is a Python library used for numerical computing, providing support for large, multi-dimensional arrays and matrices.

The vulnerable function is numpy.sort, which is used for sorting arrays in NumPy.

A null pointer dereference vulnerability occurs when a program attempts to access or dereference a null pointer, leading to a crash or unexpected behavior.

The vulnerability can be exploited to conduct denial-of-service (DoS) attacks by repeatedly creating sort arrays, potentially causing the system to become unresponsive.

Updating the affected NumPy package to version 1.19 or higher will fix the vulnerability. It is also recommended to ensure sufficient memory resources are available to mitigate the risk of DoS attacks.

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