CVE-2021-29605
📋 TL;DR
This CVE describes an integer overflow vulnerability in TensorFlow's TFLite component. An attacker can craft a malicious machine learning model that causes memory allocation to fail, potentially leading to denial of service or arbitrary code execution. All TensorFlow users running TFLite inference with untrusted models are affected.
💻 Affected Systems
- TensorFlow
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution through heap corruption, allowing an attacker to take control of the TensorFlow process.
Likely Case
Denial of service through application crash when processing malicious models.
If Mitigated
Limited impact if models are from trusted sources and proper input validation is in place.
🎯 Exploit Status
Exploitation requires crafting a malicious TFLite model file. No public exploits have been released.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: TensorFlow 2.5.0, 2.4.2, 2.3.3, 2.2.3, 2.1.4
Vendor Advisory: https://github.com/tensorflow/tensorflow/security/advisories/GHSA-jf7h-7m85-w2v2
Restart Required: Yes
Instructions:
1. Identify your TensorFlow version. 2. Upgrade to patched version: pip install tensorflow==2.5.0 (or appropriate version). 3. Restart all TensorFlow services and applications.
🔧 Temporary Workarounds
Model Validation
allImplement strict validation of TFLite model files before processing
Sandbox Execution
linuxRun TensorFlow inference in isolated containers with limited privileges
docker run --read-only --cap-drop=ALL tensorflow-container
🧯 If You Can't Patch
- Restrict TFLite model sources to trusted repositories only
- Implement network segmentation to isolate TensorFlow services from critical systems
🔍 How to Verify
Check if Vulnerable:
Check TensorFlow version: python -c 'import tensorflow as tf; print(tf.__version__)'
Check Version:
python -c 'import tensorflow as tf; print(tf.__version__)'
Verify Fix Applied:
Verify version is 2.5.0 or patched backport (2.4.2, 2.3.3, 2.2.3, 2.1.4)
📡 Detection & Monitoring
Log Indicators:
- TensorFlow process crashes
- Memory allocation failures in TFLite
- Invalid pointer dereference errors
Network Indicators:
- Unexpected TFLite model uploads to inference endpoints
- Abnormal model file sizes
SIEM Query:
source="tensorflow" AND (event="crash" OR event="segfault")
🔗 References
- https://github.com/tensorflow/tensorflow/commit/7c8cc4ec69cd348e44ad6a2699057ca88faad3e5
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-jf7h-7m85-w2v2
- https://github.com/tensorflow/tensorflow/commit/7c8cc4ec69cd348e44ad6a2699057ca88faad3e5
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-jf7h-7m85-w2v2