Security advisory
TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow to occur in `Conv2DBackpropFilter`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/1b0296c3b8dd9bd948f924aa8cd62f87dbb7c3da/tensorflow/core/kernels/conv_grad_filter_ops.cc#L495-L497) computes the size of the filter tensor but does not validate that it matches the number of elements in `filter_sizes`. Later, when reading/writing to this buffer, code uses the value computed here, instead of the number of elements in the tensor. The 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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2021-29540
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 31 Oct 2026, 12:44 UTC · Revision 1
Source evidence
TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow to occur in `Conv2DBackpropFilter`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/1b0296c3b8dd9bd948f924aa8cd62f87dbb7c3da/tensorflow/core/kernels/conv_grad_filter_ops.cc#L495-L497) computes the size of the filter tensor but does not validate that it matches the number of elements in `filter_sizes`. Later, when reading/writing to this buffer, code uses the value computed here, instead of the number of elements in the tensor. The 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.
osv:CVE-2021-29540
Complete source record
{
"id": "c81c3bb5523700dd9c20923d64a4bc19858c71462901487a38372f1e4a6a3a48",
"url": "https://osv.dev/vulnerability/CVE-2021-29540",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "CVE-2021-29540",
"summary": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow to occur in `Conv2DBackpropFilter`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/1b0296c3b8dd9bd948f924aa8cd62f87dbb7c3da/tensorflow/core/kernels/conv_grad_filter_ops.cc#L495-L497) computes the size of the filter tensor but does not validate that it matches the number of elements in `filter_sizes`. Later, when reading/writing to this buffer, code uses the value computed here, instead of the number of elements in the tensor. The 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.",
"evidence": "osv:CVE-2021-29540",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2021-29540",
"aliases": [
"BIT-tensorflow-2021-29540",
"CVE-2021-29540",
"GHSA-xgc3-m89p-vr3x",
"PYSEC-2021-177",
"PYSEC-2021-468",
"PYSEC-2021-666"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/tensorflow/tensorflow",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "0931ea3d985bb9c8fdd054a5e29c4129623c849b"
},
{
"introduced": "2b96f3662bd776e277f86997659e61046b56c315"
},
{
"fixed": "cfe0c80169ae984bcdc99ff6de7444164aaa8e07"
},
{
"introduced": "b36436b087bd8e8701ef51718179037cccdfc26e"
},
{
"fixed": "3929ffacfbef7c431e8397920d040aaf47acff19"
},
{
"introduced": "582c8d236cb079023657287c318ff26adb239002"
},
{
"fixed": "1923123d32ea41d92b70a27a3f6ecf0763b56f6c"
},
{
"fixed": "c570e2ecfc822941335ad48f6e10df4e21f11c96"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "0"
},
{
"fixed": "2.1.4"
}
],
"source": "CPE_RANGE"
},
{
"cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "2.2.0"
},
{
"fixed": "2.2.3"
}
],
"source": "CPE_RANGE"
},
{
"cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "2.3.0"
},
{
"fixed": "2.3.3"
}
],
"source": "CPE_RANGE"
},
{
"cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "2.4.0"
},
{
"fixed": "2.4.2"
}
],
"source": "CPE_RANGE"
},
{
"range": [
{
"fixed": "c570e2ecfc822941335ad48f6e10df4e21f11c96"
}
],
"source": "REFERENCES_COMMIT"
}
]
}
}
],
"versions": [
"v2.1.3",
"v2.2.2",
"v2.3.2",
"v2.4.1",
"v2.1.2",
"v2.2.1",
"v2.4.0",
"v2.3.1",
"v2.2.0",
"v2.1.1",
"v2.3.0",
"v2.1.0",
"v2.1.0-rc0",
"v2.1.0-rc2",
"v2.1.0-rc1",
"v1.12.1",
"v1.9.0-rc2",
"v1.6.0-rc1",
"v1.1.0-rc2",
"v1.1.0-rc1",
"0.6.0",
"0.5.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-29540.json",
"vanir_signatures": [
{
"id": "CVE-2021-29540-c1d36bfe",
"digest": {
"threshold": 0.9,
"line_hashes": [
"324929951830919552292852552964558826722",
"125228753382818540400591334887381218070",
"90221298885569485258934159180681753575",
"121956488963479845048606417661305347870",
"286973072065033444553466007058475453628",
"226211049892244163293098549223763689073",
"129279513966689844778799936858437378436"
]
},
"source": "https://github.com/tensorflow/tensorflow/commit/c570e2ecfc822941335ad48f6e10df4e21f11c96",
"target": {
"file": "tensorflow/core/kernels/conv_grad_filter_ops.cc"
},
"deprecated": false,
"signature_type": "Line",
"signature_version": "v1"
}
],
"vanir_signatures_modified": "2026-10-20T14:24:28Z"
}
}
],
"modified": "2026-10-20T14:24:28.353759661Z",
"provider": "osv",
"references": [
"https://github.com/tensorflow/tensorflow/commit/c570e2ecfc822941335ad48f6e10df4e21f11c96",
"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-xgc3-m89p-vr3x"
],
"provider_metadata": {}
},
"related_cves": [
{
"value": "CVE-2021-29540",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 388915,
"published_at": "2021-05-14T20:15:12.443+00:00"
}