{"id":"CVE-2021-29541","published":"2021-05-14T19:11:21Z","modified":"2024-08-03T22:11:05Z","title":"Null pointer dereference in `StringNGrams`","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a dereference of a null pointer in `tf.raw_ops.StringNGrams`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/1cdd4da14282210cc759e468d9781741ac7d01bf/tensorflow/core/kernels/string_ngrams_op.cc#L67-L74) does not fully validate the `data_splits` argument. This would result in `ngrams_data`(https://github.com/tensorflow/tensorflow/blob/1cdd4da14282210cc759e468d9781741ac7d01bf/tensorflow/core/kernels/string_ngrams_op.cc#L106-L110) to be a null pointer when the output would be computed to have 0 or negative size. Later writes to the output tensor would then cause a null pointer dereference. 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":2.5,"severity":"LOW","version":"3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00189,"percentile":0.08724,"provenance":"source"},"cwes":[{"id":"CWE-476","name":"NULL Pointer Dereference"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/commit/ba424dd8f16f7110eea526a8086f1a155f14f22b","tags":["x_refsource_MISC"]},{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-xqfj-35wv-m3cr","tags":["x_refsource_CONFIRM"]}],"priority":{"score":3.5,"factors":[{"name":"EPSS percentile","points":1.74},{"name":"CVSS severity","points":1.75}]},"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-xqfj-35wv-m3cr","PYSEC-2021-178"],"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-xqfj-35wv-m3cr","PYSEC-2021-469"],"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-xqfj-35wv-m3cr","PYSEC-2021-667"],"provenance":"source"}],"summary":{"text":"A null pointer dereference exists in the StringNGrams operation (tf.raw_ops.StringNGrams) of TensorFlow, because the implementation does not fully validate the data_splits argument, which can leave the ngrams data buffer as a null pointer. An attacker with local access and low privileges, using a high-complexity attack and without any user interaction, can trigger the crash by supplying input that produces a zero or negative output size, resulting in a denial of service.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:23:08Z"},"euvd":{"id":"EUVD-2021-0282","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2020-15205","parents":[{"from":"CVE-2020-15205","to":"CVE-2021-29541","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/string_ngrams_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/0462de5b544ed4731aa2fb23946ac22c01856b80","https://github.com/tensorflow/tensorflow/commit/ba424dd8f16f7110eea526a8086f1a155f14f22b"],"basis":"shared function","functions":["StringNGramsOp"]}]}],"children":[{"from":"CVE-2021-29541","to":"CVE-2021-37646","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/string_ngrams_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/ba424dd8f16f7110eea526a8086f1a155f14f22b","https://github.com/tensorflow/tensorflow/commit/c283e542a3f422420cfdb332414543b62fc4e4a5"],"basis":"shared function","functions":["StringNGramsOp"]}]},{"from":"CVE-2021-29541","to":"CVE-2022-21733","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/string_ngrams_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/ba424dd8f16f7110eea526a8086f1a155f14f22b","https://github.com/tensorflow/tensorflow/commit/f68fdab93fb7f4ddb4eb438c8fe052753c9413e8"],"basis":"shared function","functions":["StringNGramsOp"]}]}]}}