Insecure temporary file in Tensorflow
Tensorflow is an Open Source Machine Learning Framework. In multiple places, TensorFlow uses `tempfile.mktemp` to create temporary files. While this is acceptable in testing, in utilities and libraries it is dangerous as 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 (a TOC/TOU type of weakness). In several instances, TensorFlow was supposed to actually create a temporary directory instead of a file. This logic bug is hidden away by the `mktemp` function usage. We have patched the issue in several commits, replacing `mktemp` with the safer `mkstemp`/`mkdtemp` functions, according to the usage pattern. Users are advised to upgrade as soon as possible.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2022-23563
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 6 Nov 2026, 09:21 UTC · Revision 1
Source evidence
Tensorflow is an Open Source Machine Learning Framework. In multiple places, TensorFlow uses `tempfile.mktemp` to create temporary files. While this is acceptable in testing, in utilities and libraries it is dangerous as 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 (a TOC/TOU type of weakness). In several instances, TensorFlow was supposed to actually create a temporary directory instead of a file. This logic bug is hidden away by the `mktemp` function usage. We have patched the issue in several commits, replacing `mktemp` with the safer `mkstemp`/`mkdtemp` functions, according to the usage pattern. Users are advised to upgrade as soon as possible.
osv:CVE-2022-23563
Complete source record
{
"id": "cdcef2814d18d9cc746cdae4c9ed00c5963fb7d24e6f110830498ab655946649",
"url": "https://osv.dev/vulnerability/CVE-2022-23563",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Insecure temporary file in Tensorflow",
"summary": "Tensorflow is an Open Source Machine Learning Framework. In multiple places, TensorFlow uses `tempfile.mktemp` to create temporary files. While this is acceptable in testing, in utilities and libraries it is dangerous as 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 (a TOC/TOU type of weakness). In several instances, TensorFlow was supposed to actually create a temporary directory instead of a file. This logic bug is hidden away by the `mktemp` function usage. We have patched the issue in several commits, replacing `mktemp` with the safer `mkstemp`/`mkdtemp` functions, according to the usage pattern. Users are advised to upgrade as soon as possible.",
"evidence": "osv:CVE-2022-23563",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2022-23563",
"aliases": [
"BIT-tensorflow-2022-23563",
"CVE-2022-23563",
"GHSA-wc4g-r73w-x8mm",
"PYSEC-2022-127",
"PYSEC-2022-72",
"PYSEC-2026-3253"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/tensorflow/tensorflow",
"type": "GIT",
"events": [
{
"introduced": "c256c071bb26e1e13b4666d1b3e229e110bc914a"
},
{
"fixed": "2a0f59ecfe64d4e7750e406f00f783ff4bd34631"
},
{
"introduced": "919f693420e35d00c8d0a42100837ae3718f7927"
},
{
"fixed": "92a6bb06549e74a8bd8cdb8e28552496e5520007"
},
{
"introduced": "0"
},
{
"fixed": "959e9b2a0c06df945f9fb66bd367af8832ca0d28"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "2.7.0"
},
{
"fixed": "2.7.1"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"introduced": "2.6.0"
},
{
"fixed": "2.6.3"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"introduced": "0"
},
{
"fixed": "2.5.3"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
}
]
}
}
],
"versions": [
"2.7.0",
"v2.5.2",
"v2.6.2",
"v2.7.0",
"v2.6.1",
"v2.6.0",
"v2.5.1",
"v2.5.0",
"v2.5.0-rc3",
"v2.5.0-rc2",
"v2.5.0-rc1",
"v2.5.0-rc0",
"v1.12.1",
"v1.9.0-rc2",
"v1.6.0-rc1",
"v1.1.0-rc2",
"v1.1.0-rc1",
"0.6.0",
"0.5.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-23563.json"
}
}
],
"modified": "2026-10-28T02:30:47.071677461Z",
"provider": "osv",
"references": [
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/23xxx/CVE-2022-23563.json",
"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-wc4g-r73w-x8mm",
"https://nvd.nist.gov/vuln/detail/CVE-2022-23563"
],
"provider_metadata": {
"cwe_ids": [
"CWE-367"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/23xxx/CVE-2022-23563.json"
}
},
"related_cves": [
{
"value": "CVE-2022-23563",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 515071,
"published_at": "2022-02-04T22:32:38+00:00"
}