CVE-2021-29533: TensorFlow - Denial of Service via Empty Image in DrawBoundingBoxes

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
Medium
Not published

CVE-2021-29533: CHECK-fail in DrawBoundingBoxes. Affects tensorflow across 4 version ranges.

< 2.1.4 >= 2.2.0, < 2.2.3 >= 2.3.0, < 2.3.3 >= 2.4.0, < 2.4.2

Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-29533 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

TensorFlow is an end-to-end open source platform for machine learning. It provides a comprehensive set of tools, libraries, and resources for building and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. It allows developers to create and train machine learning models using a flexible and scalable framework. However, a vulnerability has been identified in TensorFlow that can lead to a denial of service attack.

Vulnerability Detail

The vulnerability in TensorFlow arises from a flaw in the implementation of the tf.raw_ops.DrawBoundingBoxes function. This function is used to draw bounding boxes on images. The implementation uses CHECK_* assertions to validate user-controlled inputs, instead of OP_REQUIRES which allows returning an error condition. As a result, if an empty image is passed to the function, a CHECK failure occurs, leading to a crash and denial of service. The specific issue is caused by the height of the image being 0, resulting in a negative value for max_box_row_clamp and triggering the assertion failure. This vulnerability has a medium severity rating.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 2.1.4 2.1.4
  • >= 2.2.0, < 2.2.3 2.2.3
  • >= 2.3.0, < 2.3.3 2.3.3
  • >= 2.4.0, < 2.4.2 2.4.2

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a workaround, users can validate the inputs before calling the tf.raw_ops.DrawBoundingBoxes function. They should ensure that the image passed to the function is not empty and has a valid height. Here is an example of how to perform this validation in Python:

import tensorflow as tf

def draw_bounding_boxes(image):
    if image.size == 0 or image.height == 0:
        print('Invalid image')
        return
    tf.raw_ops.DrawBoundingBoxes(image)

Conclusion

In conclusion, a vulnerability has been identified in TensorFlow that can be exploited to cause a denial of service by passing an empty image to the tf.raw_ops.DrawBoundingBoxes function. The vulnerability has a medium severity rating and will be fixed in the upcoming TensorFlow 2.5.0 release. Users are advised to update their installations to the patched versions once they are available. In the meantime, a workaround is available to validate the inputs before calling the vulnerable function. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning that provides tools and resources for building and deploying machine learning models.

This vulnerability can be exploited by an attacker to cause a denial of service by crashing the TensorFlow program.

The vulnerability can be fixed by updating TensorFlow to the patched versions (2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4) once they are released.

Yes, a workaround is to validate the inputs before calling the vulnerable function to ensure that the image is not empty and has a valid height.

For more information about this vulnerability, you can refer to the official TensorFlow documentation or contact the TensorFlow support team.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 2.1.4 2.1.4
  • >= 2.2.0, < 2.2.3 2.2.3
  • >= 2.3.0, < 2.3.3 2.3.3
  • >= 2.4.0, < 2.4.2 2.4.2

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback