CVE-2021-37662
📋 TL;DR
This CVE allows attackers to cause undefined behavior in TensorFlow's boosted trees operations by triggering null pointer dereferences. Attackers can exploit missing input validation in BoostedTreesCalculateBestGainsPerFeature and BoostedTreesCalculateBestFeatureSplitV2 functions. Anyone using affected TensorFlow versions for machine learning tasks is potentially vulnerable.
💻 Affected Systems
- TensorFlow
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution leading to complete system compromise, data exfiltration, or denial of service.
Likely Case
Application crashes, denial of service, or memory corruption leading to instability.
If Mitigated
Minimal impact if proper input validation and sandboxing are implemented.
🎯 Exploit Status
Exploitation requires crafting specific inputs to the vulnerable functions. No public exploits have been documented.
🛠️ 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-f5cx-5wr3-5qrc
Restart Required: Yes
Instructions:
1. Update TensorFlow to patched version: pip install --upgrade tensorflow==2.6.0 (or appropriate version). 2. Restart all services using TensorFlow. 3. Verify the update with: python -c 'import tensorflow as tf; print(tf.__version__)'
🔧 Temporary Workarounds
Disable boosted trees operations
allAvoid using BoostedTreesCalculateBestGainsPerFeature and BoostedTreesCalculateBestFeatureSplitV2 functions
Input validation wrapper
allImplement custom input validation for boosted trees function calls
🧯 If You Can't Patch
- Implement strict input validation and sanitization for all TensorFlow inputs
- Isolate TensorFlow workloads in containers with minimal privileges
🔍 How to Verify
Check if Vulnerable:
Check TensorFlow version: python -c 'import tensorflow as tf; print(tf.__version__)' - if version is between 2.3.0 and 2.5.0 (excluding patched versions), you are vulnerable.
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: python -c 'import tensorflow as tf; print(tf.__version__)'
📡 Detection & Monitoring
Log Indicators:
- Segmentation faults in TensorFlow processes
- Unexpected crashes in ML inference services
- Memory access violation errors
Network Indicators:
- Unusual patterns of requests to ML endpoints using boosted trees
SIEM Query:
process_name:"python" AND (event_type:"segmentation_fault" OR error_message:"null pointer") AND process_command_line:"tensorflow"
🔗 References
- https://github.com/tensorflow/tensorflow/commit/429f009d2b2c09028647dd4bb7b3f6f414bbaad7
- https://github.com/tensorflow/tensorflow/commit/9c87c32c710d0b5b53dc6fd3bfde4046e1f7a5ad
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-f5cx-5wr3-5qrc
- https://github.com/tensorflow/tensorflow/commit/429f009d2b2c09028647dd4bb7b3f6f414bbaad7
- https://github.com/tensorflow/tensorflow/commit/9c87c32c710d0b5b53dc6fd3bfde4046e1f7a5ad
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-f5cx-5wr3-5qrc