CVE-2021-29533: Tensorflow CHECK-fail Vulnerability
LOWCVE-2021-29533 is a LOW (CVSS 2.5) check-fail vulnerability (CWE-754: Improper Check for Unusual or Exceptional Conditions) affecting Tensorflow libraries in the PyPI ecosystem. The issue involves check-fail in drawboundingboxes. Remediation is available by upgrading affected packages to version 2.1.4, 2.2.3, 2.3.3, 2.4.2.
CVE-2021-29533 at a Glance
Security Impact
CVSS: 2.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2021-29533
To remediate this vulnerability, upgrade all affected Tensorflow dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install tensorflow>=2.1.4
pip install tensorflow>=2.2.3
pip install tensorflow>=2.3.3
pip install tensorflow>=2.4.2
pip install tensorflow-cpu>=2.1.4
pip install tensorflow-cpu>=2.2.3
pip install tensorflow-cpu>=2.3.3
pip install tensorflow-cpu>=2.4.2
pip install tensorflow-gpu>=2.1.4
pip install tensorflow-gpu>=2.2.3
pip install tensorflow-gpu>=2.3.3
pip install tensorflow-gpu>=2.4.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show tensorflow
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-29533, inspect your installed packages using pip:
pip show tensorflow
Analyze the terminal output to locate any version of Tensorflow in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.4), your application is affected.
Note: The pip show tensorflow command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-754: Improper Check for Unusual or Exceptional Conditions, where the product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product. In Tensorflow, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-29533 Affected Tensorflow Versions
12 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
tensorflow
|
PyPI |
< 2.1.4
|
2.1.4
|
|
tensorflow
|
PyPI |
≥ 2.2.0
< 2.2.3
|
2.2.3
|
|
tensorflow
|
PyPI |
≥ 2.3.0
< 2.3.3
|
2.3.3
|
|
tensorflow
|
PyPI |
≥ 2.4.0
< 2.4.2
|
2.4.2
|
|
tensorflow-cpu
|
PyPI |
< 2.1.4
|
2.1.4
|
|
tensorflow-cpu
|
PyPI |
≥ 2.2.0
< 2.2.3
|
2.2.3
|
|
tensorflow-cpu
|
PyPI |
≥ 2.3.0
< 2.3.3
|
2.3.3
|
|
tensorflow-cpu
|
PyPI |
≥ 2.4.0
< 2.4.2
|
2.4.2
|
|
tensorflow-gpu
|
PyPI |
< 2.1.4
|
2.1.4
|
|
tensorflow-gpu
|
PyPI |
≥ 2.2.0
< 2.2.3
|
2.2.3
|
|
tensorflow-gpu
|
PyPI |
≥ 2.3.0
< 2.3.3
|
2.3.3
|
|
tensorflow-gpu
|
PyPI |
≥ 2.4.0
< 2.4.2
|
2.4.2
|
References
Frequently Asked Questions
What is CVE-2021-29533?
Which Tensorflow versions are affected?
What version fixes CVE-2021-29533?
Is tensorflow affected?
Is tensorflow-cpu affected?
What is the CVSS score of CVE-2021-29533?
What CWE is associated with CVE-2021-29533?
How can I check PyPI dependencies for CVE-2021-29533?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-393f-2jr3-cp69",
"modified" : "2024-10-30T23:22:16Z",
"published" : "2021-05-21T14:22:21Z",
"aliases" : [ "CVE-2021-29533" ],
"summary" : "CHECK-fail in DrawBoundingBoxes",
"details" : "### Impact\nAn attacker can trigger a denial of service via a `CHECK` failure by passing an empty image to `tf.raw_ops.DrawBoundingBoxes`:\n\n```python\nimport tensorflow as tf\n\nimages = tf.fill([53, 0, 48, 1], 0.)\nboxes = tf.fill([53, 31, 4], 0.)\nboxes = tf.Variable(boxes)\nboxes[0, 0, 0].assign(3.90621)\ntf.raw_ops.DrawBoundingBoxes(images=images, boxes=boxes)\n```\n\nThis is because the [implementation](https://github.com/tensorflow/tensorflow/blob/ea34a18dc3f5c8d80a40ccca1404f343b5d55f91/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L148-L165) uses `CHECK_*` assertions instead of `OP_REQUIRES` to validate user controlled inputs. Whereas `OP_REQUIRES` allows returning an error condition back to the user, the `CHECK_*` macros result in a crash if the condition is false, similar to `assert`.\n\n```cc\nconst int64 max_box_row_clamp = std::min<int64>(max_box_row, height - 1);\n... \nCHECK_GE(max_box_row_clamp, 0);\n``` \n \nIn this case, `height` is 0 from the `images` input. This results in `max_box_row_clamp` being negative and the assertion being falsified, followed by aborting program execution.\n \n### Patches\nWe have patched the issue in GitHub commit [b432a38fe0e1b4b904a6c222cbce794c39703e87](https://github.com/tensorflow/tensorflow/commit/b432a38fe0e1b4b904a6c222cbce794c39703e87).\n\nThe 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.\n\n### For more information\nPlease consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.\n\n### Attribution\nThis vulnerability has been reported by Yakun Zhang and Ying Wang of Baidu X-Team.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.1.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.2.0"
}, {
"fixed" : "2.2.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.3.0"
}, {
"fixed" : "2.3.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.4.0"
}, {
"fixed" : "2.4.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.1.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.2.0"
}, {
"fixed" : "2.2.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.3.0"
}, {
"fixed" : "2.3.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.4.0"
}, {
"fixed" : "2.4.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.1.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.2.0"
}, {
"fixed" : "2.2.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.3.0"
}, {
"fixed" : "2.3.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.4.0"
}, {
"fixed" : "2.4.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/security/advisories/GHSA-393f-2jr3-cp69"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29533"
}, {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/commit/b432a38fe0e1b4b904a6c222cbce794c39703e87"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-461.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-659.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-170.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/tensorflow/tensorflow"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-754" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2021-05-18T22:50:31Z",
"nvd_published_at" : "2021-05-14T20:15:00Z"
}
}