CVE-2021-37658
Python vulnerability analysis and mitigation

Overview

TensorFlow, an end-to-end open source platform for machine learning, contained a vulnerability in the MatrixSetDiagV* operations prior to versions 2.6.0, 2.5.1, 2.4.3, and 2.3.4. The vulnerability (CVE-2021-37658) was discovered and disclosed on August 11, 2021, affecting the input validation mechanism of diagonal matrix operations (GitHub Advisory).

Technical details

The vulnerability stems from incomplete validation of the 'k' parameter tensor in MatrixSetDiagV* operations. While the code checks if the value is a scalar or vector, it fails to verify the number of elements. This oversight can lead to undefined behavior when accessing the first element of an empty tensor through the statement 'lower_diag_index = diag_index.flat()(0)', potentially resulting in a null pointer dereference (GitHub Advisory).

Impact

An attacker can trigger undefined behavior by providing an empty tensor as the 'k' parameter in MatrixSetDiagV* operations. This can be exploited through code such as 'tf.raw_ops.MatrixSetDiagV3(input=[1,2,3], diagonal=[1,1], k=[], align='RIGHT_LEFT')' (GitHub Advisory).

Mitigation and workarounds

The issue has been patched in TensorFlow version 2.6.0 and backported to versions 2.5.1, 2.4.3, and 2.3.4. The fix adds validation to ensure the diag_index tensor has at least one element. Users are recommended to upgrade to these patched versions (GitHub Advisory).

Community reactions

The vulnerability was reported by members of the Aivul Team from Qihoo 360, demonstrating ongoing security research in the machine learning framework ecosystem (GitHub Advisory).

Additional resources


SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-5882-5rx9-xgxpCRITICAL10
  • PythonPython
  • crawl4ai
NoYesJan 16, 2026
GHSA-vx9w-5cx4-9796HIGH8.6
  • PythonPython
  • crawl4ai
NoYesJan 16, 2026
CVE-2026-23535HIGH8
  • PythonPython
  • wlc
NoYesJan 16, 2026
CVE-2026-23490HIGH7.5
  • PythonPython
  • pyasn1
NoYesJan 16, 2026
CVE-2026-23528MEDIUM5.3
  • PythonPython
  • distributed
NoYesJan 16, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management