CVE-2021-37646: TensorFlow Integer Overflow in StringNGrams
Summary
CVE-2021-37646: Bad alloc in StringNGrams caused by integer conversion in TensorFlow. Affects tensorflow across 3 version ranges.
>= 2.3.0, < 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 · PyPI
- tensorflow · PyPI
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-37646 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
TensorFlow is an end-to-end open source platform for machine learning. It provides a comprehensive ecosystem for building and deploying machine learning models. TensorFlow is widely used in various industries and research domains for tasks such as image recognition, natural language processing, and recommendation systems. However, certain versions of TensorFlow are vulnerable to an integer overflow issue in the implementation of tf.raw_ops.StringNGrams.
Vulnerability Detail
The vulnerability arises from a conversion of a signed integer value to an unsigned one, leading to an integer overflow. This occurs when the tf.raw_ops.StringNGrams function is called with negative ngram_widths values. The implementation allocates memory based on this converted value, which can result in a buffer overflow. An attacker could potentially exploit this vulnerability to execute arbitrary code or cause a denial of service. The issue has been patched in the latest versions of TensorFlow.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
>= 2.3.0, < 2.3.42.3.4 -
>= 2.4.0, < 2.4.32.4.3 -
>= 2.5.0, < 2.5.12.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. Updating to the patched version is the recommended solution.
Conclusion
The integer overflow vulnerability in TensorFlow's tf.raw_ops.StringNGrams function can be mitigated by updating to the latest patched version of TensorFlow. It is recommended to update to TensorFlow 2.6.0 or later to ensure the security of your machine learning applications. For further support on vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem for building and deploying machine learning models.
The vulnerability could allow an attacker to execute arbitrary code or cause a denial of service.
Versions 2.3.0 to 2.3.4, 2.4.0 to 2.4.3, 2.5.0, 2.6.0-rc0, 2.6.0-rc1, and 2.6.0-rc2 are affected.
Yes, the vulnerability has been patched in TensorFlow 2.6.0 and will also be backported to versions 2.5.1, 2.4.3, and 2.3.4.
To update TensorFlow, you can use the package manager or follow the installation instructions provided by the TensorFlow project.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.