CVE-2021-29605: TFLite: integer overflow DoS via crafted model file
MEDIUM PoC AVAILABLEPatch TensorFlow Lite to 2.5.0 or apply available backports (2.4.2/2.3.3/2.2.3/2.1.4) immediately if you run any TFLite-based inference—mobile, edge, or server-side. An attacker who can deliver a crafted model file can crash your inference runtime on demand. Impact is pure availability disruption; no RCE or data exfiltration risk, but sustained DoS is trivially achievable post-delivery.
Risk Assessment
Medium risk overall. The local attack vector and requirement to control the loaded model file limit opportunistic exploitation. However, organizations loading TFLite models from external sources, model registries, or allowing user-supplied models face elevated risk. Low attack complexity means any adversary achieving model file delivery can reliably trigger the crash. Not in CISA KEV; no active exploitation reported as of advisory date. Severity increases significantly in high-availability inference services where uptime is business-critical.
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 TF 2.5.0 or cherry-pick backports to 2.4.2, 2.3.3, 2.2.3, or 2.1.4.
-
Model integrity: enforce cryptographic signatures or hashes on all TFLite model files before loading—reject unsigned or unverified models.
-
Input validation: sanitize model files from untrusted or external sources before passing to the TFLite runtime.
-
Process isolation: run TFLite inference in a sandboxed process to contain crashes and limit blast radius.
-
Detection: alert on unexpected inference process crashes or abnormal exit codes in AI serving infrastructure as indicators of attempted exploitation.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29605?
Patch TensorFlow Lite to 2.5.0 or apply available backports (2.4.2/2.3.3/2.2.3/2.1.4) immediately if you run any TFLite-based inference—mobile, edge, or server-side. An attacker who can deliver a crafted model file can crash your inference runtime on demand. Impact is pure availability disruption; no RCE or data exfiltration risk, but sustained DoS is trivially achievable post-delivery.
Is CVE-2021-29605 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29605, increasing the risk of exploitation.
How to fix CVE-2021-29605?
1. Patch: upgrade to TF 2.5.0 or cherry-pick backports to 2.4.2, 2.3.3, 2.2.3, or 2.1.4. 2. Model integrity: enforce cryptographic signatures or hashes on all TFLite model files before loading—reject unsigned or unverified models. 3. Input validation: sanitize model files from untrusted or external sources before passing to the TFLite runtime. 4. Process isolation: run TFLite inference in a sandboxed process to contain crashes and limit blast radius. 5. Detection: alert on unexpected inference process crashes or abnormal exit codes in AI serving infrastructure as indicators of attempted exploitation.
What systems are affected by CVE-2021-29605?
This vulnerability affects the following AI/ML architecture patterns: model serving, edge AI deployments, mobile AI applications, on-device inference.
What is the CVSS score for CVE-2021-29605?
CVE-2021-29605 has a CVSS v3.1 base score of 5.5 (MEDIUM). The EPSS exploitation probability is 0.01%.
Technical Details
NVD Description
TensorFlow is an end-to-end open source platform for machine learning. The TFLite code for allocating `TFLiteIntArray`s is vulnerable to an integer overflow issue(https://github.com/tensorflow/tensorflow/blob/4ceffae632721e52bf3501b736e4fe9d1221cdfa/tensorflow/lite/c/common.c#L24-L27). An attacker can craft a model such that the `size` multiplier is so large that the return value overflows the `int` datatype and becomes negative. In turn, this results in invalid value being given to `malloc`(https://github.com/tensorflow/tensorflow/blob/4ceffae632721e52bf3501b736e4fe9d1221cdfa/tensorflow/lite/c/common.c#L47-L52). In this case, `ret->size` would dereference an invalid pointer. 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 targeting a TFLite-powered application crafts a malicious .tflite model file where the TFLiteIntArray size parameter is set large enough to overflow an int, producing a negative result. The attacker delivers this via a compromised model update server, a supply chain attack on the model repository, or by directly uploading it to an application accepting user-provided models. When the victim runtime loads the file, malloc receives a negative size, allocates an invalid memory region, and the subsequent ret->size dereference crashes the inference process. In a high-availability AI inference service, repeated delivery achieves sustained denial of service with minimal attacker effort after initial file delivery.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H References
- github.com/tensorflow/tensorflow/commit/7c8cc4ec69cd348e44ad6a2699057ca88faad3e5 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-jf7h-7m85-w2v2 Exploit Patch 3rd Party
- github.com/ARPSyndicate/cvemon Exploit
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