CVE-2022-23563
Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.
NVD · uneditedTensorflow 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.
Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.
dbcve analysis · high confidenceTensorFlow uses the insecure `tempfile.mktemp` function in multiple places, which creates a Time-of-Check-Time-of-Use (TOCTOU) race condition. This function generates a filename but does not atomically create the file, allowing a malicious process to create a file with that name between the filename generation and actual file creation. In some cases, the code incorrectly uses `mktemp` when it should create a temporary directory instead of a file.
Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.
Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.
NVD · CPE data<= 2.5.2>= 2.6.0, <= 2.6.2= 2.7.0CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.
From the vector- Attack vector
- Local
- Complexity
- High
- Privileges
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- None
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.
dbcve checksWork through these to decide whether this CVE applies to you.
-
Check installed TensorFlow versionRun `python -c "import tensorflow as tf; print(tf.__version__)"` to see the version numberAffected if The version is 2.5.0 through 2.5.2, 2.6.0 through 2.6.2, or exactly 2.7.0
-
Locate TensorFlow installation pathRun `python -c "import tensorflow; print(tensorflow.__file__)"` to get the base path of the TensorFlow packageAffected if The path points to a directory that will be inspected in the next step
-
Search for mktemp usage in TensorFlow source codeUse grep or a similar tool to search for "mktemp" within the TensorFlow installation directory, for example: `grep -r "mktemp" /path/to/tensorflow`Affected if Any occurrences of "mktemp" are found in the TensorFlow source code (unpatched versions contain this insecure function call)
-
Verify if mkstemp or mkdtemp are used insteadSearch for "mkstemp" and "mkdtemp" in the TensorFlow source: `grep -rE "mkstemp|mkdtemp" /path/to/tensorflow`Affected if No occurrences of "mkstemp" or "mkdtemp" are found, indicating the secure alternatives have not been implemented
A user is affected if their TensorFlow version falls within 2.5.0-2.5.2, 2.6.0-2.6.2, or 2.7.0, and the source code still contains "mktemp" calls without the secure "mkstemp" or "mkdtemp" replacements.
Generated from the published advisory. Verify against your own configuration.
Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.
dbcve · scopedUpgrade TensorFlow to a version containing the patched commits that replace `mktemp` with secure alternatives `mkstemp` (for files) or `mkdtemp` (for directories).
TensorFlow 2.7.1 or later (2.8.0+, 2.9.0+, 2.10.0+, or 2.11.0+ recommended)
- 1. Identify the current TensorFlow version in your environment using: pip show tensorflow or pip list | grep tensorflow
- 2. If running TensorFlow <= 2.5.2, >= 2.6.0 <= 2.6.2, or = 2.7.0, upgrade to a patched version
- 3. Upgrade TensorFlow using: pip install --upgrade tensorflow
- 4. Verify the new version installed correctly: pip show tensorflow
- 5. Test that your existing code and models work with the upgraded TensorFlow version
- 6. If using TensorFlow Serving or other TensorFlow-related tools, ensure those are also updated to compatible versions
Generated from the published advisory — verify against the referenced sources before acting.
- Consultation6.0 h
- Implementation12.0 h
- Testing10.0 h
- Review / QA6.0 h
An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $9,504.
Scan for this in your stack
Free · runs locallyCheck whether your project pulls in CVE-2022-23563 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.
References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.
Primary sourcesPractitioner notes
ContributedPeer-ranked notes from engineers who’ve handled CVE-2022-23563 in production — separate from our analysis above.
The advisory tells you what broke. It rarely tells you what actually worked. If you’ve dealt with this one, that detail is what the next engineer is searching for.
- The version that genuinely resolved it — not the one the vendor claimed
- A config change or rule that shut the vector down
- A gotcha in the upgrade path that cost you an afternoon
No notes yet
Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.
A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.
- Verified mitigations, workarounds, and config changes
- Version or environment caveats, and links to real fixes
- No weaponised exploit code, or anything meant to cause harm
- No spam, self-promotion, credentials, or personal data