CVE-2021-29544: CHECK-fail in `QuantizeAndDequantizeV4Grad`

Published May 14, 2021
·
Updated

Impact An attacker can trigger a denial of service via a CHECK-fail in tf.rawops.QuantizeAndDequantizeV4Grad:

python import tensorflow as tf

gradienttensor = tf.constant([0.0], shape=[1]) inputtensor = tf.constant([0.0], shape=[1]) inputmin = tf.constant([[0.0]], shape=[1, 1]) inputmax = tf.constant([[0.0]], shape=[1, 1])

tf.rawops.QuantizeAndDequantizeV4Grad( gradients=gradienttensor, input=inputtensor, inputmin=inputmin, inputmax=inputmax, axis=0) This is because the implementation does not validate the rank of the input tensors. In turn, this results in the tensors being passes as they are to QuantizeAndDequantizePerChannelGradientImpl:

cc template <typename Device, typename T> struct QuantizeAndDequantizePerChannelGradientImpl { static void Compute(const Device& d, typename TTypes<T, 3>::ConstTensor gradient, typename TTypes<T, 3>::ConstTensor input, const Tensor inputmintensor, const Tensor inputmaxtensor, typename TTypes<T, 3>::Tensor inputbackprop, typename TTypes<T>::Flat inputminbackprop, typename TTypes<T>::Flat inputmaxbackprop) { ... auto inputmin = inputmintensor->vec<T>(); auto inputmax = inputmaxtensor->vec<T>(); ... }

However, the vec<T> method, requires the rank to 1 and triggers a CHECK failure otherwise.

Patches We have patched the issue in GitHub commit 20431e9044cf2ad3c0323c34888b192f3289af6b.

The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2 as this is the only other affected version.

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.

Other sources

TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a denial of service via a CHECK-fail in tf.rawops.QuantizeAndDequantizeV4Grad. This is because the implementation does not validate the rank of the input tensors. In turn, this results in the tensors being passes as they are to QuantizeAndDequantizePerChannelGradientImpl. However, the vec<T> method, requires the rank to 1 and triggers a CHECK failure otherwise. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2 as this is the only other affected version.

MITRE

TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a denial of service via a CHECK-fail in tf.rawops.QuantizeAndDequantizeV4Grad. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/95078c145b5a7a43ee046144005f733092756ab5/tensorflow/core/kernels/quantizeanddequantizeop.cc#L162-L163) does not validate the rank of the input tensors. In turn, this results in the tensors being passes as they are to QuantizeAndDequantizePerChannelGradientImpl(https://github.com/tensorflow/tensorflow/blob/95078c145b5a7a43ee046144005f733092756ab5/tensorflow/core/kernels/quantizeanddequantizeop.h#L295-L306). However, the vec<T> method, requires the rank to 1 and triggers a CHECK failure otherwise. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2 as this is the only other affected version.

Affected Software

4 affected componentsFixes available
pip/tensorflow-gpu>=2.4.0<2.4.2
2.4.2
pip/tensorflow-cpu>=2.4.0<2.4.2
2.4.2
pip/tensorflow>=2.4.0<2.4.2
2.4.2
Google TensorFlow>=2.4.0<2.4.2

Event History

May 14, 2021
CVE Published
via MITRE·07:11 PM
Data Sourced
via MITRE·07:11 PM
DescriptionSeverityWeakness
May 21, 2021
Advisory Published
via GitHub·02:23 PM

Frequently Asked Questions

1

What is the severity of CVE-2021-29544?

CVE-2021-29544 is rated as a denial of service vulnerability.

2

How do I fix CVE-2021-29544?

To mitigate CVE-2021-29544, upgrade TensorFlow to version 2.4.2 or higher.

3

What software is affected by CVE-2021-29544?

CVE-2021-29544 affects TensorFlow versions between 2.4.0 and 2.4.2.

4

What will happen if CVE-2021-29544 is exploited?

If exploited, CVE-2021-29544 can cause a denial of service by triggering a CHECK-fail in the TensorFlow operation.

5

Who reported CVE-2021-29544?

CVE-2021-29544 was reported in the TensorFlow GitHub repository.

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