CVE-2021-37685: Heap OOB in TFLite

tensorflow Updated 02 Oct 2025

Summary

25/08/2021
Yes i
Moderate
5.5

CVE-2021-37685: Heap OOB in TFLite. Affects tensorflow across 3 version ranges.

< 2.3.4 >= 2.4.0, < 2.4.3 >= 2.5.0, < 2.5.1

Fixed in 2.3.4, 2.4.3 or 2.5.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-37685 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The TFLite package is an open-source deep learning framework developed by TensorFlow. It provides tools and libraries for running TensorFlow models on mobile, embedded, and IoT devices. TFLite allows developers to deploy machine learning models efficiently on resource-constrained platforms. However, a vulnerability has been discovered in TFLite's expand_dims.cc file, which can lead to a heap out-of-bounds read.

Vulnerability Detail

The vulnerability in TFLite's expand_dims.cc arises from a flaw in the bounds checking logic. If the axis parameter is a large negative value, it can cause the for loop to read one element before the start of the input_dims.data array. This can result in the disclosure of sensitive information or a crash. The impact of this vulnerability is considered moderate, with a CVSS score of 5.5. It is important to note that this vulnerability affects versions 2.3.4, 2.4.3, and 2.5.1 of the TensorFlow package.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow==2.21.0"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 2.3.4 2.3.4
    pip install --upgrade "tensorflow==2.3.4"
  • >= 2.4.0, < 2.4.3 2.4.3
    pip install --upgrade "tensorflow==2.4.3"
  • >= 2.5.0, < 2.5.1 2.5.1
    pip install --upgrade "tensorflow==2.5.1"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

There is no specific workaround provided for this vulnerability. The recommended solution is to update the TensorFlow package to the patched version.

Conclusion

The vulnerability in TFLite's expand_dims.cc can lead to a heap out-of-bounds read, potentially resulting in the disclosure of sensitive information or a crash. It is important for users of TensorFlow to update their package to the patched version once it becomes available. Regularly checking for updates and applying them promptly is essential for maintaining the security of your applications. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TFLite is an open-source deep learning framework developed by TensorFlow. It allows developers to deploy machine learning models efficiently on resource-constrained platforms.

The vulnerability can lead to a heap out-of-bounds read, potentially resulting in the disclosure of sensitive information or a crash.

Versions 2.3.4, 2.4.3, and 2.5.1 of the TensorFlow package are affected by this vulnerability.

Yes, the vulnerability has been patched in the GitHub commit d94ffe08a65400f898241c0374e9edc6fa8ed257. The fix will be included in TensorFlow 2.6.0.

To protect your application, it is recommended to update the TensorFlow package to the latest version once it becomes available. Regularly checking for updates and applying them promptly is crucial for maintaining the security of your applications.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow==2.21.0"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 2.3.4 2.3.4
    pip install --upgrade "tensorflow==2.3.4"
  • >= 2.4.0, < 2.4.3 2.4.3
    pip install --upgrade "tensorflow==2.4.3"
  • >= 2.5.0, < 2.5.1 2.5.1
    pip install --upgrade "tensorflow==2.5.1"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback