CVE-2021-37648

7.8 HIGH

📋 TL;DR

This vulnerability in TensorFlow allows attackers to trigger a null pointer dereference in the SaveV2 operation, potentially causing denial of service or memory corruption. It affects TensorFlow users running vulnerable versions who process untrusted input through the affected operation. The issue stems from improper input validation that fails to properly terminate execution when errors are detected.

💻 Affected Systems

Products:
  • TensorFlow
Versions: TensorFlow 2.3.0 to 2.5.0, and potentially earlier versions
Operating Systems: All operating systems running TensorFlow
Default Config Vulnerable: ⚠️ Yes
Notes: Affects all TensorFlow deployments using the vulnerable SaveV2 operation. The vulnerability is present in the core TensorFlow library regardless of deployment configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system crash or arbitrary code execution through memory corruption leading to remote compromise of the TensorFlow service.

🟠

Likely Case

Denial of service through application crash or instability when processing malicious inputs.

🟢

If Mitigated

No impact if proper input validation and error handling are in place or if untrusted inputs are not processed.

🌐 Internet-Facing: MEDIUM - Exploitable if TensorFlow services are exposed to untrusted inputs, but requires specific API calls.
🏢 Internal Only: LOW - Lower risk in controlled environments with trusted data sources, though still present if processing user inputs.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires crafting specific malformed inputs to the SaveV2 operation. No public exploit code has been identified, but the vulnerability details are publicly disclosed.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: TensorFlow 2.6.0, 2.5.1, 2.4.3, 2.3.4

Vendor Advisory: https://github.com/tensorflow/tensorflow/security/advisories/GHSA-wp77-4gmm-7cq8

Restart Required: Yes

Instructions:

1. Identify your TensorFlow version. 2. Upgrade to TensorFlow 2.6.0 or apply the relevant patch version (2.5.1, 2.4.3, or 2.3.4). 3. Restart all TensorFlow services and applications. 4. Verify the fix by checking the version and testing with previously vulnerable inputs.

🔧 Temporary Workarounds

Input Validation Wrapper

all

Implement custom input validation for SaveV2 operations to reject malformed inputs before they reach the vulnerable code.

Disable SaveV2 Operations

all

If not required, disable or restrict access to SaveV2 operations in your TensorFlow deployment.

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all TensorFlow API calls
  • Isolate TensorFlow services in containers or VMs with limited privileges to contain potential exploitation

🔍 How to Verify

Check if Vulnerable:

Check TensorFlow version: if between 2.3.0 and 2.5.0 (inclusive), you are vulnerable unless patched to specific 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, or 2.3.4. Test with sample inputs that previously triggered the vulnerability.

📡 Detection & Monitoring

Log Indicators:

  • Application crashes or segmentation faults in TensorFlow processes
  • Error logs containing 'SaveV2' operation failures
  • Unusual memory access patterns or null pointer exceptions

Network Indicators:

  • Unusual API calls to TensorFlow SaveV2 endpoints
  • Malformed serialized data sent to TensorFlow services

SIEM Query:

source="tensorflow" AND (error="segmentation fault" OR error="null pointer" OR operation="SaveV2")

🔗 References

📤 Share & Export