Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. tensorflow-cpu
  4. ›
  5. CVE-2021-41226

CVE-2021-41226: Heap OOB in `SparseBinCount`

November 10, 2021 (updated November 13, 2024)

The implementation of SparseBinCount is vulnerable to a heap OOB:

import tensorflow as tf


tf.raw_ops.SparseBincount(
indices=[[0],[1],[2]]
values=[0,-10000000]
dense_shape=[1,1]
size=[1]
weights=[3,2,1]
binary_output=False)

This is because of missing validation between the elements of the values argument and the shape of the sparse output:

for (int64_t i = 0; i < indices_mat.dimension(0); ++i) {
const int64_t batch = indices_mat(i, 0);
const Tidx bin = values(i);
...
out(batch, bin) = ...;
}

References

  • github.com/advisories/GHSA-374m-jm66-3vj8
  • github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-635.yaml
  • github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-833.yaml
  • github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-418.yaml
  • github.com/tensorflow/tensorflow
  • github.com/tensorflow/tensorflow/commit/f410212e373eb2aec4c9e60bf3702eba99a38aba
  • github.com/tensorflow/tensorflow/security/advisories/GHSA-374m-jm66-3vj8
  • nvd.nist.gov/vuln/detail/CVE-2021-41226

Code Behaviors & Features

Detect and mitigate CVE-2021-41226 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 2.4.4, all versions starting from 2.5.0 before 2.5.2, all versions starting from 2.6.0 before 2.6.1

Fixed versions

  • 2.6.1
  • 2.5.2
  • 2.4.4

Solution

Upgrade to versions 2.4.4, 2.5.2, 2.6.1 or above.

Impact 7.1 HIGH

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H

Learn more about CVSS

Weakness

  • CWE-125: Out-of-bounds Read

Source file

pypi/tensorflow-cpu/CVE-2021-41226.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:16:34 +0000.