VYPR
High severityNVD Advisory· Published Feb 4, 2022· Updated Apr 22, 2025

Read and Write outside of bounds in TFLite

CVE-2022-23560

Description

Tensorflow is an Open Source Machine Learning Framework. An attacker can craft a TFLite model that would allow limited reads and writes outside of arrays in TFLite. This exploits missing validation in the conversion from sparse tensors to dense tensors. The fix is included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range. Users are advised to upgrade as soon as possible.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
tensorflowPyPI
< 2.5.32.5.3
tensorflowPyPI
>= 2.6.0, < 2.6.32.6.3
tensorflowPyPI
>= 2.7.0, < 2.7.12.7.1
tensorflow-cpuPyPI
< 2.5.32.5.3
tensorflow-cpuPyPI
>= 2.6.0, < 2.6.32.6.3
tensorflow-cpuPyPI
>= 2.7.0, < 2.7.12.7.1
tensorflow-gpuPyPI
< 2.5.32.5.3
tensorflow-gpuPyPI
>= 2.6.0, < 2.6.32.6.3
tensorflow-gpuPyPI
>= 2.7.0, < 2.7.12.7.1

Affected products

1

Patches

1
6364463d6f5b

[lite] Add some safety checks to avoid out of bound access for sparsity format

https://github.com/tensorflow/tensorflowKarim NosirDec 16, 2021via ghsa
1 file changed · +11 7
  • tensorflow/lite/kernels/internal/utils/sparsity_format_converter.cc+11 7 modified
    @@ -282,10 +282,12 @@ void FormatConverter<T>::InitSparseToDenseConverter(
       block_size_.resize(block_map_.size());
       for (int i = 0; i < original_rank; i++) {
         if (block_dim < block_map_.size() && block_map_[block_dim] == i) {
    -      int orig_dim = traversal_order_[original_rank + block_dim];
    -      block_size_[block_dim] = dense_size[orig_dim];
    -      blocked_shape_[i] = dense_shape_[i] / dense_size[orig_dim];
    -      block_dim++;
    +      if (original_rank + block_dim < traversal_order_.size()) {
    +        int orig_dim = traversal_order_[original_rank + block_dim];
    +        block_size_[block_dim] = dense_size[orig_dim];
    +        blocked_shape_[i] = dense_shape_[i] / dense_size[orig_dim];
    +        block_dim++;
    +      }
         } else {
           blocked_shape_[i] = dense_shape_[i];
         }
    @@ -328,13 +330,15 @@ void FormatConverter<T>::Populate(const T* src_data, std::vector<int> indices,
           Populate(src_data, indices, level + 1, prev_idx * shape_of_level + i,
                    src_data_ptr, dest_data);
         }
    -  } else {
    +  } else if (prev_idx + 1 < dim_metadata_[metadata_idx].size()) {
         const auto& array_segments = dim_metadata_[metadata_idx];
         const auto& array_indices = dim_metadata_[metadata_idx + 1];
         for (int i = array_segments[prev_idx]; i < array_segments[prev_idx + 1];
              i++) {
    -      indices[level] = array_indices[i];
    -      Populate(src_data, indices, level + 1, i, src_data_ptr, dest_data);
    +      if (i < array_indices.size() && level < indices.size()) {
    +        indices[level] = array_indices[i];
    +        Populate(src_data, indices, level + 1, i, src_data_ptr, dest_data);
    +      }
         }
       }
     }
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

7

News mentions

0

No linked articles in our index yet.