# CVE-2020-36242: PyCA Cryptography symmetrically encrypting large values can lead to integer overflow

> Integer overflow in Python cryptography library allows buffer overflow during symmetric encryption, potentially leading to code execution or denial of service.

- **Severity:** Critical 9.1 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 7 Feb 2021
- **Updated:** 4 Aug 2024
- **Also known as:** ALPINE-CVE-2020-36242, DEBIAN-CVE-2020-36242, GHSA-rhm9-p9w5-fwm7, MGASA-2021-0129, OESA-2021-1089, PYSEC-2021-63, SUSE-RU-2022:4567-1, SUSE-SU-2021:0594-1, SUSE-SU-2021:0668-1, SUSE-SU-2021:0669-1, SUSE-SU-2021:0675-1, SUSE-SU-2021:0696-1, SUSE-SU-2023:1838-1, openSUSE-SU-2021:0349-1

## What is CVE-2020-36242?

CVE-2020-36242 is a critical vulnerability in Fedoraproject Fedora, published on 7 Feb 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In the cryptography package before 3.3.2 for Python, certain sequences of update calls to symmetrically encrypt multi-GB values could result in an integer overflow and buffer overflow, as demonstrated by the Fernet class.

Weakness: CWE-787 (Out-of-bounds Write), CWE-190 (Integer Overflow or Wraparound)

## Which versions are affected by CVE-2020-36242?

3 open source packages ship an affected version, including cryptography. It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `cryptography` | PyPI | From 3.1 | 3.3.2 |
| `cryptography` | PyPI | From 3.1 | 3.3.2 |
| `cryptography` | PyPI | From 3.1 | 3.3.2 |
| `python-bcrypt` | SUSE:Enterprise Storage 6 | All versions | 3.1.4-150100.6.2.1 |
| `python-cffi` | SUSE:Enterprise Storage 6 | All versions | 1.15.0-150000.4.11.2 |
| `python-cryptography` | SUSE:Enterprise Storage 6 | All versions | 2.1.4-4.9.2 |
| `python-cryptography` | SUSE:Enterprise Storage 6 | All versions | 2.9.2-150100.7.8.2 |
| `python-cryptography` | SUSE:HPE Helion OpenStack 8 | All versions | 2.0.3-3.10.1 |
| `python-cryptography` | SUSE:HPE Helion OpenStack 8 | All versions | 2.1.4-7.34.1 |
| `python-cryptography` | SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS | All versions | 2.1.4-4.9.2 |
| `python-bcrypt` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 3.1.4-150100.6.2.1 |
| `python-cffi` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 1.15.0-150000.4.11.2 |
| `python-cryptography` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 2.1.4-4.9.2 |
| `python-cryptography` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 2.9.2-150100.7.8.2 |
| `python-cryptography` | SUSE:Linux Enterprise High Performance Computing 15-ESPOS | All versions | 2.1.4-4.9.2 |
| `python-cryptography` | SUSE:Linux Enterprise High Performance Computing 15-LTSS | All versions | 2.1.4-4.9.2 |
| `python-cryptography` | SUSE:Linux Enterprise Module for Basesystem 15 SP2 | All versions | 2.8-3.6.1 |
| `python-aliyun-python-sdk` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.0-150100.3.7.4 |
| `python-aliyun-python-sdk-aas` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 2.1.1-150100.3.5.5 |
| `python-aliyun-python-sdk-acm` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.1-150100.3.7.5 |
| `python-aliyun-python-sdk-acms-open` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.0-150100.3.7.5 |
| `python-aliyun-python-sdk-actiontrail` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 2.0.3-150100.3.7.5 |
| `python-aliyun-python-sdk-adb` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.5-150100.3.7.5 |
| `python-aliyun-python-sdk-address-purification` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.0-150100.3.7.5 |
| `python-aliyun-python-sdk-aegis` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.6-150100.3.7.5 |
| `python-aliyun-python-sdk-afs` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.1-150100.3.7.5 |
| `python-aliyun-python-sdk-airec` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 2.0.0-150100.3.7.5 |
| `python-aliyun-python-sdk-alidns` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 2.6.20-150100.3.7.5 |
| `python-aliyun-python-sdk-aligreen-console` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.3-150100.3.7.5 |
| `python-aliyun-python-sdk-alimt` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 3.0.30-150100.3.7.5 |
| `python-aliyun-python-sdk-alinlp` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.16-150100.3.7.5 |
| `python-aliyun-python-sdk-aliyuncvc` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.10.2-150100.3.7.5 |
| `python-aliyun-python-sdk-amqp-open` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.1.1-150100.3.5.5 |
| `python-aliyun-python-sdk-appmallsservice` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.1.1-150100.3.7.5 |
| `python-aliyun-python-sdk-arms` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 2.5.22-150100.3.7.5 |
| `python-aliyun-python-sdk-arms4finance` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 2.0.2-150100.3.7.5 |
| `python-aliyun-python-sdk-baas` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.1-150100.3.7.5 |
| `python-aliyun-python-sdk-brinekingdom` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.0.1-150100.3.7.5 |
| `python-aliyun-python-sdk-bss` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 0.0.4-150100.3.7.5 |
| `python-aliyun-python-sdk-bssopenapi` | SUSE:Linux Enterprise Module for Public Cloud 15 SP1 | All versions | 1.6.2-150100.3.7.5 |

Products: Cryptography.io Cryptography, Fedoraproject Fedora, Oracle Communications Cloud Native Core Network Function Cloud Native Environment.

## How do I fix CVE-2020-36242?

Upgrade cryptography to 3.3.2 or later.

## Is CVE-2020-36242 being exploited?

There is no known exploitation of CVE-2020-36242 in the wild and no public exploit code.

## Other vulnerabilities in Fedoraproject Fedora

- [CVE-2026-26007](https://insights.sbomify.com/CVE-2026-26007/): cryptography Subgroup Attack Due to Missing Subgroup Validation for SECT Curves (high 8.2)
- [CVE-2024-26130](https://insights.sbomify.com/CVE-2024-26130/): cryptography NULL pointer dereference with pkcs12.serialize_key_and_certificates when called with a non-matching certificate and private key and an hmac_hash override (high 7.5)
- [CVE-2023-38325](https://insights.sbomify.com/CVE-2023-38325/): cryptography mishandles SSH certificates (high 7.5)
- [CVE-2026-39892](https://insights.sbomify.com/CVE-2026-39892/): cryptography has a buffer overflow if non-contiguous buffers were passed to APIs (medium 6.9)
- [CVE-2023-49083](https://insights.sbomify.com/CVE-2023-49083/): cryptography vulnerable to NULL-dereference when loading PKCS7 certificates (medium 5.9)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2020-36242 and fix it if it is affected.

What it is: CVE-2020-36242 is a critical vulnerability in Fedoraproject Fedora, published on 7 Feb 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2020-36242 in the wild and no public exploit code.

Affected packages and fixed versions:
- cryptography (PyPI): affected from 3.1; fixed in 3.3.2
- cryptography (PyPI): affected from 3.1; fixed in 3.3.2
- cryptography (PyPI): affected from 3.1; fixed in 3.3.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2020-36242/ (Markdown: https://insights.sbomify.com/CVE-2020-36242/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2020-36242
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2020-36242
- OSV: https://osv.dev/vulnerability/CVE-2020-36242

---
From sbomify Insights: https://insights.sbomify.com/CVE-2020-36242/
Summaries are generated and may contain mistakes; the official description above is the record.
