CVE-2021-37637

7.7 HIGH

📋 TL;DR

This vulnerability in TensorFlow allows attackers to trigger a null pointer dereference by passing invalid input to the tf.raw_ops.CompressElement function. This can cause denial of service (crash) or potentially allow arbitrary code execution. All users running affected TensorFlow versions are at risk.

💻 Affected Systems

Products:
  • TensorFlow
Versions: TensorFlow 2.3.0 to 2.3.3, 2.4.0 to 2.4.2, 2.5.0, and 2.6.0-rc versions
Operating Systems: All operating systems running TensorFlow
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects code that uses tf.raw_ops.CompressElement directly or indirectly through compression utilities.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise if combined with other vulnerabilities or memory corruption techniques.

🟠

Likely Case

Denial of service through application crash or instability in TensorFlow-based services.

🟢

If Mitigated

Application crash with limited impact if running in isolated containers with proper resource limits.

🌐 Internet-Facing: MEDIUM - Requires specific API access to tf.raw_ops.CompressElement, but many ML services expose TensorFlow functionality.
🏢 Internal Only: MEDIUM - Internal ML pipelines using affected TensorFlow versions could be disrupted.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: LOW - Requires crafting specific invalid input to the vulnerable function.

Exploitation requires access to TensorFlow API endpoints that use the vulnerable compression functionality.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: TensorFlow 2.6.0, 2.5.1, 2.4.3, and 2.3.4

Vendor Advisory: https://github.com/tensorflow/tensorflow/security/advisories/GHSA-c9qf-r67m-p7cg

Restart Required: Yes

Instructions:

1. Update TensorFlow using pip: pip install --upgrade tensorflow==2.6.0 (or appropriate patched version). 2. Restart all services using TensorFlow. 3. Verify the fix by checking TensorFlow version.

🔧 Temporary Workarounds

Input validation wrapper

all

Add input validation before calling tf.raw_ops.CompressElement to ensure valid buffer inputs.

# Python code to wrap vulnerable function
import tensorflow as tf

def safe_compress_element(input_data):
    if input_data is None:
        raise ValueError('Input cannot be None')
    # Add additional validation as needed
    return tf.raw_ops.CompressElement(input_data)

🧯 If You Can't Patch

  • Disable or restrict access to TensorFlow APIs that use tf.raw_ops.CompressElement functionality.
  • Run TensorFlow in isolated containers with strict resource limits to contain potential crashes.

🔍 How to Verify

Check if Vulnerable:

Check TensorFlow version: python -c 'import tensorflow as tf; print(tf.__version__)' and compare with affected versions.

Check Version:

python -c 'import tensorflow as tf; print(tf.__version__)'

Verify Fix Applied:

Verify TensorFlow version is 2.6.0, 2.5.1, 2.4.3, 2.3.4 or later, and test compression functionality with edge cases.

📡 Detection & Monitoring

Log Indicators:

  • Segmentation fault or crash logs from TensorFlow processes
  • Error messages mentioning CompressElement or compression_utils.cc

Network Indicators:

  • Unusual requests to TensorFlow API endpoints with malformed compression data

SIEM Query:

source='tensorflow.log' AND ("segmentation fault" OR "null pointer" OR "CompressElement")

🔗 References

📤 Share & Export