CVE-2020-36242: Cryptography PyCA Cryptography Symmetrically Encrypting Large Vulnerability

HIGH
Advisory Identifier: GHSA-rhm9-p9w5-fwm7
CVSS 9.1
CWE-190 CWE-787
Published
Advisory Summary

CVE-2020-36242 is a HIGH (CVSS 9.1) pyca cryptography symmetrically encrypting large vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Cryptography libraries in the PyPI ecosystem. The issue involves pyca cryptography symmetrically encrypting large values can lead to integer overflow. Remediation is available by upgrading affected packages to version 3.3.2.

CVE-2020-36242 at a Glance

CVE Identifier CVE-2020-36242
GHSA Identifier GHSA-rhm9-p9w5-fwm7
Severity HIGH
CVSS v3.1 Base Score 9.1
CWE Classification CWE-190: Integer Overflow or Wraparound
Affected Product Cryptography
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/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 High (C:H)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2020-36242

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

cryptography fixed: 3.3.2
pip install cryptography>=3.3.2
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 cryptography

How to Check if You Are Affected

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

pip show cryptography

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

Note: The pip show cryptography 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 Cryptography, 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

cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. When certain sequences of `update()` calls with large values (multiple GBs) for symetric encryption or decryption occur, it's possible for an integer overflow to happen, leading to mishandling of buffers. This is patched in version 3.3.2 and newer.

CVE-2020-36242 Affected Cryptography Versions

1 component(s)
Fixed Versions:
3.3.2
Product / Package Ecosystem Affected Versions Fixed Version
cryptography
PyPI
≥ 3.1
< 3.3.2
3.3.2

References

Frequently Asked Questions

What is CVE-2020-36242?
CVE-2020-36242 is a security vulnerability in Cryptography involving PyCA Cryptography symmetrically encrypting large values can lead to integer overflow under CWE-190: Integer Overflow or Wraparound.
Which Cryptography versions are affected?
Affected versions include releases prior to 3.3.2 across affected packages: cryptography.
What version fixes CVE-2020-36242?
Upgrading to 3.3.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cryptography affected?
Yes, cryptography is affected in releases prior to 3.3.2. Upgrade your dependency to 3.3.2 or later.
What is the CVSS score of CVE-2020-36242?
CVE-2020-36242 has a CVSS v3.1 base score of 9.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H.
What CWE is associated with CVE-2020-36242?
CVE-2020-36242 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-2020-36242?
Run the dependency tree command: 'pip show cryptography'. 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-rhm9-p9w5-fwm7",
  "modified" : "2024-09-13T18:33:13Z",
  "published" : "2021-02-10T01:32:27Z",
  "aliases" : [ "CVE-2020-36242" ],
  "summary" : "PyCA Cryptography symmetrically encrypting large values can lead to integer overflow",
  "details" : "cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. When certain sequences of `update()` calls with large values (multiple GBs) for symetric encryption or decryption occur, it's possible for an integer overflow to happen, leading to mishandling of buffers. This is patched in version 3.3.2 and newer.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "cryptography"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.1"
      }, {
        "fixed" : "3.3.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pyca/cryptography/security/advisories/GHSA-rhm9-p9w5-fwm7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-36242"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pyca/cryptography/issues/5615"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pyca/cryptography/commit/82b6ce28389f0a317bc55ba2091a74b346db7cae"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-rhm9-p9w5-fwm7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pyca/cryptography"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pyca/cryptography/compare/3.3.1...3.3.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2021-63.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/L7RGQLK4J5ZQFRLKCHVVG6BKZTUQMG7E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/L7RGQLK4J5ZQFRLKCHVVG6BKZTUQMG7E"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-190", "CWE-787" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-02-10T01:31:02Z",
    "nvd_published_at" : "2021-02-07T20:15:00Z"
  }
}