Security advisory
TensorFlow is an end-to-end open source platform for machine learning. In affected versions TFLite's [`expand_dims.cc`](https://github.com/tensorflow/tensorflow/blob/149562d49faa709ea80df1d99fc41d005b81082a/tensorflow/lite/kernels/expand_dims.cc#L36-L50) contains a vulnerability which allows reading one element outside of bounds of heap allocated data. If `axis` is a large negative value (e.g., `-100000`), then after the first `if` it would still be negative. The check following the `if` statement will pass and the `for` loop would read one element before the start of `input_dims.data` (when `i = 0`). We have patched the issue in GitHub commit d94ffe08a65400f898241c0374e9edc6fa8ed257. 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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2021-37685
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 31 Oct 2026, 12:52 UTC · Revision 1
Source evidence
TensorFlow is an end-to-end open source platform for machine learning. In affected versions TFLite's [`expand_dims.cc`](https://github.com/tensorflow/tensorflow/blob/149562d49faa709ea80df1d99fc41d005b81082a/tensorflow/lite/kernels/expand_dims.cc#L36-L50) contains a vulnerability which allows reading one element outside of bounds of heap allocated data. If `axis` is a large negative value (e.g., `-100000`), then after the first `if` it would still be negative. The check following the `if` statement will pass and the `for` loop would read one element before the start of `input_dims.data` (when `i = 0`). We have patched the issue in GitHub commit d94ffe08a65400f898241c0374e9edc6fa8ed257. 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.
osv:CVE-2021-37685
Complete source record
{
"id": "888a43cb61e91074636aa3dc7b08dd99463d3a381d843a8a2f54f1535e502a8f",
"url": "https://osv.dev/vulnerability/CVE-2021-37685",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "CVE-2021-37685",
"summary": "TensorFlow is an end-to-end open source platform for machine learning. In affected versions TFLite's [`expand_dims.cc`](https://github.com/tensorflow/tensorflow/blob/149562d49faa709ea80df1d99fc41d005b81082a/tensorflow/lite/kernels/expand_dims.cc#L36-L50) contains a vulnerability which allows reading one element outside of bounds of heap allocated data. If `axis` is a large negative value (e.g., `-100000`), then after the first `if` it would still be negative. The check following the `if` statement will pass and the `for` loop would read one element before the start of `input_dims.data` (when `i = 0`). We have patched the issue in GitHub commit d94ffe08a65400f898241c0374e9edc6fa8ed257. 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.",
"evidence": "osv:CVE-2021-37685",
"products": [],
"severity": "medium",
"structured": {
"id": "CVE-2021-37685",
"aliases": [
"BIT-tensorflow-2021-37685",
"CVE-2021-37685",
"GHSA-c545-c4f9-rf6v",
"PYSEC-2021-307",
"PYSEC-2021-598",
"PYSEC-2021-796"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/tensorflow/tensorflow",
"type": "GIT",
"events": [
{
"introduced": "b36436b087bd8e8701ef51718179037cccdfc26e"
},
{
"fixed": "7462dcaae1e8cfe1dfd0c62dd6083f9749a9d827"
},
{
"introduced": "582c8d236cb079023657287c318ff26adb239002"
},
{
"fixed": "4c0b84bf2a714bcdd18da1f1f94d533d72399d52"
},
{
"introduced": "a4dfb8d1a71385bd6d122e4f27f86dcebb96712d"
},
{
"last_affected": "5368d50428b30b7c9ccd038aec65d09252d16596"
},
{
"fixed": "d94ffe08a65400f898241c0374e9edc6fa8ed257"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "2.3.0"
},
{
"fixed": "2.3.4"
}
],
"source": "CPE_RANGE"
},
{
"cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "2.4.0"
},
{
"fixed": "2.4.3"
}
],
"source": "CPE_RANGE"
},
{
"cpe": "cpe:2.3:a:google:tensorflow:2.5.0:*:*:*:*:*:*:*",
"range": [
{
"introduced": "2.5.0"
},
{
"last_affected": "2.5.0"
}
],
"source": "CPE_STRING"
},
{
"cpe": "cpe:2.3:a:google:tensorflow:2.6.0:rc0:*:*:*:*:*:*",
"range": [
{
"introduced": "2.6.0-rc0"
},
{
"last_affected": "2.6.0-rc0"
}
],
"source": "CPE_STRING"
},
{
"cpe": "cpe:2.3:a:google:tensorflow:2.6.0:rc1:*:*:*:*:*:*",
"range": [
{
"introduced": "2.6.0-rc1"
},
{
"last_affected": "2.6.0-rc1"
}
],
"source": "CPE_STRING"
},
{
"cpe": "cpe:2.3:a:google:tensorflow:2.6.0:rc2:*:*:*:*:*:*",
"range": [
{
"introduced": "2.6.0-rc2"
},
{
"last_affected": "2.6.0-rc2"
}
],
"source": "CPE_STRING"
},
{
"range": [
{
"fixed": "d94ffe08a65400f898241c0374e9edc6fa8ed257"
}
],
"source": "REFERENCES_COMMIT"
}
]
}
}
],
"versions": [
"2.5.0",
"2.6.0-rc0",
"2.6.0-rc1",
"2.6.0-rc2",
"v2.3.3",
"v2.4.2",
"v2.3.2",
"v2.4.1",
"v2.4.0",
"v2.3.1",
"v2.3.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-37685.json",
"vanir_signatures": [
{
"id": "CVE-2021-37685-3c3817b6",
"digest": {
"length": 553,
"function_hash": "90426852726073695642670018393611307008"
},
"source": "https://github.com/tensorflow/tensorflow/commit/d94ffe08a65400f898241c0374e9edc6fa8ed257",
"target": {
"file": "tensorflow/lite/kernels/expand_dims.cc",
"function": "ExpandTensorDim"
},
"deprecated": false,
"signature_type": "Function",
"signature_version": "v1"
},
{
"id": "CVE-2021-37685-9e19df32",
"digest": {
"threshold": 0.9,
"line_hashes": [
"111291069171236216273886249722434494830",
"228428124475504536952279868531287933397",
"243869867076614227619769687783877886443",
"225635853019236173640100177172817393804"
]
},
"source": "https://github.com/tensorflow/tensorflow/commit/d94ffe08a65400f898241c0374e9edc6fa8ed257",
"target": {
"file": "tensorflow/lite/kernels/expand_dims.cc"
},
"deprecated": false,
"signature_type": "Line",
"signature_version": "v1"
}
],
"vanir_signatures_modified": "2026-10-20T14:28:22Z"
}
}
],
"modified": "2026-10-20T14:28:22.722993543Z",
"provider": "osv",
"references": [
"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-c545-c4f9-rf6v",
"https://github.com/tensorflow/tensorflow/commit/d94ffe08a65400f898241c0374e9edc6fa8ed257"
],
"provider_metadata": {}
},
"related_cves": [
{
"value": "CVE-2021-37685",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 389050,
"published_at": "2021-08-12T23:15:08.677+00:00"
}