CVE-2021-29614: TensorFlow - Incorrect Results and Python Interpreter Crash in tf.io.decode_raw
Summary
CVE-2021-29614: Interpreter crash from tf.io.decode_raw. Affects tensorflow across 4 version ranges.
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
Fixed in 4 releases; the minimum fixed version depends 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-29614 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. The vulnerability identified as CVE-2021-29614 affects the implementation of tf.io.decode_raw in TensorFlow. This function is responsible for decoding raw binary data. The vulnerability arises when combining fixed_length and wider datatypes, leading to incorrect results and crashes in the Python interpreter.
Vulnerability Detail
The vulnerability in TensorFlow's tf.io.decode_raw function is caused by a bug in the implementation of the padded version. The code confuses pointer arithmetic rules, resulting in incorrect decoding and potential out-of-bounds writes. When fixed_length is used to determine the width of each output element, the code mistakenly moves the out_data pointer by fixed_length * sizeof(T) bytes, even though it only copied at most fixed_length bytes from the input. This leads to parts of the input not being decoded into the output and writing outside the bounds of the backing data. While the provided reproducer causes a crash in the Python interpreter, more severe attacks can be mounted by exploiting this vulnerability.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
< 2.1.42.1.4 -
>= 2.2.0, < 2.2.32.2.3 -
>= 2.3.0, < 2.3.32.3.3 -
>= 2.4.0, < 2.4.22.4.2
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
No workaround has been provided for this vulnerability.
Conclusion
The vulnerability in TensorFlow's tf.io.decode_raw function can lead to incorrect results, crashes in the Python interpreter, and potential out-of-bounds writes. It is crucial to update to the fixed versions of TensorFlow as soon as they are released. 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 can result in incorrect decoding of raw binary data and crashes in the Python interpreter. It also allows for potential out-of-bounds writes, which can be exploited for more severe attacks.
The vulnerability affects TensorFlow versions 2.1.4, 2.2.3, 2.3.3, and 2.4.2. These versions are within the supported range and will receive the fix.
No workaround has been provided for this vulnerability.
To fix this vulnerability, it is recommended to update to the fixed versions of TensorFlow when they become available. The fix will be included in TensorFlow 2.5.0 and backported to TensorFlow 2.4.2, 2.3.3, 2.2.3, and 2.1.4.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.