CVE-2021-32559: Pywin32 Integer Overflow Vulnerability

HIGH
Advisory Identifier: GHSA-hwfp-hg2m-9vr2
CVSS 6.5
CWE-190
Published
Advisory Summary

CVE-2021-32559 is a HIGH (CVSS 6.5) integer overflow vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Pywin32 libraries in the PyPI ecosystem. The issue involves integer overflow in pywin32. Remediation is available by upgrading affected packages to version 301.

CVE-2021-32559 at a Glance

CVE Identifier CVE-2021-32559
GHSA Identifier GHSA-hwfp-hg2m-9vr2
Severity HIGH
CVSS v3.1 Base Score 6.5
CWE Classification CWE-190: Integer Overflow or Wraparound
Affected Product Pywin32
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.5

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
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-32559

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

pywin32 fixed: 301
pip install pywin32>=301
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 pywin32

How to Check if You Are Affected

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

pip show pywin32

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In Pywin32, 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

An integer overflow exists in pywin32 prior to version b301 when adding an access control entry (ACE) to an access control list (ACL) that would cause the size to be greater than 65535 bytes. An attacker who successfully exploited this vulnerability could crash the vulnerable process.

CVE-2021-32559 Affected Pywin32 Versions

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

References

Frequently Asked Questions

What is CVE-2021-32559?
CVE-2021-32559 is a security vulnerability in Pywin32 involving Integer overflow in pywin32 under CWE-190: Integer Overflow or Wraparound.
Which Pywin32 versions are affected?
Affected versions include releases prior to 301 across affected packages: pywin32.
What version fixes CVE-2021-32559?
Upgrading to 301 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pywin32 affected?
Yes, pywin32 is affected in releases prior to 301. Upgrade your dependency to 301 or later.
What is the CVSS score of CVE-2021-32559?
CVE-2021-32559 has a CVSS v3.1 base score of 6.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-32559?
CVE-2021-32559 is classified under CWE-190: Integer Overflow or Wraparound (The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.).
How can I check PyPI dependencies for CVE-2021-32559?
Run the dependency tree command: 'pip show pywin32'. 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-hwfp-hg2m-9vr2",
  "modified" : "2025-03-27T17:43:16Z",
  "published" : "2021-08-09T20:43:44Z",
  "aliases" : [ "CVE-2021-32559" ],
  "summary" : "Integer overflow in pywin32",
  "details" : "An integer overflow exists in pywin32 prior to version b301 when adding an access control entry (ACE) to an access control list (ACL) that would cause the size to be greater than 65535 bytes. An attacker who successfully exploited this vulnerability could crash the vulnerable process.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pywin32"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "301"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32559"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mhammond/pywin32/issues/1700"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mhammond/pywin32/pull/1701"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-hwfp-hg2m-9vr2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fireeye/Vulnerability-Disclosures/blob/master/FEYE-2021-0017/FEYE-2021-0017.md"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mhammond/pywin32"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mhammond/pywin32/releases"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pywin32/PYSEC-2021-112.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-190" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-07-07T16:45:27Z",
    "nvd_published_at" : "2021-07-06T12:15:00Z"
  }
}