Loading advisory.
Loading advisory.
Deadlock in mutually recursive `tf.function` objects
The code behind tf.function API can be made to deadlock when two tf.function decorated Python functions are mutually recursive:
Published 2021-11-05 22:10 UTC · Modified 2026-07-08 06:29 UTC
Severity and EPSS are shown separately. Helm does not combine them into one score. How tiers work
| Package | Ecosystem | Affected | Fixed in | Upgrade command |
|---|---|---|---|---|
| tensorflow | PyPI | >= 2.6.0, < 2.6.1 >= 2.5.0, < 2.5.2 < 2.4.4 git commits in https://github.com/tensorflow/tensorflow: < afac8158d43691661ad083f6dd9e56f327c1dcb7 >= 2.7.0rc0, < 2.7.0 versions 2.6.0, 2.5.0, 2.5.1, 0.12.0, 0.12.1, 1.0.0, 1.0.1, 1.1.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.12.2, 1.12.3, 1.13.1, 1.13.2, 1.14.0, 1.15.0, 1.15.2, 1.15.3 and 52 more | 2.6.1, 2.5.2, 2.4.4, afac8158d43691661ad083f6dd9e56f327c1dcb7, 2.7.0 | pip install --upgrade 'tensorflow>=2.6.1'pip install --upgrade 'tensorflow>=2.5.2'pip install --upgrade 'tensorflow>=2.4.4'pip install --upgrade 'tensorflow>=afac8158d43691661ad083f6dd9e56f327c1dcb7'pip install --upgrade 'tensorflow>=2.7.0' |
| tensorflow-cpu | PyPI | >= 2.6.0, < 2.6.1 >= 2.5.0, < 2.5.2 < 2.4.4 git commits in https://github.com/tensorflow/tensorflow: < afac8158d43691661ad083f6dd9e56f327c1dcb7 >= 2.7.0rc0, < 2.7.0 versions 2.6.0, 2.5.0, 2.5.1, 1.15.0, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1 and 4 more | 2.6.1, 2.5.2, 2.4.4, afac8158d43691661ad083f6dd9e56f327c1dcb7, 2.7.0 | pip install --upgrade 'tensorflow-cpu>=2.6.1'pip install --upgrade 'tensorflow-cpu>=2.5.2'pip install --upgrade 'tensorflow-cpu>=2.4.4'pip install --upgrade 'tensorflow-cpu>=afac8158d43691661ad083f6dd9e56f327c1dcb7' |
| tensorflow-gpu | PyPI | >= 2.6.0, < 2.6.1 >= 2.5.0, < 2.5.2 < 2.4.4 git commits in https://github.com/tensorflow/tensorflow: < afac8158d43691661ad083f6dd9e56f327c1dcb7 >= 2.7.0rc0, < 2.7.0 versions 2.6.0, 2.5.0, 2.5.1, 0.12.0, 0.12.1, 1.0.0, 1.0.1, 1.1.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.12.2, 1.12.3, 1.13.1, 1.13.2, 1.14.0, 1.15.0, 1.15.2, 1.15.3 and 39 more | 2.6.1, 2.5.2, 2.4.4, afac8158d43691661ad083f6dd9e56f327c1dcb7, 2.7.0 | pip install --upgrade 'tensorflow-gpu>=2.6.1'pip install --upgrade 'tensorflow-gpu>=2.5.2'pip install --upgrade 'tensorflow-gpu>=2.4.4'pip install --upgrade 'tensorflow-gpu>=afac8158d43691661ad083f6dd9e56f327c1dcb7' |
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.
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.
Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.
This vulnerability has been reported by members of the Aivul Team from Qihoo 360.
No public exploit code known to Helm's sources (Nuclei templates, Metasploit, Exploit-DB and PoC-in-GitHub). That does not mean none exists.
pip install --upgrade 'tensorflow-cpu>=2.7.0'pip install --upgrade 'tensorflow-gpu>=2.7.0'One EPSS score on record: 0.002 on 2026-11-24.
| Date | Score | Previous | Model |
|---|---|---|---|
| 2026-11-24 | 0.002 | first score | v2026.06.15 |