CVE-2022-23563: TensorFlow - Insecure Usage of tempfile.mktemp
Summary
CVE-2022-23563: Insecure temporary file 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-23563 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 for building and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. However, in multiple instances, TensorFlow utilizes the tempfile.mktemp function to create temporary files. This approach is acceptable in testing scenarios but poses a security risk when used in utilities and libraries. The vulnerability arises from the fact that a different process can create the file between the check for the filename in mktemp and the actual creation of the file by a subsequent operation. This type of weakness is known as a TOC/TOU (Time-of-Check/Time-of-Use) vulnerability. To address this issue, TensorFlow has made several commits that replace mktemp with safer alternatives such as mkstemp and mkdtemp functions, depending on the usage pattern.
Vulnerability Detail
The vulnerability (CVE-2022-23563) in TensorFlow stems from the insecure usage of tempfile.mktemp to create temporary files. This can lead to a TOC/TOU vulnerability, where a different process can create the file between the filename check and the actual file creation. An attacker could potentially exploit this weakness to manipulate or gain unauthorized access to the temporary files created by TensorFlow. The impact of this vulnerability can vary depending on the context in which TensorFlow is used. However, it is crucial to address this issue promptly to prevent potential security breaches.
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
There is no specific workaround mentioned for this vulnerability. The recommended approach is to upgrade TensorFlow to a fixed version as mentioned in the 'how_to_fix' section.
Conclusion
The vulnerability in TensorFlow (CVE-2022-23563) arises from the insecure usage of tempfile.mktemp to create temporary files. This can lead to a TOC/TOU vulnerability, allowing an attacker to manipulate or gain unauthorized access to these files. To mitigate this risk, it is crucial to upgrade TensorFlow to the latest fixed version. By doing so, users can ensure that the vulnerable code is replaced with secure implementations. For further assistance or support in addressing this vulnerability, 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 for building and deploying machine learning models.
The vulnerability can lead to unauthorized access or manipulation of temporary files created by TensorFlow, potentially resulting in security breaches.
To fix this vulnerability, it is recommended to upgrade TensorFlow to the latest version available, which includes the necessary patches.
No specific workarounds are mentioned for this vulnerability. Upgrading to a fixed version is the recommended solution.
You can find more information about this vulnerability in the official TensorFlow documentation or by consulting the TensorFlow community.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.