CVE-2022-21728: Out of Bounds Read in Tensorflow

tensorflow Updated 02 Oct 2025

Summary

09/02/2022
Yes i
High
8.1

CVE-2022-21728: Out of bounds read 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

The same CVE-2022-21728 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

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 could potentially lead to an out of bounds read.

Vulnerability Detail

The vulnerability in Tensorflow is related to the implementation of shape inference for the ReverseSequence operation. The code does not properly validate the value of the batch_dim parameter, which can result in a heap out of bounds read. An attacker could exploit this vulnerability to read sensitive information from the heap, potentially leading to information disclosure or other security issues. The vulnerability has a CVSS score of 8.1, indicating a high severity level.

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.3 2.5.3
    pip install --upgrade "tensorflow==2.5.3"
  • >= 2.6.0, < 2.6.3 2.6.3
    pip install --upgrade "tensorflow==2.6.3"
  • >= 2.7.0, < 2.7.1 2.7.1
    pip 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

As a temporary workaround, you can avoid using the ReverseSequence operation with negative values for the seq_dim and batch_dim parameters. Make sure to validate and sanitize user input to prevent any potential exploitation of this vulnerability. Here is an example of how to modify the code to avoid the vulnerability:

import tensorflow as tf

@tf.function
def test():
  y = tf.raw_ops.ReverseSequence(
    input=['aaa', 'bbb'],
    seq_lengths=[1, 1, 1],
    seq_dim=0,  # Modify the value of seq_dim
    batch_dim=0  # Modify the value of batch_dim
  )
  return y

test()

Conclusion

In conclusion, the vulnerability in Tensorflow could lead to an out of bounds read, potentially resulting in information disclosure or other security issues. It is crucial to update to the latest patched version of Tensorflow to mitigate the risk. If you are unable to update immediately, consider implementing the provided workaround and ensure proper input validation and sanitization. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

The vulnerability could allow an attacker to read sensitive information from the heap, potentially leading to information disclosure or other security issues.

To fix this vulnerability, you should update to the latest patched version of Tensorflow. Refer to the vulnerability details for the specific versions that include the fix.

Yes, you can avoid using the ReverseSequence operation with negative values for the seq_dim and batch_dim parameters as a temporary workaround. Make sure to validate and sanitize user input to prevent any potential exploitation of this vulnerability.

Yes, the CVSS score for this vulnerability is 8.1, indicating a high severity level.

You can find more information about this vulnerability in the provided vulnerability details. Additionally, you can refer to the Tensorflow security guide for general information about the security model and how to contact the Tensorflow team with any issues or questions.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

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.3 2.5.3
    pip install --upgrade "tensorflow==2.5.3"
  • >= 2.6.0, < 2.6.3 2.6.3
    pip install --upgrade "tensorflow==2.6.3"
  • >= 2.7.0, < 2.7.1 2.7.1
    pip 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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback