CVE-2021-37671
📋 TL;DR
This vulnerability in TensorFlow allows attackers to cause undefined behavior by triggering null pointer dereferences in Map* and OrderedMap* operations. Attackers can exploit this by passing empty indices arrays to these operations, potentially leading to crashes or memory corruption. All TensorFlow users running affected versions are at risk.
💻 Affected Systems
- TensorFlow
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution, denial of service, or memory corruption leading to system compromise.
Likely Case
Application crash or denial of service affecting TensorFlow-based services.
If Mitigated
No impact if patched or workarounds applied; otherwise, potential service disruption.
🎯 Exploit Status
Exploitation requires ability to pass malicious input to specific TensorFlow operations; no public exploit code known.
🛠️ 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-qr82-2c78-4m8h
Restart Required: No
Instructions:
1. Update TensorFlow to patched version: pip install --upgrade tensorflow==2.6.0 (or appropriate version). 2. Verify update with: python -c 'import tensorflow as tf; print(tf.__version__)'.
🔧 Temporary Workarounds
Input validation for Map operations
allAdd validation to ensure indices arrays are not empty before passing to Map* or OrderedMap* operations.
🧯 If You Can't Patch
- Implement strict input validation for all TensorFlow Map* and OrderedMap* operations
- Monitor for crashes or abnormal behavior in TensorFlow applications
🔍 How to Verify
Check if Vulnerable:
Check TensorFlow version: python -c 'import tensorflow as tf; print(tf.__version__)' and compare to affected versions.
Check Version:
python -c 'import tensorflow as tf; print(tf.__version__)'
Verify Fix Applied:
After patching, verify version is 2.6.0, 2.5.1, 2.4.3, or 2.3.4, and test Map operations with empty indices to ensure no crashes.
📡 Detection & Monitoring
Log Indicators:
- TensorFlow process crashes
- Segmentation faults in TensorFlow applications
- Error logs mentioning MapStageOp
Network Indicators:
- Unusual API calls to TensorFlow endpoints with empty arrays
SIEM Query:
process_name:tensorflow AND (event_type:crash OR error_message:*MapStageOp*)
🔗 References
- https://github.com/tensorflow/tensorflow/commit/532f5c5a547126c634fefd43bbad1dc6417678ac
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-qr82-2c78-4m8h
- https://github.com/tensorflow/tensorflow/commit/532f5c5a547126c634fefd43bbad1dc6417678ac
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-qr82-2c78-4m8h