{"id":"CVE-2021-29605","published":"2021-05-14T19:21:12Z","modified":"2024-08-03T22:11:06Z","title":"Integer overflow in TFLite memory allocation","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. The TFLite code for allocating `TFLiteIntArray`s is vulnerable to an integer overflow issue(https://github.com/tensorflow/tensorflow/blob/4ceffae632721e52bf3501b736e4fe9d1221cdfa/tensorflow/lite/c/common.c#L24-L27). An attacker can craft a model such that the `size` multiplier is so large that the return value overflows the `int` datatype and becomes negative. In turn, this results in invalid value being given to `malloc`(https://github.com/tensorflow/tensorflow/blob/4ceffae632721e52bf3501b736e4fe9d1221cdfa/tensorflow/lite/c/common.c#L47-L52). In this case, `ret->size` would dereference an invalid pointer. 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.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.1,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.0022,"percentile":0.0745,"provenance":"source"},"cwes":[{"id":"CWE-190","name":"Integer Overflow or Wraparound"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-jf7h-7m85-w2v2","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/7c8cc4ec69cd348e44ad6a2699057ca88faad3e5","tags":["x_refsource_MISC"]}],"priority":{"score":6.5,"factors":[{"name":"EPSS percentile","points":1.49},{"name":"CVSS severity","points":4.97}]},"vendorSlug":"tensorflow","affectedVersions":[{"vendor":"tensorflow","product":"tensorflow","versions":["< 2.1.4",">= 2.2.0, < 2.2.3",">= 2.3.0, < 2.3.3",">= 2.4.0, < 2.4.2"]}],"affected":[{"ecosystem":"PyPI","package":"tensorflow","vulnerableRanges":["<2.1.4",">=2.2.0, <2.2.3",">=2.3.0, <2.3.3",">=2.4.0, <2.4.2"],"patched":["2.1.4","2.2.3","2.3.3","2.4.2"],"from":["GHSA-jf7h-7m85-w2v2","PYSEC-2021-242"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-cpu","vulnerableRanges":["<2.1.4",">=2.2.0, <2.2.3",">=2.3.0, <2.3.3",">=2.4.0, <2.4.2"],"patched":["2.1.4","2.2.3","2.3.3","2.4.2"],"from":["GHSA-jf7h-7m85-w2v2","PYSEC-2021-533"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-gpu","vulnerableRanges":["<2.1.4",">=2.2.0, <2.2.3",">=2.3.0, <2.3.3",">=2.4.0, <2.4.2"],"patched":["2.1.4","2.2.3","2.3.3","2.4.2"],"from":["GHSA-jf7h-7m85-w2v2","PYSEC-2021-731"],"provenance":"source"}],"summary":{"text":"A flaw exists in TensorFlow's TFLite code that allocates TFLiteIntArray structures, where an integer overflow in the size calculation can produce a negative value passed to malloc. An attacker who can supply a crafted model whose size multiplier is large enough to trigger the overflow could cause the code to dereference an invalid pointer, with the attack vector being local and requiring low privileges and no user interaction.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:12:42Z"},"euvd":{"id":"EUVD-2021-0346","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2021-29605","children":[{"from":"CVE-2021-29605","to":"CVE-2022-23558","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/lite/c/common.c"],"commits":["https://github.com/tensorflow/tensorflow/commit/7c8cc4ec69cd348e44ad6a2699057ca88faad3e5","https://github.com/tensorflow/tensorflow/commit/a1e1511dde36b3f8aa27a6ec630838e7ea40e091"],"basis":"shared function","functions":["TfLiteIntArrayEqualsArray"]}]},{"from":"CVE-2021-29605","to":"CVE-2022-23559","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/lite/kernels/embedding_lookup_sparse.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/7c8cc4ec69cd348e44ad6a2699057ca88faad3e5","https://github.com/tensorflow/tensorflow/commit/1de49725a5fc4e48f1a3b902ec3599ee99283043","https://github.com/tensorflow/tensorflow/commit/a4e401da71458d253b05e41f28637b65baf64be4"],"basis":"shared function","functions":["Eval"]}]}]}}