CVE-2021-32559: Pywin32 Integer Overflow Vulnerability
HIGHCVE-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
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).
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.
pip install pywin32>=301
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
CVE-2021-32559 Affected Pywin32 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pywin32
|
PyPI |
< 301
|
301
|
References
Frequently Asked Questions
What is CVE-2021-32559?
Which Pywin32 versions are affected?
What version fixes CVE-2021-32559?
Is pywin32 affected?
What is the CVSS score of CVE-2021-32559?
What CWE is associated with CVE-2021-32559?
How can I check PyPI dependencies for CVE-2021-32559?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}