TensorflowApplication · Google

CVE-2022-23563

MEDIUM · 6.3 CVSS v3.1 Published 2022-02-04
Fix available
A fix is available. Upgrade to after 2.6.2 or later.
See remediation →
65/100
Remediation priority · Elevated
Zero-click

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 · unedited
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.

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 confidence

TensorFlow 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.

MitigationUpgrade TensorFlow to a version containing the patched commits that replace `mktemp` with secure alternatives `mkstemp` (for files) or `mkdtemp` (for directories).

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
TensorflowApplication
Affected:<= 2.5.2>= 2.6.0, <= 2.6.2= 2.7.0

CVSS 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 checks

Work through these to decide whether this CVE applies to you.

  1. Check installed TensorFlow version
    Run `python -c "import tensorflow as tf; print(tf.__version__)"` to see the version number
    Affected if The version is 2.5.0 through 2.5.2, 2.6.0 through 2.6.2, or exactly 2.7.0
  2. Locate TensorFlow installation path
    Run `python -c "import tensorflow; print(tensorflow.__file__)"` to get the base path of the TensorFlow package
    Affected if The path points to a directory that will be inspected in the next step
  3. Search for mktemp usage in TensorFlow source code
    Use 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)
  4. Verify if mkstemp or mkdtemp are used instead
    Search 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.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

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 · scoped
Upgrade available Upgrade to a release after 2.6.2
Interim mitigation

Upgrade TensorFlow to a version containing the patched commits that replace `mktemp` with secure alternatives `mkstemp` (for files) or `mkdtemp` (for directories).

Recommended fix High confidence

TensorFlow 2.7.1 or later (2.8.0+, 2.9.0+, 2.10.0+, or 2.11.0+ recommended)

  1. 1. Identify the current TensorFlow version in your environment using: pip show tensorflow or pip list | grep tensorflow
  2. 2. If running TensorFlow <= 2.5.2, >= 2.6.0 <= 2.6.2, or = 2.7.0, upgrade to a patched version
  3. 3. Upgrade TensorFlow using: pip install --upgrade tensorflow
  4. 4. Verify the new version installed correctly: pip show tensorflow
  5. 5. Test that your existing code and models work with the upgraded TensorFlow version
  6. 6. If using TensorFlow Serving or other TensorFlow-related tools, ensure those are also updated to compatible versions
Caveat Minor: Some deprecated APIs removed in 2.8+; verify custom code compatibility before production deployment

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in Tensorflow Scoped from the published advisory
  • Consultation6.0 h
  • Implementation12.0 h
  • Testing10.0 h
  • Review / QA6.0 h
34.0 hours of engineering $5,940
Get the upgrade done

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 locally
dbcve dependency scanner

Check 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 sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2022-23563 in production — separate from our analysis above.

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.

What this is

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.

What belongs here
  • 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