CVE-2021-37682: Uninitialized Value Use in TFLite
Summary
CVE-2021-37682: Use of unitialized value 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
- tensorflow · Bitnami
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-37682 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
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.
No signup required · Results in about 60 seconds
Background
The TensorFlow Lite (TFLite) package is an open-source deep learning framework developed by TensorFlow. It is designed to run machine learning models on resource-constrained devices such as mobile phones, embedded systems, and microcontrollers. TFLite provides efficient inference for neural networks, including support for quantization to optimize model size and performance. However, a vulnerability has been discovered in TFLite that allows the use of uninitialized values in operations involving quantization.
Vulnerability Detail
The vulnerability in TFLite arises from the improper handling of quantization parameters. In certain parts of the code, the quantization.params field is accessed without proper checks on the corresponding quantization.type field. This can lead to the use of uninitialized values in TFLite operations that involve quantization. For example, the code snippet const auto* affine_quantization = reinterpret_cast<TfLiteAffineQuantization*>(filter->quantization.params); can result in uninitialized values being used if quantization.type is kTfLiteNoQuantization. The impact of this vulnerability is that it can affect the accuracy and reliability of TFLite models that rely on quantization.
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.42.3.4pip install --upgrade "tensorflow==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow==2.4.3" -
>= 2.5.0, < 2.5.12.5.1pip 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
As a workaround, users can avoid using quantization in TFLite operations until they have updated to a patched version of TensorFlow. By disabling quantization, the vulnerability can be mitigated. However, this may result in a loss of performance optimization that quantization provides. Here is an example of how to disable quantization in TFLite:
import tensorflow as tf
# Disable quantization
tf.lite.OpsSet.EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT8 = 0
# Rest of the TFLite code
# ...
By setting tf.lite.OpsSet.EXPERIMENTAL_TFLITE_BUILTINS_ACTIVATIONS_INT8 to 0, quantization will be disabled for TFLite operations.
Conclusion
The vulnerability in TFLite that allows the use of uninitialized values in quantization operations has been identified and patched. Users are advised to update their TensorFlow installation to one of the patched versions (2.6.0, 2.5.1, 2.4.3, or 2.3.4) to ensure the security of their TFLite models. A workaround is available by disabling quantization, but this may impact performance optimization. For further support and assistance with vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow Lite (TFLite) is an open-source deep learning framework developed by TensorFlow. It is designed to run machine learning models on resource-constrained devices such as mobile phones, embedded systems, and microcontrollers.
Quantization in TFLite is a technique used to optimize the size and performance of machine learning models. It involves reducing the precision of model weights and activations, typically from floating-point to fixed-point representation.
The vulnerability in TFLite can lead to the use of uninitialized values in operations involving quantization. This can affect the accuracy and reliability of TFLite models that rely on quantization, potentially leading to incorrect results or unexpected behavior.
Yes, the vulnerability has been patched in the TensorFlow GitHub repository. The fix is included in TensorFlow versions 2.6.0, 2.5.1, 2.4.3, and 2.3.4. Users are advised to update their TensorFlow installation to one of these patched versions to mitigate the vulnerability.
Yes, a workaround is to disable quantization in TFLite operations until a patched version of TensorFlow can be installed. By disabling quantization, the vulnerability can be mitigated. However, this may result in a loss of performance optimization that quantization provides.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.