CVE-2017-12852: Numpy Numpy Missing Input Validation Vulnerability

HIGH
Advisory Identifier: GHSA-frgw-fgh6-9g52
CVSS 7.5
CWE-835
Published
Advisory Summary

CVE-2017-12852 is a HIGH (CVSS 7.5) numpy missing input validation vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Numpy libraries in the PyPI ecosystem. The issue involves numpy missing input validation. Remediation is available by upgrading affected packages to version 1.13.3.

CVE-2017-12852 at a Glance

CVE Identifier CVE-2017-12852
GHSA Identifier GHSA-frgw-fgh6-9g52
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Affected Product Numpy
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
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-2017-12852

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.13.3
pip install numpy>=1.13.3
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-2017-12852, 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.13.3), 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-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. 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

The numpy.pad function in Numpy 1.13.1 and older versions is missing input validation. An empty list or ndarray will stick into an infinite loop, which can allow attackers to cause a DoS attack.

CVE-2017-12852 Affected Numpy Versions

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

References

Frequently Asked Questions

What is CVE-2017-12852?
CVE-2017-12852 is a security vulnerability in Numpy involving Numpy missing input validation under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Numpy versions are affected?
Affected versions include releases prior to 1.13.3 across affected packages: numpy.
What version fixes CVE-2017-12852?
Upgrading to 1.13.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is numpy affected?
Yes, numpy is affected in releases prior to 1.13.3. Upgrade your dependency to 1.13.3 or later.
What is the CVSS score of CVE-2017-12852?
CVE-2017-12852 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2017-12852?
CVE-2017-12852 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check PyPI dependencies for CVE-2017-12852?
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-frgw-fgh6-9g52",
  "modified" : "2022-06-17T21:05:33Z",
  "published" : "2022-05-13T01:42:46Z",
  "aliases" : [ "CVE-2017-12852" ],
  "summary" : "Numpy missing input validation",
  "details" : "The numpy.pad function in Numpy 1.13.1 and older versions is missing input validation. An empty list or ndarray will stick into an infinite loop, which can allow attackers to cause a DoS attack.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "numpy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.13.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-12852"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/numpy/numpy/issues/9560#issuecomment-322395292"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/BT123/testcasesForMyRequest/tree/master/CVE-2017-12852"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-frgw-fgh6-9g52"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/numpy/numpy"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/numpy/numpy/releases/tag/v1.13.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/numpy/PYSEC-2017-1.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-17T21:05:33Z",
    "nvd_published_at" : "2017-08-15T16:29:00Z"
  }
}