CVE-2021-37648
📋 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
- TensorFlow
📦 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.
🎯 Exploit Status
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
allImplement custom input validation for SaveV2 operations to reject malformed inputs before they reach the vulnerable code.
Disable SaveV2 Operations
allIf 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
- https://github.com/tensorflow/tensorflow/commit/9728c60e136912a12d99ca56e106b7cce7af5986
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-wp77-4gmm-7cq8
- https://github.com/tensorflow/tensorflow/commit/9728c60e136912a12d99ca56e106b7cce7af5986
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-wp77-4gmm-7cq8