CVE-2021-29590: Tensorflow Heap OOB Read Vulnerability
LOWCVE-2021-29590 is a LOW (CVSS 2.5) heap oob read vulnerability (CWE-125: Out-of-bounds Read) affecting Tensorflow libraries in the PyPI ecosystem. The issue involves heap oob read in tflite's implementation of `minimum` or `maximum`. Remediation is available by upgrading affected packages to version 2.1.4, 2.2.3, 2.3.3, 2.4.2.
CVE-2021-29590 at a Glance
Security Impact
CVSS: 2.5
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:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2021-29590
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.
pip install tensorflow>=2.1.4
pip install tensorflow>=2.2.3
pip install tensorflow>=2.3.3
pip install tensorflow>=2.4.2
pip install tensorflow-cpu>=2.1.4
pip install tensorflow-cpu>=2.2.3
pip install tensorflow-cpu>=2.3.3
pip install tensorflow-cpu>=2.4.2
pip install tensorflow-gpu>=2.1.4
pip install tensorflow-gpu>=2.2.3
pip install tensorflow-gpu>=2.3.3
pip install tensorflow-gpu>=2.4.2
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-2021-29590, 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 2.1.4), 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-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. 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
CVE-2021-29590 Affected Tensorflow Versions
12 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
tensorflow
|
PyPI |
< 2.1.4
|
2.1.4
|
|
tensorflow
|
PyPI |
≥ 2.2.0
< 2.2.3
|
2.2.3
|
|
tensorflow
|
PyPI |
≥ 2.3.0
< 2.3.3
|
2.3.3
|
|
tensorflow
|
PyPI |
≥ 2.4.0
< 2.4.2
|
2.4.2
|
|
tensorflow-cpu
|
PyPI |
< 2.1.4
|
2.1.4
|
|
tensorflow-cpu
|
PyPI |
≥ 2.2.0
< 2.2.3
|
2.2.3
|
|
tensorflow-cpu
|
PyPI |
≥ 2.3.0
< 2.3.3
|
2.3.3
|
|
tensorflow-cpu
|
PyPI |
≥ 2.4.0
< 2.4.2
|
2.4.2
|
|
tensorflow-gpu
|
PyPI |
< 2.1.4
|
2.1.4
|
|
tensorflow-gpu
|
PyPI |
≥ 2.2.0
< 2.2.3
|
2.2.3
|
|
tensorflow-gpu
|
PyPI |
≥ 2.3.0
< 2.3.3
|
2.3.3
|
|
tensorflow-gpu
|
PyPI |
≥ 2.4.0
< 2.4.2
|
2.4.2
|
References
Frequently Asked Questions
What is CVE-2021-29590?
Which Tensorflow versions are affected?
What version fixes CVE-2021-29590?
Is tensorflow affected?
Is tensorflow-cpu affected?
What is the CVSS score of CVE-2021-29590?
What CWE is associated with CVE-2021-29590?
How can I check PyPI dependencies for CVE-2021-29590?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-24x6-8c7m-hv3f",
"modified" : "2024-11-13T22:50:24Z",
"published" : "2021-05-21T14:26:53Z",
"aliases" : [ "CVE-2021-29590" ],
"summary" : "Heap OOB read in TFLite's implementation of `Minimum` or `Maximum`",
"details" : "### Impact\nThe implementations of the `Minimum` and `Maximum` TFLite operators can be used to read data outside of bounds of heap allocated objects, if any of the two input tensor arguments are empty.\n\nThis is because [the broadcasting implementation](https://github.com/tensorflow/tensorflow/blob/0d45ea1ca641b21b73bcf9c00e0179cda284e7e7/tensorflow/lite/kernels/internal/reference/maximum_minimum.h#L52-L56) indexes in both tensors with the same index but does not validate that the index is within bounds:\n\n```cc\nauto maxmin_func = [&](int indexes[N]) {\n output_data[SubscriptToIndex(output_desc, indexes)] =\n op(input1_data[SubscriptToIndex(desc1, indexes)],\n input2_data[SubscriptToIndex(desc2, indexes)]);\n};\n```\n\n### Patches\nWe have patched the issue in GitHub commit [953f28dca13c92839ba389c055587cfe6c723578](https://github.com/tensorflow/tensorflow/commit/953f28dca13c92839ba389c055587cfe6c723578).\n\nThe fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.\n\n### For more information\nPlease consult [our security guide](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.\n\n### Attribution\nThis vulnerability has been reported by members of the Aivul Team from Qihoo 360.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.1.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.2.0"
}, {
"fixed" : "2.2.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.3.0"
}, {
"fixed" : "2.3.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.4.0"
}, {
"fixed" : "2.4.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.1.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.2.0"
}, {
"fixed" : "2.2.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.3.0"
}, {
"fixed" : "2.3.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-cpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.4.0"
}, {
"fixed" : "2.4.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.1.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.2.0"
}, {
"fixed" : "2.2.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.3.0"
}, {
"fixed" : "2.3.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "tensorflow-gpu"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.4.0"
}, {
"fixed" : "2.4.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/security/advisories/GHSA-24x6-8c7m-hv3f"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29590"
}, {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/commit/953f28dca13c92839ba389c055587cfe6c723578"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-518.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-716.yaml"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-227.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/tensorflow/tensorflow"
}, {
"type" : "WEB",
"url" : "https://github.com/tensorflow/tensorflow/blob/0d45ea1ca641b21b73bcf9c00e0179cda284e7e7/tensorflow/lite/kernels/internal/reference/maximum_minimum.h#L52-L56"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-125" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2021-05-18T16:54:35Z",
"nvd_published_at" : "2021-05-14T20:15:00Z"
}
}