CVE-2021-41495: NumPy NULL Pointer Dereference
Summary
CVE-2021-41495: NumPy NULL Pointer Dereference. Affects numpy versions < 1.19. Fixed in 1.19. How to fix ↓
Also tracked for
- numpy · Debian:11
The same CVE-2021-41495 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
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.
No signup required · Results in about 60 seconds
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 in question affects versions of NumPy up to 1.18.5. NumPy's sort function, specifically the PyArray_DescrNew function, is susceptible to a Null Pointer Dereference vulnerability. This vulnerability arises due to missing return-value validation, allowing attackers to exploit it for Denial of Service (DoS) attacks by repeatedly creating sort arrays.
Vulnerability Detail
The Null Pointer Dereference vulnerability in NumPy's sort function can be exploited by attackers to cause a DoS condition. By repeatedly creating sort arrays, an attacker can trigger a null pointer dereference, leading to a crash or unresponsive behavior of the affected application. This vulnerability has a CVSS score of 7.5, indicating a high severity level. The CWE-476 category is associated with this vulnerability.
How To Fix
Latest published version: 2.5.4 as of 23 Oct 2026
pip install --upgrade "numpy==2.5.4"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
1.19
This is the first release that contains the fix.
pip install --upgrade "numpy==1.19"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a workaround, users can avoid using the sort function in NumPy until the package is updated to a fixed version. Alternatively, they can implement input validation and error handling in their own code to mitigate the risk of null pointer dereference.
Conclusion
The NumPy library is vulnerable to a Null Pointer Dereference in its sort function, which can be exploited for DoS attacks. Users are advised to update their NumPy package to version 1.19 or above to mitigate this vulnerability. Alternatively, they can avoid using the sort function or implement input validation and error handling in their own code. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for numpy →
FAQ
NumPy is a Python library for numerical computing, providing support for large, multi-dimensional arrays and matrices.
A Null Pointer Dereference vulnerability occurs when a program attempts to access or dereference a null pointer, leading to unexpected behavior or crashes.
The vulnerability allows attackers to conduct DoS attacks by repetitively creating sort arrays, leading to unresponsive behavior or crashes of the affected application.
This vulnerability has a CVSS score of 7.5, indicating a high severity level.
To fix this vulnerability, update the NumPy package to version 1.19 or above using the command 'pip install --upgrade numpy'.
Related vulnerabilities
Recent vulnerabilities recorded for numpy.