Home » Database

AVID-2026-R0836

Description

Bad alloc in StringNGrams caused by integer conversion in TensorFlow (CVE-2021-37646)

Details

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.

Reason for inclusion in AVID: The candidate describes CVE-2021-37646, a vulnerability in TensorFlow (an AI framework) involving an integer conversion leading to bad memory allocation in StringNGrams. This is a software vulnerability in a component commonly used to build/train/deploy AI systems, i.e., a general-purpose AI software stack. It affects AI-related software supply chains (TensorFlow runtime/kernels) and has a security impact (potentially affecting availability). The report provides explicit details, affected scope, and a patch commit, giving sufficient evidence for curation.

References

Affected or Relevant Artifacts

  • Developer: tensorflow
  • Deployer: tensorflow
  • Artifact Details:
TypeName
Systemtensorflow

Impact

AVID Taxonomy Categorization

  • Risk domains: Security
  • SEP subcategories: S0100: Software Vulnerability
  • Lifecycle stages: L06: Deployment

CVSS

Version3.1
Vector StringCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
Base Score5.5
Base Severity🟠 Medium
Attack VectorLOCAL
Attack Complexity🟢 Low
Privileges Required🟢 Low
User InteractionNONE
ScopeUNCHANGED
Confidentiality ImpactNONE
Integrity ImpactNONE
Availability Impact🔴 High

CWE

IDDescription
CWE-681CWE-681: Incorrect Conversion between Numeric Types

Other information

  • Report Type: Advisory
  • Credits:
  • Date Reported: 2021-08-12
  • Version: 0.3.3
  • AVID Entry