
Cloud Vulnerability DB
A community-led vulnerabilities database
TensorFlow, an end-to-end open source platform for machine learning, was found to have a vulnerability (CVE-2021-29521) where specifying a negative dense shape in tf.raw_ops.SparseCountSparseOutput results in a segmentation fault. The vulnerability was discovered in versions >2.3.0 and <2.5.0, and was patched in versions 2.3.3 and 2.4.2. The issue was reported by Yakun Zhang and Ying Wang of Baidu X-Team (GitHub Advisory).
The vulnerability occurs because the implementation assumes the first element of the dense shape is always positive and uses it to initialize a BatchedMap (i.e., std::vector) data structure. If the shape tensor has more than one element, num_batches is the first value in shape. When a negative dense shape is provided, it breaks std::vector invariants, leading to a segmentation fault. The issue can be triggered by providing negative values in the dense_shape argument (GitHub Advisory, TF Commit).
The vulnerability results in a segmentation fault being thrown from the standard library when exploited, which can lead to application crashes. This could potentially be used to cause denial of service in applications using the affected TensorFlow versions (GitHub Advisory).
The vulnerability can be exploited by providing specially crafted input with negative values in the dense_shape argument to the tf.raw_ops.SparseCountSparseOutput operation. A proof of concept exists that demonstrates the vulnerability using empty tensors and negative dense shape values (GitHub Advisory).
The issue has been patched in TensorFlow versions 2.3.3, 2.4.2, and 2.5.0. The fix ensures that the dense_shape argument is a valid tensor shape by validating that all elements are non-negative. Users are advised to upgrade to these patched versions to mitigate the vulnerability (GitHub Advisory).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."