CVE-2021-41220: Use after free in `CollectiveReduceV2`

Published Nov 5, 2021
·
Updated

Impact The async implementation of CollectiveReduceV2 suffers from a memory leak and a use after free:

python import tensorflow as tf tf.rawops.CollectiveReduceV2( input=[], groupsize=[-10, -10, -10], groupkey=[-10, -10], instancekey=[-10], orderingtoken=[], mergeop='Mul', finalop='Div')

This occurs due to the asynchronous computation and the fact that objects that have been std::move()d from are still accessed:

cc auto donewithcleanup = colparams, done = std::move(done) { done(); colparams->Unref(); }; OPREQUIRESOKASYNC(c, FillCollectiveParams(colparams, REDUCTIONCOLLECTIVE, /groupsize/ c->input(1), /groupkey/ c->input(2), /instancekey/ c->input(3)), done);

Here, done is already moved from by the time OPREQUIRESOKASYNC macro needs to invoke it in case of errors. In this case, we get an undefined behavior, which can manifest via crashes, std::badalloc throws or just memory leaks.

Patches We have patched the issue in GitHub commit ca38dab9d3ee66c5de06f11af9a4b1200da5ef75.

The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, as this version is the only one that is also affected.

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.

Other sources

TensorFlow is an open source platform for machine learning. In affected versions the async implementation of CollectiveReduceV2 suffers from a memory leak and a use after free. This occurs due to the asynchronous computation and the fact that objects that have been std::move()d from are still accessed. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, as this version is the only one that is also affected.

MITRE

Affected Software

6 affected componentsFixes available
pip/tensorflow-gpu=2.6.0
2.6.1
pip/tensorflow-cpu=2.6.0
2.6.1
pip/tensorflow=2.6.0
2.6.1
Google TensorFlow>=2.6.0<2.6.1
Google TensorFlow=2.7.0-rc0
Google TensorFlow=2.7.0-rc1

Event History

Nov 5, 2021
CVE Published
via MITRE·10:20 PM
Data Sourced
via MITRE·10:20 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·11:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Nov 10, 2021
Advisory Published
via GitHub·06:51 PM

Frequently Asked Questions

1

What is the severity of CVE-2021-41220?

CVE-2021-41220 is considered a moderate severity vulnerability due to the presence of a memory leak and use after free in TensorFlow.

2

How do I fix CVE-2021-41220?

To remediate CVE-2021-41220, upgrade your TensorFlow installation to version 2.6.1 or later.

3

What software versions are affected by CVE-2021-41220?

CVE-2021-41220 affects TensorFlow versions 2.6.0, 2.7.0-rc0, and 2.7.0-rc1.

4

What is the impact of CVE-2021-41220 on applications using TensorFlow?

The impact of CVE-2021-41220 includes potential application crashes and unexpected behavior due to memory management issues.

5

Is there a known exploit for CVE-2021-41220?

As of now, there is no widely publicized exploit available for CVE-2021-41220.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203