Lucene search

K
githubGitHub Advisory DatabaseGHSA-H67M-XG8F-FXCF
HistoryNov 10, 2021 - 6:59 p.m.

Deadlock in mutually recursive `tf.function` objects

2021-11-1018:59:32
CWE-662
CWE-667
GitHub Advisory Database
github.com
17
denial of service
tensorflow
vulnerability
patched
reentrant lock
security guide
aivul team.

CVSS2

4.3

Attack Vector

NETWORK

Attack Complexity

MEDIUM

Authentication

NONE

Confidentiality Impact

NONE

Integrity Impact

NONE

Availability Impact

PARTIAL

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

CVSS3

5.5

Attack Vector

LOCAL

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

REQUIRED

Scope

UNCHANGED

Confidentiality Impact

NONE

Integrity Impact

NONE

Availability Impact

HIGH

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

EPSS

0.001

Percentile

23.6%

Impact

The code behind tf.function API can be made to deadlock when two tf.function decorated Python functions are mutually recursive:

import tensorflow as tf

@tf.function()               
def fun1(num):
    if num == 1:
        return
    print(num)
    fun2(num-1)

@tf.function()
def fun2(num):
    if num == 0:
        return
    print(num)
    fun1(num-1)

fun1(9)

This occurs due to using a non-reentrant Lock Python object.

Loading any model which contains mutually recursive functions is vulnerable. An attacker can cause denial of service by causing users to load such models and calling a recursive tf.function, although this is not a frequent scenario.

Patches

We have patched the issue in GitHub commit afac8158d43691661ad083f6dd9e56f327c1dcb7.

The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.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 members of the Aivul Team from Qihoo 360.

Affected configurations

Vulners
Node
tensorflow-gpuRange<2.4.4
OR
tensorflow-gpuRange2.5.02.5.2
OR
tensorflow-gpuRange2.6.02.6.1
OR
tensorflow-cpuRange<2.4.4
OR
tensorflow-cpuRange2.5.02.5.2
OR
tensorflow-cpuRange2.6.02.6.1
OR
tensorflowtensorflowRange<2.4.4
OR
tensorflowtensorflowRange2.5.02.5.2
OR
tensorflowtensorflowRange2.6.02.6.1
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.3

Attack Vector

NETWORK

Attack Complexity

MEDIUM

Authentication

NONE

Confidentiality Impact

NONE

Integrity Impact

NONE

Availability Impact

PARTIAL

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

CVSS3

5.5

Attack Vector

LOCAL

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

REQUIRED

Scope

UNCHANGED

Confidentiality Impact

NONE

Integrity Impact

NONE

Availability Impact

HIGH

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

EPSS

0.001

Percentile

23.6%

Related for GHSA-H67M-XG8F-FXCF