Skip to content

Integer overflow due to conversion to unsigned

Moderate severity GitHub Reviewed Published Aug 11, 2021 in tensorflow/tensorflow • Updated Feb 1, 2023

Package

pip tensorflow (pip)

Affected versions

< 2.4.3
= 2.5.0

Patched versions

2.4.3
2.5.1
pip tensorflow-cpu (pip)
< 2.4.3
= 2.5.0
2.4.3
2.5.1
pip tensorflow-gpu (pip)
< 2.4.3
= 2.5.0
2.4.3
2.5.1

Description

Impact

The implementation of tf.raw_ops.QuantizeAndDequantizeV4Grad 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.

import tensorflow as tf

tf.raw_ops.QuantizeAndDequantizeV4Grad(
  gradients=[1.0,2.0],
  input=[1.0,1.0],
  input_min=[0.0],
  input_max=[10.0],
  axis=-100)

The implementation uses the axis value as the size argument to absl::InlinedVector constructor. But, the constructor uses an unsigned type for the argument, so the implicit conversion transforms the negative value to a large integer.

Patches

We have patched the issue in GitHub commit 96f364a1ca3009f98980021c4b32be5fdcca33a1.

The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, and TensorFlow 2.4.3, as these are also affected and still in supported range.

For more information

Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.

Attribution

This vulnerability has been reported by members of the Aivul Team from Qihoo 360.

References

@mihaimaruseac mihaimaruseac published to tensorflow/tensorflow Aug 11, 2021
Published by the National Vulnerability Database Aug 12, 2021
Reviewed Aug 23, 2021
Published to the GitHub Advisory Database Aug 25, 2021
Last updated Feb 1, 2023

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

EPSS score

0.044%
(13th percentile)

Weaknesses

CVE ID

CVE-2021-37645

GHSA ID

GHSA-9w2p-5mgw-p94c

Source code

No known source code
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.