Skip to content

GHSA-5545-2q6w-2gh6 CVE-2021-41495 PYSEC-2021-856

NumPy NULL Pointer Dereference

High PyPI
Severity
7.5 / 10
High · CVSS 3.1
Exploit chance (EPSS)
1.24%
Chance of exploitation in the next 30 days. Higher than 69.19% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-476 NULL Pointer Dereference
Fix
1.19
Upgrade numpy to this version or later

Description

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 creating sort arrays.

Affected versions

PyPI

PackageVulnerableFixed in
numpy
< 1.19
1.19
numpy
< 1.19.1
1.19.1

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

numpy PyPI → 1.19

pip
pip install --upgrade "numpy>=1.19"
poetry
poetry add "numpy>=1.19"
uv
uv add "numpy>=1.19"

Severity breakdown

CVSS 3.1 7.5

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Weakness

CWE-476: NULL Pointer Dereference

The product dereferences a pointer that it expects to be valid but is NULL.

How to prevent it
  • Implementation: For any pointers that could have been modified or provided from a function that can return NULL, check the pointer for NULL before use. When working with a multithreaded or otherwise asynchronous environment, ensure that proper locking APIs are used to lock before the check, and unlock when it has finished [REF-1484].
  • Requirements: Select a programming language that is not susceptible to these issues.
  • Implementation: Check the results of all functions that return a value and verify that the value is non-null before acting upon it.
  • Architecture and Design: Identify all variables and data stores that receive information from external sources, and apply input validation to make sure that they are only initialized to expected values.
  • Implementation: Explicitly initialize all variables and other data stores, either during declaration or just before the first usage.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-f7c7-j99h-c22f
Buffer Copy without Checking Size of Input in NumPy
Medium Also affects numpy
GHSA-fpfv-jqm9-f5jm
Incorrect Comparison in NumPy
Medium Also affects numpy
GHSA-6p56-wp2h-9hxr
NumPy Buffer Overflow (Disputed)
Medium Also affects numpy
GHSA-9fq2-x9r6-wfmf
Numpy Deserialization of Untrusted Data
Critical Also affects numpy
GHSA-cw6w-4rcx-xphc
Arbitrary file write in NumPy
Medium Also affects numpy
GHSA-2fc2-6r4j-p65h
Numpy arbitrary file write via symlink attack
Medium Also affects numpy
GHSA-frgw-fgh6-9g52
Numpy missing input validation
High Also affects numpy
GHSA-525v-9gp9-w22h
Forge: TLS client crash when the server sends no certificate
Medium Same weakness, CWE-476
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor