Skip to main content
← All vulnerabilities
CVE-2021-37646PYSEC-2021-268BIT-TENSORFLOW-2021-37646GHSA-H6JH-7GV5-28VGPYSEC-2021-559PYSEC-2021-757

Bad alloc in `StringNGrams` caused by integer conversion in TensorFlow

Published
Last modified
published
Not listed in CISA KEV
Fix
Fixed in 2.5.1, 2.4.3, 2.3.4
None on Exploit-DB, Metasploit or GitHub

Summary

TensorFlow is an end-to-end open source platform for machine learning. In affected versions the implementation of `tf.raw_ops.StringNGrams` is vulnerable to an integer overflow issue caused by converting a signed integer value to an unsigned one and then allocating memory based on this value. The implementation calls `reserve` on a `tstring` with a value that sometimes can be negative if user supplies negative `ngram_widths`. The `reserve` method calls `TF_TString_Reserve` which has an `unsigned long` argument for the size of the buffer. Hence, the implicit conversion transforms the negative value to a large integer. We have patched the issue in GitHub commit c283e542a3f422420cfdb332414543b62fc4e4a5. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.

Timeline

  1. CVE published
  2. Record last updated

Affected versions

  • tensorflow tensorflow

    From 2.5.0 · fixed in 2.5.1; From 2.4.0 · fixed in 2.4.3; fixed in 2.3.4

  • tensorflowPyPI

    From 2.3.0 · fixed in 2.3.4; From 2.4.0 · fixed in 2.4.3

  • tensorflow-cpuPyPI

    From 2.3.0 · fixed in 2.3.4; From 2.4.0 · fixed in 2.4.3

  • tensorflowPyPI

    fixed in 2.3.4

  • tensorflowPyPI

    From 2.4.0 · fixed in 2.4.3

  • tensorflowPyPI

    From 2.5.0 · fixed in 2.5.1

  • tensorflow-cpuPyPI

    fixed in 2.3.4

  • tensorflow-cpuPyPI

    From 2.4.0 · fixed in 2.4.3

  • tensorflow-cpuPyPI

    From 2.5.0 · fixed in 2.5.1

  • tensorflow-gpuPyPI

    fixed in 2.3.4

  • tensorflow-gpuPyPI

    From 2.4.0 · fixed in 2.4.3

  • tensorflow-gpuPyPI

    From 2.5.0 · fixed in 2.5.1

  • tensorflow-gpuPyPI

    From 2.3.0 · fixed in 2.3.4; From 2.4.0 · fixed in 2.4.3

References 2

GitHub · tensorflow/tensorflow