Skip to content
Heist/ feed
Back to feed
Medium

Security advisory

Type: advisorySources: OSVCVE: CVE-2021-37692

TensorFlow is an end-to-end open source platform for machine learning. In affected versions under certain conditions, Go code can trigger a segfault in string deallocation. For string tensors, `C.TF_TString_Dealloc` is called during garbage collection within a finalizer function. However, tensor structure isn't checked until encoding to avoid a performance penalty. The current method for dealloc assumes that encoding succeeded, but segfaults when a string tensor is garbage collected whose encoding failed (e.g., due to mismatched dimensions). To fix this, the call to set the finalizer function is deferred until `NewTensor` returns and, if encoding failed for a string tensor, deallocs are determined based on bytes written. We have patched the issue in GitHub commit 8721ba96e5760c229217b594f6d2ba332beedf22. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, which is the other affected version.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2021-37692
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 11:25 UTC · Revision 1

Source evidence

CVE-2021-37692

core-osv · Original source

Published 12 Aug 2021, 23:15 UTC

TensorFlow is an end-to-end open source platform for machine learning. In affected versions under certain conditions, Go code can trigger a segfault in string deallocation. For string tensors, `C.TF_TString_Dealloc` is called during garbage collection within a finalizer function. However, tensor structure isn't checked until encoding to avoid a performance penalty. The current method for dealloc assumes that encoding succeeded, but segfaults when a string tensor is garbage collected whose encoding failed (e.g., due to mismatched dimensions). To fix this, the call to set the finalizer function is deferred until `NewTensor` returns and, if encoding failed for a string tensor, deallocs are determined based on bytes written. We have patched the issue in GitHub commit 8721ba96e5760c229217b594f6d2ba332beedf22. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, which is the other affected version.

osv:CVE-2021-37692
Complete source record
{
  "id": "11530d3d851034813ee4e662ec72154c8a80536872f79f135b7a72d1f4f51281",
  "url": "https://osv.dev/vulnerability/CVE-2021-37692",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CVE-2021-37692",
    "summary": "TensorFlow is an end-to-end open source platform for machine learning. In affected versions under certain conditions, Go code can trigger a segfault in string deallocation. For string tensors, `C.TF_TString_Dealloc` is called during garbage collection within a finalizer function. However, tensor structure isn't checked until encoding to avoid a performance penalty. The current method for dealloc assumes that encoding succeeded, but segfaults when a string tensor is garbage collected whose encoding failed (e.g., due to mismatched dimensions). To fix this, the call to set the finalizer function is deferred until `NewTensor` returns and, if encoding failed for a string tensor, deallocs are determined based on bytes written. We have patched the issue in GitHub commit 8721ba96e5760c229217b594f6d2ba332beedf22. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, which is the other affected version.",
    "evidence": "osv:CVE-2021-37692",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2021-37692",
      "aliases": [
        "BIT-tensorflow-2021-37692",
        "CVE-2021-37692",
        "GHSA-cmgw-8vpc-rc59",
        "PYSEC-2021-314",
        "PYSEC-2021-605",
        "PYSEC-2021-803"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/tensorflow/tensorflow",
              "type": "GIT",
              "events": [
                {
                  "introduced": "a4dfb8d1a71385bd6d122e4f27f86dcebb96712d"
                },
                {
                  "fixed": "919f693420e35d00c8d0a42100837ae3718f7927"
                },
                {
                  "fixed": "8721ba96e5760c229217b594f6d2ba332beedf22"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.5.0"
                      },
                      {
                        "fixed": "2.6.0"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "8721ba96e5760c229217b594f6d2ba332beedf22"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-37692.json"
          }
        }
      ],
      "modified": "2026-10-20T10:54:17.978643593Z",
      "provider": "osv",
      "references": [
        "https://github.com/tensorflow/tensorflow/security/advisories/GHSA-cmgw-8vpc-rc59",
        "https://github.com/tensorflow/tensorflow/commit/8721ba96e5760c229217b594f6d2ba332beedf22",
        "https://github.com/tensorflow/tensorflow/pull/50508"
      ],
      "provider_metadata": {}
    },
    "related_cves": [
      {
        "value": "CVE-2021-37692",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 384997,
  "published_at": "2021-08-12T23:15:08.967+00:00"
}