CVE-2021-29571
Memory corruption in `DrawBoundingBoxesV2`
TensorFlow is an end-to-end open source platform for machine learning. The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- High
- Privileges needed
- Low
- User interaction
- None
What an attacker can affect
- Confidentiality
- Low
- Integrity
- Low
- Availability
- Low
Exploit likelihood
What each source reports
CVE List Score used
4.5
Memory corruption in `DrawBoundingBoxesV2`
TensorFlow is an end-to-end open source platform for machine learning. The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
- Record
CVE-2021-29571- CVSS 3.1
- 4.5 Medium
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L - Weakness
- CWE-787
- Updated
- 2026-11-02
EUVDEUVD-2021-0312
4.5
TensorFlow is an end-to-end open source platform for machine learning. The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
- Record
EUVD-2021-0312- CVSS 3.1
- 4.5 Medium
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-whr9-vfh2-7hm6
2.0
Memory corruption in `DrawBoundingBoxesV2`
Impact
The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs:
import tensorflow as tf
images = tf.fill([10, 96, 0, 1], 0.)
boxes = tf.fill([10, 53, 0], 0.)
colors = tf.fill([0, 1], 0.)
tf.raw_ops.DrawBoundingBoxesV2(images=images, boxes=boxes, colors=colors)
The implementation assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption:
const auto tboxes = boxes.tensor<T, 3>();
for (int64 bb = 0; bb < num_boxes; ++bb) {
...
const int64 min_box_row = static_cast<float>(tboxes(b, bb, 0)) * (height - 1);
const int64 max_box_row = static_cast<float>(tboxes(b, bb, 2)) * (height - 1);
const int64 min_box_col = static_cast<float>(tboxes(b, bb, 1)) * (width - 1);
const int64 max_box_col = static_cast<float>(tboxes(b, bb, 3)) * (width - 1);
...
}
If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices.
Patches
We have patched the issue in GitHub commit 79865b542f9ffdc9caeb255631f7c56f1d4b6517.
The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
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.
- Record
GHSA-whr9-vfh2-7hm6- CVSS 4.0
- 2.0 Low
CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N - CVSS 3.1
- 4.5 Medium
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L - Weakness
- CWE-787
- Updated
- 2026-11-02
NVD
4.5
TensorFlow is an end-to-end open source platform for machine learning. The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
- Record
CVE-2021-29571- CVSS 3.1
- 4.5 Medium
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L - CVSS 3.1
- 7.8 High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - CVSS 2.0
- 4.6 Medium
AV:L/AC:L/Au:N/C:P/I:P/A:P - Weakness
- CWE-787
- Updated
- 2026-11-02
OSV
7.8
TensorFlow is an end-to-end open source platform for machine learning. The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
- Record
CVE-2021-29571- CVSS 3.1
- 7.8 High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVGHSA-whr9-vfh2-7hm6
2.0
Memory corruption in `DrawBoundingBoxesV2`
Impact
The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs:
import tensorflow as tf
images = tf.fill([10, 96, 0, 1], 0.)
boxes = tf.fill([10, 53, 0], 0.)
colors = tf.fill([0, 1], 0.)
tf.raw_ops.DrawBoundingBoxesV2(images=images, boxes=boxes, colors=colors)
The implementation assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption:
const auto tboxes = boxes.tensor<T, 3>();
for (int64 bb = 0; bb < num_boxes; ++bb) {
...
const int64 min_box_row = static_cast<float>(tboxes(b, bb, 0)) * (height - 1);
const int64 max_box_row = static_cast<float>(tboxes(b, bb, 2)) * (height - 1);
const int64 min_box_col = static_cast<float>(tboxes(b, bb, 1)) * (width - 1);
const int64 max_box_col = static_cast<float>(tboxes(b, bb, 3)) * (width - 1);
...
}
If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices.
Patches
We have patched the issue in GitHub commit 79865b542f9ffdc9caeb255631f7c56f1d4b6517.
The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
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.
- Record
GHSA-whr9-vfh2-7hm6- CVSS 4.0
- 2.0 Low
CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N - CVSS 3.1
- 4.5 Medium
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L - Weakness
- CWE-787
- Updated
- 2026-11-02
Show 4 moreShow less
OSVBIT-tensorflow-2021-29571 No score
Memory corruption in `DrawBoundingBoxesV2`
TensorFlow is an end-to-end open source platform for machine learning. The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
- Record
BIT-tensorflow-2021-29571- Updated
- 2026-11-02
OSVPYSEC-2021-208 No score
TensorFlow is an end-to-end open source platform for machine learning. The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
- Record
PYSEC-2021-208- Updated
- 2026-11-02
OSVPYSEC-2021-499 No score
TensorFlow is an end-to-end open source platform for machine learning. The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
- Record
PYSEC-2021-499- Updated
- 2026-11-02
OSVPYSEC-2021-697 No score
TensorFlow is an end-to-end open source platform for machine learning. The implementation of tf.raw_ops.MaxPoolGradWithArgmax can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of boxes input is 4, as required by the op. Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in boxes is less than 4, accesses similar to tboxes(b, bb, 3) will access data outside of bounds. Further during code execution there are also writes to these indices. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
- Record
PYSEC-2021-697- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
tensorflowPyPI |
before 2.1.4 | 2.1.4 |
tensorflowPyPI |
2.2.0 up to 2.2.3 | 2.2.3 |
tensorflowPyPI |
2.3.0 up to 2.3.3 | 2.3.3 |
tensorflowPyPI |
2.4.0 up to 2.4.2 | 2.4.2 |
tensorflow-cpuPyPI |
before 2.1.4 | 2.1.4 |
tensorflow-cpuPyPI |
2.2.0 up to 2.2.3 | 2.2.3 |
tensorflow-cpuPyPI |
2.3.0 up to 2.3.3 | 2.3.3 |
tensorflow-cpuPyPI |
2.4.0 up to 2.4.2 | 2.4.2 |
tensorflow-gpuPyPI |
before 2.1.4 | 2.1.4 |
tensorflow-gpuPyPI |
2.2.0 up to 2.2.3 | 2.2.3 |
Show 18 moreShow less
| Package | Affected | Fixed |
|---|---|---|
tensorflow-gpuPyPI |
2.3.0 up to 2.3.3 | 2.3.3 |
tensorflow-gpuPyPI |
2.4.0 up to 2.4.2 | 2.4.2 |
tensorflowBitnami |
before 2.1.4, 2.2.0 up to 2.2.3, 2.3.0 up to 2.3.3, 2.4.0 up to 2.4.2 | 2.1.42.2.32.3.32.4.2 |
tensorflowPyPI |
before 2.1.4, plus listed versions 0.12.00.12.11.0.01.0.11.1.0 Show 35 moreShow less1.10.01.10.11.11.01.12.01.12.21.12.31.13.11.13.21.14.01.15.01.15.21.15.31.15.41.15.51.2.01.2.11.3.01.4.01.4.11.5.01.5.11.6.01.7.01.7.11.8.01.9.02.0.02.0.12.0.22.0.32.0.42.1.02.1.12.1.22.1.3 |
2.1.4 |
tensorflowPyPI |
2.2.0 up to 2.2.3, plus listed versions 2.2.12.2.2 |
2.2.3 |
tensorflowPyPI |
2.3.0 up to 2.3.3, plus listed versions 2.3.12.3.2 |
2.3.3 |
tensorflowPyPI |
2.4.0 up to 2.4.2, plus listed versions 2.4.1 |
2.4.2 |
tensorflow-cpuPyPI |
before 2.1.4, plus listed versions 1.15.02.1.02.1.12.1.22.1.3 |
2.1.4 |
tensorflow-cpuPyPI |
2.2.0 up to 2.2.3, plus listed versions 2.2.12.2.2 |
2.2.3 |
tensorflow-cpuPyPI |
2.3.0 up to 2.3.3, plus listed versions 2.3.12.3.2 |
2.3.3 |
tensorflow-cpuPyPI |
2.4.0 up to 2.4.2, plus listed versions 2.4.1 |
2.4.2 |
tensorflow-gpuPyPI |
before 2.1.4, plus listed versions 0.12.00.12.11.0.01.0.11.1.0 Show 35 moreShow less1.10.01.10.11.11.01.12.01.12.21.12.31.13.11.13.21.14.01.15.01.15.21.15.31.15.41.15.51.2.01.2.11.3.01.4.01.4.11.5.01.5.11.6.01.7.01.7.11.8.01.9.02.0.02.0.12.0.22.0.32.0.42.1.02.1.12.1.22.1.3 |
2.1.4 |
tensorflow-gpuPyPI |
2.2.0 up to 2.2.3, plus listed versions 2.2.12.2.2 |
2.2.3 |
tensorflow-gpuPyPI |
2.3.0 up to 2.3.3, plus listed versions 2.3.12.3.2 |
2.3.3 |
tensorflow-gpuPyPI |
2.4.0 up to 2.4.2, plus listed versions 2.4.1 |
2.4.2 |
tensorflowPyPI |
before 2.2.0rc0, 2.2.0 up to 2.3.0rc0, 2.3.0 up to 2.3.4, 2.4.0 up to 2.4.3, plus listed versions 0.12.00.12.0rc00.12.0rc10.12.11.0.0 Show 45 moreShow less1.0.11.1.01.1.0rc01.1.0rc11.1.0rc21.10.01.10.0rc01.10.0rc11.10.11.11.01.11.0rc01.11.0rc11.11.0rc21.12.01.12.0rc01.12.0rc11.12.0rc21.12.21.12.31.13.0rc01.13.0rc11.13.0rc21.13.11.13.21.14.01.14.0rc01.14.0rc11.15.01.15.0rc01.15.0rc11.15.0rc21.15.0rc31.15.21.15.31.15.41.15.51.2.01.2.0rc01.2.0rc11.2.0rc21.2.11.3.01.3.0rc01.3.0rc11.3.0rc2 |
2.2.0rc02.3.0rc02.3.42.4.3 |
tensorflow-cpuPyPI |
before 2.2.0rc0, 2.2.0 up to 2.3.0rc0, 2.3.0 up to 2.3.4, 2.4.0 up to 2.4.3, plus listed versions 1.15.02.1.02.1.12.1.22.1.3 Show 9 moreShow less2.1.42.2.12.2.22.2.32.3.12.3.22.3.32.4.12.4.2 |
2.2.0rc02.3.0rc02.3.42.4.3 |
tensorflow-gpuPyPI |
before 2.2.0rc0, 2.2.0 up to 2.3.0rc0, 2.3.0 up to 2.3.4, 2.4.0 up to 2.4.3, plus listed versions 0.12.00.12.11.0.01.0.11.1.0 Show 44 moreShow less1.10.01.10.11.11.01.12.01.12.21.12.31.13.11.13.21.14.01.15.01.15.21.15.31.15.41.15.51.2.01.2.11.3.01.4.01.4.11.5.01.5.11.6.01.7.01.7.11.8.01.9.02.0.02.0.12.0.22.0.32.0.42.1.02.1.12.1.22.1.32.1.42.2.12.2.22.2.32.3.12.3.22.3.32.4.12.4.2 |
2.2.0rc02.3.0rc02.3.42.4.3 |
History
| Recorded | Changed | Sources |
|---|---|---|
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-29571 is a medium vulnerability (CVSS 4.5) in Google Tensorflow, published May 14, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.24%, the 15th percentile. Fixed in tensorflow 2.1.4.
References
github.com/tensorflow/tensorflow/security/advisories/GHSA-whr9-vfh2-7hm6
github.com/tensorflow/tensorflow/commit/79865b542f9ffdc9caeb255631f7c56f1d4b6517
nvd.nist.gov/vuln/detail/CVE-2021-29571
github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-499.yaml
github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-697.yaml
github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-208.yaml
github.com/advisories/GHSA-whr9-vfh2-7hm6
github.com/tensorflow/tensorflow
Left out here: 49 versions. The JSON record has them.