Skip to content
HighVulnerability

CVE-2021-37657: TensorFlow undefined behavior from null reference in MatrixDiagV operations

Identifier
CVE-2021-37657
Published
Record updated
View JSON
Affected
  • tensorflow < 2.3.4, fixed in 2.3.4, released August 10, 2021, 3 days before disclosure
  • tensorflow >= 2.4.0, < 2.4.3, fixed in 2.4.3, released August 10, 2021, 3 days before disclosure
  • tensorflow = 2.5.0, fixed in 2.5.1, released August 10, 2021, 3 days before disclosure
  • and 6 more
Known exploitation
Not listed in the CISA Known Exploited Vulnerabilities catalog at the last check.
EPSS
0.2%

Summary

CVE-2021-37657 affects TensorFlow versions in which all operations of type `tf.raw_ops.MatrixDiagV*` bind a reference to a null pointer. The implementation in `matrix_diag_op.cc` checks that the `k` value is a scalar or a vector but does not check its number of elements, so an empty tensor causes code that reads the first element to fail, leading to undefined behavior triggered by an attacker.

Mitigation

Patched in GitHub commit f2a673bd34f0d64b8e40a551ac78989d16daad09. The fix will be included in TensorFlow 2.6.0 and cherry-picked to TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4.