LiveActive security incident?Get immediate response
CVE Record

CVE-2021-37658: Reference binding to nullptr in `MatrixSetDiagV*` ops in TensorFlow

TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can cause undefined behavior via binding a reference to null pointer in all operations of type `tf.raw_ops.MatrixSetDiagV*`. The [implementation](https://github.com/tensorflow/tensorflow/blob/84d053187cb80d975ef2b9684d4b61981bca0c41/tensorflow/core/kernels/linalg/matrix_diag_op.cc) has incomplete validation that the value of `k` is a valid tensor. We have check that this value is either a scalar or a vector, but there is no check for the number of elements. If this is an empty tensor, then code that accesses the first element of the tensor is wrong. We have patched the issue in GitHub commit ff8894044dfae5568ecbf2ed514c1a37dc394f1b. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.

HighCVSS 7.1Not KEV-listedUpdated
Glexia's TakeAutomated analysishigh

Security readout for executives and security teams

Plain-English summary

Affected TensorFlow versions can mishandle malformed input to MatrixSetDiagV* operations, causing undefined behavior. Business impact is mainly reliability and integrity risk for ML workloads where a local or already authorized user can supply tensors or model logic.

Executive priority

Prioritize remediation for shared ML platforms, production inference/training systems, and environments accepting user-submitted notebooks or models. Lower priority for isolated systems without untrusted local users or submitted workloads.

Technical view

TensorFlow incompletely validates the k tensor in tf.raw_ops.MatrixSetDiagV* operations. An empty tensor can reach code that reads its first element, binding a reference to a null pointer. The source assigns CVSS 7.1 with local attack vector, low complexity, low privileges, no user interaction, and high integrity and availability impact.

Likely exposure

Exposure is most likely in applications, notebooks, pipelines, or services running affected TensorFlow versions and allowing local users or submitted ML code/data to invoke raw matrix diagonal operations.

Exploitation context

The supplied sources do not show active exploitation, and KEV is false. The CVSS vector indicates local, low-privilege exploitation with no user interaction, so multi-user ML environments and shared compute are higher concern.

Researcher notes

Evidence is limited to the TensorFlow advisory, CVE record, and fixing commit. Do not infer remote exploitability, broader TensorFlow operations, or public exploitation from the supplied material.

Mitigation direction

  • Upgrade TensorFlow to 2.6.0 or a patched supported branch release.
  • Use TensorFlow 2.5.1, 2.4.3, or 2.3.4 where those branches are required.
  • Review vendor advisory and commit before accepting alternative backports.
  • Limit untrusted ML code or tensor inputs until affected runtimes are upgraded.

Validation and detection

  • Inventory TensorFlow versions in applications, containers, notebooks, and dependency lockfiles.
  • Flag versions >=2.5.0 <2.5.1, >=2.4.0 <2.4.3, and <2.3.4.
  • Confirm workloads exposing tf.raw_ops.MatrixSetDiagV* are not reachable by untrusted users.
  • Verify the deployed package contains commit ff8894044dfae5568ecbf2ed514c1a37dc394f1b or a fixed release.
Prepared
Confidence
high
Sources
4

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · low confidence lookup

CWE-824: Exact CWE lookup

Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2021-37658 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
High
CVSS
7.1 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

1CVSS vectors
0Timeline events
0ADP providers
3Source links

CVSS vector scores

1 official score

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
7.1CVSS 3.1HighCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H1.85.2Primary CVE score

Vulnerability scoring details

Base CVSS 3.1 score

7.1High
CVSS 3.1 vector shape for CVE-2021-37658Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone
Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
tensorflowtensorflow>= 2.5.0, < 2.5.1, >= 2.4.0, < 2.4.3, < 2.3.4Listed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.

CWE-824 · source CWE mapping

Access of Uninitialized Pointer

Access of Uninitialized Pointer represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.