CVE-2022-23574: TensorFlow - Heap Out-of-Bounds Read/Write
Summary
CVE-2022-23574: Out of bounds read and write in Tensorflow. Affects tensorflow across 3 version ranges.
< 2.5.3
>= 2.6.0, < 2.6.3
>= 2.7.0, < 2.7.1
Fixed in 2.5.3, 2.6.3 or 2.7.1, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-gpu · PyPI
- tensorflow-cpu · PyPI
The same CVE-2022-23574 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 open-source machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. However, a vulnerability has been discovered in TensorFlow that could lead to heap out-of-bounds read/write attacks.
Vulnerability Detail
The vulnerability in TensorFlow is caused by a typo in the SpecializeType function, which results in a heap out-of-bounds read/write. The arg variable is incorrectly initialized to the ith mutable argument in a loop where the loop index is j. This allows an attacker to assign values to arg from outside the vector of arguments, leading to both read and write operations outside the bounds of the data. This can potentially be exploited to execute arbitrary code or disclose sensitive information. The vulnerability affects versions 2.7.0 and earlier, including 2.6.3 and 2.7.1, but has been fixed in TensorFlow 2.8.0.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
< 2.5.32.5.3 -
>= 2.6.0, < 2.6.32.6.3 -
>= 2.7.0, < 2.7.12.7.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 temporary workaround, users can apply the following code snippet to mitigate the vulnerability:
import tensorflow as tf
def patched_SpecializeType(*args, **kwargs):
# Apply custom patch here
...
return tf.raw_ops.SpecializeType(*args, **kwargs)
# Monkey-patch the vulnerable function
if tf.__version__ <= '2.7.1':
tf.raw_ops.SpecializeType = patched_SpecializeType
Conclusion
The vulnerability in TensorFlow can pose a significant security risk, allowing attackers to execute arbitrary code or access sensitive information. It is crucial to update to TensorFlow 2.8.0 or later to mitigate this vulnerability. Regularly updating all dependencies and libraries is also recommended to ensure the latest security patches are applied. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models.
The vulnerability in TensorFlow can potentially allow an attacker to execute arbitrary code or disclose sensitive information by exploiting the heap out-of-bounds read/write issue.
The vulnerability affects TensorFlow versions 2.7.0 and earlier, including 2.6.3 and 2.7.1.
Yes, the vulnerability has been fixed in TensorFlow 2.8.0. It is recommended to update to this version or later to mitigate the risk.
Yes, a temporary workaround is to apply a custom patch to the SpecializeType function. The provided code snippet demonstrates how to monkey-patch the vulnerable function.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.