CVE-2022-23563: Insecure temporary file in TensorFlow
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 · Bitnami
- 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 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 involves the insecure creation of temporary files.
Vulnerability Detail
The vulnerability in TensorFlow arises from the use of the tempfile.mktemp function to create temporary files. This function is intended for testing purposes and is not suitable for use in utilities and libraries. The issue occurs when a different process creates a file with the same name between the check for the filename in mktemp and the actual creation of the file. This vulnerability is a time-of-check to time-of-use (TOCTOU) weakness. In several instances, TensorFlow was supposed to create a temporary directory instead of a file, but this logic bug was hidden by the usage of mktemp. The impact of this vulnerability can be significant, as it can lead to unauthorized access, data leakage, or other security breaches.
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.5.32.5.3pip install --upgrade "tensorflow==2.5.3" -
>= 2.6.0, < 2.6.32.6.3pip install --upgrade "tensorflow==2.6.3" -
>= 2.7.0, < 2.7.12.7.1pip install --upgrade "tensorflow==2.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 provided for this vulnerability. Users are advised to update their TensorFlow installation to the patched versions mentioned above.
Conclusion
In conclusion, the vulnerability in TensorFlow involving insecure temporary file creation has been addressed by the TensorFlow team. Users are advised to update their TensorFlow installation to the patched versions to mitigate the risk of unauthorized access and other security breaches. 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 tools and libraries for building and deploying machine learning models.
The vulnerability can lead to unauthorized access, data leakage, or other security breaches.
To fix this vulnerability, update your TensorFlow installation to version 2.8.0 or later.
There are no specific workarounds provided for this vulnerability. Updating to the patched versions is recommended.
Versions 2.5.3, 2.6.3, and 2.7.1 of TensorFlow are affected by this vulnerability.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.