CVE-2020-36242

9.1 CRITICAL

📋 TL;DR

This vulnerability in Python's cryptography package allows integer overflow and buffer overflow when encrypting multi-gigabyte values using symmetric encryption like Fernet. Attackers could potentially execute arbitrary code or cause denial of service. Affects Python applications using cryptography package for symmetric encryption of large data.

💻 Affected Systems

Products:
  • Python cryptography package
Versions: All versions before 3.3.2
Operating Systems: All operating systems running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects symmetric encryption operations (like Fernet) when processing multi-GB values through specific update call sequences.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or ransomware deployment.

🟠

Likely Case

Denial of service through application crashes or memory corruption, potentially exposing sensitive data.

🟢

If Mitigated

Limited impact if encryption is restricted to smaller data sizes or proper input validation is implemented.

🌐 Internet-Facing: HIGH - Web applications processing large encrypted uploads or API payloads are directly exposed.
🏢 Internal Only: MEDIUM - Internal systems processing large encrypted data batches remain vulnerable but with reduced attack surface.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires specific sequences of update calls with multi-GB data, making automated exploitation possible but requiring understanding of the encryption flow.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 3.3.2 and later

Vendor Advisory: https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst

Restart Required: Yes

Instructions:

1. Update cryptography package: pip install --upgrade cryptography>=3.3.2
2. Restart all Python applications/services using the package
3. Verify no dependencies pin older vulnerable versions

🔧 Temporary Workarounds

Limit encryption data size

all

Implement input validation to reject encryption requests exceeding safe size limits (e.g., < 1GB).

# Python code example: if data_size > 1073741824: raise ValueError('Data too large for encryption')

🧯 If You Can't Patch

  • Implement strict input validation to prevent multi-GB encryption operations
  • Isolate vulnerable applications in network segments with limited access

🔍 How to Verify

Check if Vulnerable:

Check cryptography version: python -c "import cryptography; print(cryptography.__version__)" and compare to 3.3.2

Check Version:

python -c "import cryptography; print('cryptography version:', cryptography.__version__)"

Verify Fix Applied:

Confirm version is 3.3.2 or higher and test encryption with large data samples

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with memory corruption errors
  • Unusually large encryption requests in application logs

Network Indicators:

  • Large encrypted payloads to encryption endpoints
  • Repeated failed encryption attempts with varying sizes

SIEM Query:

source=application_logs ("cryptography" AND ("overflow" OR "segmentation fault" OR "memory error")) OR ("encrypt" AND size>1000000000)

🔗 References

📤 Share & Export