CVE-2020-5215: Tensorflow Segmentation Faultin TensorFlow When Converting Vulnerability

LOW
Advisory Identifier: GHSA-977j-xj7q-2jr9
CVSS 5.0
CWE-754
Published
Advisory Summary

CVE-2020-5215 is a LOW (CVSS 5.0) segmentation faultin tensorflow when converting vulnerability (CWE-754: Improper Check for Unusual or Exceptional Conditions) affecting Tensorflow libraries in the PyPI ecosystem. The issue involves segmentation faultin tensorflow when converting a python string to `tf.float16`. Remediation is available by upgrading affected packages to version 1.15.2, 2.0.1.

CVE-2020-5215 at a Glance

CVE Identifier CVE-2020-5215
GHSA Identifier GHSA-977j-xj7q-2jr9
Severity LOW
CVSS v3.1 Base Score 5.0
CWE Classification CWE-754: Improper Check for Unusual or Exceptional Conditions
Affected Product Tensorflow
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:L).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2020-5215

To remediate this vulnerability, upgrade all affected Tensorflow dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

tensorflow fixed: 1.15.2
pip install tensorflow>=1.15.2
tensorflow fixed: 2.0.1
pip install tensorflow>=2.0.1
tensorflow-cpu fixed: 1.15.2
pip install tensorflow-cpu>=1.15.2
tensorflow-cpu fixed: 2.0.1
pip install tensorflow-cpu>=2.0.1
tensorflow-gpu fixed: 1.15.2
pip install tensorflow-gpu>=1.15.2
tensorflow-gpu fixed: 2.0.1
pip install tensorflow-gpu>=2.0.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show tensorflow

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2020-5215, inspect your installed packages using pip:

pip show tensorflow

Analyze the terminal output to locate any version of Tensorflow in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.15.2), your application is affected.

Note: The pip show tensorflow command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-754: Improper Check for Unusual or Exceptional Conditions, where the product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product. In Tensorflow, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Converting a string (from Python) to a `tf.float16` value results in a segmentation fault in eager mode as the format checks for this use case are only in the graph mode. This issue can lead to denial of service in inference/training where a malicious attacker can send a data point which contains a string instead of a `tf.float16` value. Similar effects can be obtained by manipulating saved models and checkpoints whereby replacing a scalar `tf.float16` value with a scalar string will trigger this issue due to automatic conversions. This can be easily reproduced by `tf.constant("hello", tf.float16)`, if eager execution is enabled. ### Patches We have patched the vulnerability in GitHub commit [5ac1b9](https://github.com/tensorflow/tensorflow/commit/5ac1b9e24ff6afc465756edf845d2e9660bd34bf). We are additionally releasing TensorFlow 1.15.1 and 2.0.1 with this vulnerability patched. TensorFlow 2.1.0 was released after we fixed the issue, thus it is not affected. We encourage users to switch to TensorFlow 1.15.1, 2.0.1 or 2.1.0. ### For more information Please consult [`SECURITY.md`](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.

CVE-2020-5215 Affected Tensorflow Versions

6 component(s)
Fixed Versions:
1.15.22.0.1
Product / Package Ecosystem Affected Versions Fixed Version
tensorflow
PyPI
< 1.15.2
1.15.2
tensorflow
PyPI
≥ 2.0.0
< 2.0.1
All 1 versions
2.0.0
2.0.1
tensorflow-cpu
PyPI
< 1.15.2
1.15.2
tensorflow-cpu
PyPI
≥ 2.0.0
< 2.0.1
All 1 versions
2.0.0
2.0.1
tensorflow-gpu
PyPI
< 1.15.2
1.15.2
tensorflow-gpu
PyPI
≥ 2.0.0
< 2.0.1
All 1 versions
2.0.0
2.0.1

References

Frequently Asked Questions

What is CVE-2020-5215?
CVE-2020-5215 is a security vulnerability in Tensorflow involving Segmentation faultin TensorFlow when converting a Python string to `tf.float16` under CWE-754: Improper Check for Unusual or Exceptional Conditions.
Which Tensorflow versions are affected?
Affected versions include releases prior to 1.15.2, 2.0.1 across affected packages: tensorflow, tensorflow-cpu, tensorflow-gpu.
What version fixes CVE-2020-5215?
Upgrading to 1.15.2, 2.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tensorflow affected?
Yes, tensorflow is affected in releases prior to 1.15.2, 2.0.1. Upgrade your dependency to 1.15.2, 2.0.1 or later.
Is tensorflow-cpu affected?
Yes, tensorflow-cpu is affected in releases prior to 1.15.2, 2.0.1. Upgrade your dependency to 1.15.2, 2.0.1 or later.
What is the CVSS score of CVE-2020-5215?
CVE-2020-5215 has a CVSS v3.1 base score of 5.0 (LOW) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:L.
What CWE is associated with CVE-2020-5215?
CVE-2020-5215 is classified under CWE-754: Improper Check for Unusual or Exceptional Conditions (The product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product.).
How can I check PyPI dependencies for CVE-2020-5215?
Run the dependency tree command: 'pip show tensorflow'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-977j-xj7q-2jr9",
  "modified" : "2024-10-30T21:27:16Z",
  "published" : "2020-01-28T21:32:29Z",
  "aliases" : [ "CVE-2020-5215" ],
  "summary" : "Segmentation faultin TensorFlow when converting a Python string to `tf.float16`",
  "details" : "### Impact\n\nConverting a string (from Python) to a `tf.float16` value results in a segmentation fault in eager mode as the format checks for this use case are only in the graph mode.\n\nThis issue can lead to denial of service in inference/training where a malicious attacker can send a data point which contains a string instead of a `tf.float16` value.\n\nSimilar effects can be obtained by manipulating saved models and checkpoints whereby replacing a scalar `tf.float16` value with a scalar string will trigger this issue due to automatic conversions.\n\nThis can be easily reproduced by `tf.constant(\"hello\", tf.float16)`, if eager execution is enabled.\n\n### Patches\nWe have patched the vulnerability in GitHub commit [5ac1b9](https://github.com/tensorflow/tensorflow/commit/5ac1b9e24ff6afc465756edf845d2e9660bd34bf).\n\nWe are additionally releasing TensorFlow 1.15.1 and 2.0.1 with this vulnerability patched.\n\nTensorFlow 2.1.0 was released after we fixed the issue, thus it is not affected.\n\nWe encourage users to switch to TensorFlow 1.15.1, 2.0.1 or 2.1.0.\n\n### For more information\n\nPlease consult [`SECURITY.md`](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:L/VI:L/VA:L/SC:L/SI:L/SA:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "tensorflow"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.15.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "tensorflow"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.1"
      } ]
    } ],
    "versions" : [ "2.0.0" ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "tensorflow-cpu"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.15.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "tensorflow-cpu"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.1"
      } ]
    } ],
    "versions" : [ "2.0.0" ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "tensorflow-gpu"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.15.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "tensorflow-gpu"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.1"
      } ]
    } ],
    "versions" : [ "2.0.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tensorflow/tensorflow/security/advisories/GHSA-977j-xj7q-2jr9"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-5215"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tensorflow/tensorflow/commit/5ac1b9e24ff6afc465756edf845d2e9660bd34bf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2020-303.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2020-338.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2020-258.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tensorflow/tensorflow"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tensorflow/tensorflow/releases/tag/v1.15.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tensorflow/tensorflow/releases/tag/v2.0.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-754" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-01-28T21:24:08Z",
    "nvd_published_at" : null
  }
}