
Cloud Vulnerability DB
A community-led vulnerabilities database
TensorFlow's MatrixDiag* operations contained a vulnerability (CVE-2021-29515) discovered in May 2021. The vulnerability affected TensorFlow versions prior to 2.5.0, specifically impacting versions 2.1.x, 2.2.x, 2.3.x, and 2.4.x. The issue stemmed from the implementation's failure to validate that tensor arguments were non-empty, potentially leading to null pointer dereferences (GitHub Advisory).
The vulnerability existed in the implementation of MatrixDiag* operations where the code failed to validate tensor arguments before accessing them. The problematic code accessed tensor values directly without proper validation: num_rows = context->input(2).flat()(0); num_cols = context->input(3).flat()(0); padding_value = context->input(4).flat()(0). This implementation could lead to null pointer dereferences when empty tensors were provided as input. The vulnerability received a CVSS v3.1 base score of 2.5 (LOW) from GitHub, though NIST assigned it a higher score of 7.8 (HIGH) (NVD).
When exploited, this vulnerability could cause null pointer dereferences in TensorFlow applications. This could be triggered by providing empty tensors as input to the MatrixDiag* operations, potentially leading to application crashes and denial of service conditions (GitHub Advisory).
The vulnerability could be exploited by providing specially crafted inputs to the MatrixDiag* operations. A proof of concept exploit was demonstrated using Python code: import tensorflow as tf; d = tf.convert_to_tensor([],dtype=tf.float32); p = tf.convert_to_tensor([],dtype=tf.float32); tf.raw_ops.MatrixDiagV2(diagonal=d, k=0, num_rows=0, num_cols=0, padding_value=p). The issue could be reproduced using either MatrixDiagV2 or MatrixDiagV3 operations (GitHub Advisory).
The vulnerability was patched in TensorFlow 2.5.0 and backported to versions 2.4.2, 2.3.3, 2.2.3, and 2.1.4. The fix involved adding proper validation checks for tensor arguments before accessing them, as implemented in commit a7116dd3913c4a4afd2a3a938573aa7c785fdfc6 (GitHub Commit).
Fix availability across major Linux distributions and their releases.
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."