LiveActive security incident?Get immediate response
CVE Record

CVE-2021-37678: Arbitrary code execution due to YAML deserialization

TensorFlow is an end-to-end open source platform for machine learning. In affected versions TensorFlow and Keras can be tricked to perform arbitrary code execution when deserializing a Keras model from YAML format. The [implementation](https://github.com/tensorflow/tensorflow/blob/460e000de3a83278fb00b61a16d161b1964f15f4/tensorflow/python/keras/saving/model_config.py#L66-L104) uses `yaml.unsafe_load` which can perform arbitrary code execution on the input. Given that YAML format support requires a significant amount of work, we have removed it for now. We have patched the issue in GitHub commit 23d6383eb6c14084a8fc3bdf164043b974818012. 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.

CriticalCVSS 9.3Not KEV-listedUpdated
Glexia's TakeAutomated analysiscritical

Security readout for executives and security teams

Plain-English summary

A malicious Keras model saved in YAML format could make affected TensorFlow/Keras versions run arbitrary code during loading. The business risk is highest where ML teams import models, templates, or artifacts from third parties, shared storage, or automated pipelines without trust controls.

Executive priority

Treat this as high-priority for ML platforms handling shared or third-party model artifacts. It enables code execution with high impact, but urgency should be highest where YAML Keras models are loaded from sources that are not fully trusted.

Technical view

CVE-2021-37678 is a CWE-502 unsafe deserialization issue. TensorFlow/Keras used yaml.unsafe_load while deserializing Keras YAML model configuration, allowing arbitrary code execution from crafted input. The vendor removed YAML format support and patched via commit 23d6383eb6c14084a8fc3bdf164043b974818012, with fixed releases planned for 2.6.0 and supported backports.

Likely exposure

Exposure is likely in Python ML environments using TensorFlow/Keras versions before 2.6.0, 2.5.1, 2.4.3, or 2.3.4, especially where YAML model files are loaded. Internet-facing exposure is not established by the sources; the CVSS vector lists local attack vector.

Exploitation context

The provided sources do not show active exploitation, and the CVE is not marked KEV. Exploitation requires an affected environment to deserialize a crafted Keras model from YAML. The practical risk depends on model artifact provenance and whether untrusted YAML models are accepted.

Researcher notes

The key evidence is the vendor advisory: yaml.unsafe_load was used in Keras model_config YAML deserialization, and YAML support was removed as the fix. Validate affected branches against the stated version ranges and commit rather than assuming all TensorFlow deployments are reachable.

Mitigation direction

  • Upgrade TensorFlow to 2.6.0 or the supported fixed backport for your branch.
  • Stop loading Keras models from YAML in affected environments.
  • Restrict model artifact sources to trusted repositories and controlled pipelines.
  • Check TensorFlow vendor guidance before relying on alternate mitigations.

Validation and detection

  • Inventory TensorFlow and Keras versions across notebooks, training jobs, APIs, and batch workers.
  • Identify code paths or workflows that deserialize Keras models from YAML.
  • Review ML artifact stores for externally supplied or untrusted YAML model files.
  • Confirm upgraded environments no longer rely on vulnerable YAML deserialization support.
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 · medium confidence lookup

CWE-502: Code execution behavior lookup

Code execution and unsafe deserialization weaknesses often justify reviewing execution behavior and process telemetry. 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
description · low confidence lookup

Execution behavior lookup

The CVE wording references code or command execution, so execution technique review may help defensive triage. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2021-37678 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
Critical
CVSS
9.3 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/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
9.3CVSS 3.1CriticalCVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H2.56Primary CVE score

Vulnerability scoring details

Base CVSS 3.1 score

9.3Critical
CVSS 3.1 vector shape for CVE-2021-37678Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/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-502 · source CWE mapping

Deserialization of Untrusted Data

Deserialization of Untrusted Data represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.