CVE-2021-33430: Numpy NumPy Buffer Overflow (Disputed) Vulnerability

MODERATE
Advisory Identifier: GHSA-6p56-wp2h-9hxr
CVSS 5.3
CWE-120
Published
Advisory Summary

CVE-2021-33430 is a MODERATE (CVSS 5.3) numpy buffer overflow (disputed) vulnerability (CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')) affecting Numpy libraries in the PyPI ecosystem. The issue involves numpy buffer overflow (disputed). Remediation is available by upgrading affected packages to version 1.21.

CVE-2021-33430 at a Glance

CVE Identifier CVE-2021-33430
GHSA Identifier GHSA-6p56-wp2h-9hxr
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')
Affected Product Numpy
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2021-33430

To remediate this vulnerability, upgrade all affected Numpy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

numpy fixed: 1.21
pip install numpy>=1.21
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show numpy

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2021-33430, inspect your installed packages using pip:

pip show numpy

Analyze the terminal output to locate any version of Numpy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.21), your application is affected.

Note: The pip show numpy command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow'), where the product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer. In Numpy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

A Buffer Overflow vulnerability exists in NumPy 1.9.x in the PyArray_NewFromDescr_int function of ctors.c when specifying arrays of large dimensions (over 32) from Python code, which could let a malicious user cause a Denial of Service. NOTE: The vendor does not agree this is a vulnerability; In (very limited) circumstances a user may be able provoke the buffer overflow, the user is most likely already privileged to at least provoke denial of service by exhausting memory. Triggering this further requires the use of uncommon API (complicated structured dtypes), which is very unlikely to be available to an unprivileged user.

CVE-2021-33430 Affected Numpy Versions

1 component(s)
Fixed Versions:
1.21
Product / Package Ecosystem Affected Versions Fixed Version
numpy
PyPI
≥ 1.9.0
< 1.21
1.21

References

Frequently Asked Questions

What is CVE-2021-33430?
CVE-2021-33430 is a security vulnerability in Numpy involving NumPy Buffer Overflow (Disputed) under CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow').
Which Numpy versions are affected?
Affected versions include releases prior to 1.21 across affected packages: numpy.
What version fixes CVE-2021-33430?
Upgrading to 1.21 (or the latest patched release for your respective branch) resolves the vulnerability.
Is numpy affected?
Yes, numpy is affected in releases prior to 1.21. Upgrade your dependency to 1.21 or later.
What is the CVSS score of CVE-2021-33430?
CVE-2021-33430 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-33430?
CVE-2021-33430 is classified under CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') (The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer.).
How can I check PyPI dependencies for CVE-2021-33430?
Run the dependency tree command: 'pip show numpy'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-6p56-wp2h-9hxr",
  "modified" : "2024-09-26T14:21:10Z",
  "published" : "2022-01-07T00:09:39Z",
  "aliases" : [ "CVE-2021-33430" ],
  "summary" : "NumPy Buffer Overflow (Disputed)",
  "details" : "A Buffer Overflow vulnerability exists in NumPy 1.9.x in the PyArray_NewFromDescr_int function of ctors.c when specifying arrays of large dimensions (over 32) from Python code, which could let a malicious user cause a Denial of Service.\n\nNOTE: The vendor does not agree this is a vulnerability; In (very limited) circumstances a user may be able provoke the buffer overflow, the user is most likely already privileged to at least provoke denial of service by exhausting memory. Triggering this further requires the use of uncommon API (complicated structured dtypes), which is very unlikely to be available to an unprivileged user.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "numpy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.9.0"
      }, {
        "fixed" : "1.21"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-33430"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/numpy/numpy/issues/18939"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/numpy/numpy/commit/ae317fd9ff3e79c0eac357d723bfc29cbd625f2e"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/numpy/numpy"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/numpy/PYSEC-2021-854.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-120" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-01-04T20:52:47Z",
    "nvd_published_at" : "2021-12-17T19:15:00Z"
  }
}