CVE-2021-29588: TensorFlow Lite: DoS/RCE via crafted model stride=0
HIGH PoC AVAILABLEAny system loading untrusted TFLite models (edge devices, mobile apps, on-device inference pipelines) is exposed to a crafted model that triggers a division-by-zero in the TransposeConv operator, potentially leading to crash or code execution. Patch to TF 2.5.0 / 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4 immediately and enforce model provenance controls—only load models from trusted, integrity-verified sources. This is a supply-chain-style attack surface: the malicious payload is the model file, not network traffic.
Risk Assessment
CVSS 7.8 High with local attack vector and low complexity. Despite the local vector, risk is elevated in any architecture that ingests externally-sourced TFLite models—mobile apps accepting user uploads, model marketplaces, or CI/CD pipelines that pull models from third-party registries. The C:H/I:H/A:H CVSS scores indicate potential beyond pure DoS; memory corruption enabling code execution cannot be ruled out. Not in CISA KEV and no public exploitation confirmed, but the low attack complexity makes weaponization trivial for anyone with TFLite knowledge.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| tensorflow | pip | — | No patch |
Do you use tensorflow? You're affected.
Severity & Risk
Attack Surface
Recommended Action
5 steps-
Patch: Upgrade to TensorFlow 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4.
-
Model provenance: Enforce cryptographic signing and integrity verification for all TFLite model files before loading—reject unsigned or unverified models.
-
Input validation: If running unpatched versions, add pre-load validation that checks stride_{h,w} values in TransposeConv layers are non-zero.
-
Sandboxing: Run TFLite inference in an isolated process or container to contain crash impact.
-
Detection: Alert on inference process crashes or abnormal exits—these may indicate exploitation attempts against this or similar vulnerabilities.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29588?
Any system loading untrusted TFLite models (edge devices, mobile apps, on-device inference pipelines) is exposed to a crafted model that triggers a division-by-zero in the TransposeConv operator, potentially leading to crash or code execution. Patch to TF 2.5.0 / 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4 immediately and enforce model provenance controls—only load models from trusted, integrity-verified sources. This is a supply-chain-style attack surface: the malicious payload is the model file, not network traffic.
Is CVE-2021-29588 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29588, increasing the risk of exploitation.
How to fix CVE-2021-29588?
1. Patch: Upgrade to TensorFlow 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4. 2. Model provenance: Enforce cryptographic signing and integrity verification for all TFLite model files before loading—reject unsigned or unverified models. 3. Input validation: If running unpatched versions, add pre-load validation that checks stride_{h,w} values in TransposeConv layers are non-zero. 4. Sandboxing: Run TFLite inference in an isolated process or container to contain crash impact. 5. Detection: Alert on inference process crashes or abnormal exits—these may indicate exploitation attempts against this or similar vulnerabilities.
What systems are affected by CVE-2021-29588?
This vulnerability affects the following AI/ML architecture patterns: On-device / edge inference, Mobile ML pipelines, TFLite model serving, Computer vision inference pipelines, Embedded ML systems.
What is the CVSS score for CVE-2021-29588?
CVE-2021-29588 has a CVSS v3.1 base score of 7.8 (HIGH). The EPSS exploitation probability is 0.01%.
Technical Details
NVD Description
TensorFlow is an end-to-end open source platform for machine learning. The optimized implementation of the `TransposeConv` TFLite operator is [vulnerable to a division by zero error](https://github.com/tensorflow/tensorflow/blob/0d45ea1ca641b21b73bcf9c00e0179cda284e7e7/tensorflow/lite/kernels/internal/optimized/optimized_ops.h#L5221-L5222). An attacker can craft a model such that `stride_{h,w}` values are 0. Code calling this function must validate these arguments. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
Exploitation Scenario
An adversary targets an organization's mobile app or edge ML system that performs on-device image processing using TFLite. They craft a malicious TFLite model file with TransposeConv stride values set to 0 and introduce it via a compromised model registry, a poisoned open-source model repository, or a man-in-the-middle attack on an unencrypted model update channel. When the app loads and runs inference with the crafted model, the division-by-zero triggers a crash (DoS) or, depending on compiler behavior and memory layout, potentially allows controlled memory corruption leading to arbitrary code execution on the device.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H References
- github.com/tensorflow/tensorflow/commit/801c1c6be5324219689c98e1bd3e0ca365ee834d Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-vfr4-x8j2-3rf9 Exploit Patch 3rd Party
Timeline
Related Vulnerabilities
CVE-2020-15196 9.9 TensorFlow: heap OOB read in sparse/ragged count ops
Same package: tensorflow CVE-2020-15205 9.8 TensorFlow: heap overflow in StringNGrams, ASLR bypass
Same package: tensorflow CVE-2020-15208 9.8 TFLite: OOB read/write via tensor dimension mismatch
Same package: tensorflow CVE-2019-16778 9.8 TensorFlow: heap overflow in UnsortedSegmentSum op
Same package: tensorflow CVE-2022-23587 9.8 TensorFlow: integer overflow in Grappler enables RCE
Same package: tensorflow
AI Threat Alert