{"id":"CVE-2022-29198","aliases":["CVE-2022-29198","GHSA-mg66-qvc5-rm93","BIT-TENSORFLOW-2022-29198","PYSEC-2026-1018","PYSEC-2026-3214","PYSEC-2026-3350"],"related":[],"kind":"vulnerability","state":"published","title":"Missing validation causes denial of service in TensorFlow via `SparseTensorToCSRSparseMatrix`","summary":"TensorFlow is an open source platform for machine learning. Prior to versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4, the implementation of `tf.raw_ops.SparseTensorToCSRSparseMatrix` does not fully validate the input arguments. This results in a `CHECK`-failure which can be used to trigger a denial of service attack. The code assumes `dense_shape` is a vector and `indices` is a matrix (as part of requirements for sparse tensors) but there is no validation for this. Versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4 contain a patch for this issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"TensorFlow is an open source platform for machine learning. Prior to versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4, the implementation of `tf.raw_ops.SparseTensorToCSRSparseMatrix` does not fully validate the input arguments. This results in a `CHECK`-failure which can be used to trigger a denial of service attack. The code assumes `dense_shape` is a vector and `indices` is a matrix (as part of requirements for sparse tensors) but there is no validation for this. Versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4 contain a patch for this issue.","source":"cvelist"},{"lang":"en","text":"### Impact\nThe implementation of [`tf.raw_ops.SparseTensorToCSRSparseMatrix`](https://github.com/tensorflow/tensorflow/blob/f3b9bf4c3c0597563b289c0512e98d4ce81f886e/tensorflow/core/kernels/sparse/sparse_tensor_to_csr_sparse_matrix_op.cc#L65-L119) does not fully validate the input arguments. This results in a `CHECK`-failure which can be used to trigger a denial of service attack:\n\n```python\nimport tensorflow as tf\n\nindices = tf.constant(53, shape=[3], dtype=tf.int64)\nvalues = tf.constant(0.554979503, shape=[218650], dtype=tf.float32)\ndense_shape = tf.constant(53, shape=[3], dtype=tf.int64)\n    \ntf.raw_ops.SparseTensorToCSRSparseMatrix(\n  indices=indices,\n  values=values,\n  dense_shape=dense_shape)\n```\n\nThe code assumes `dense_shape` is a vector and `indices` is a matrix (as part of requirements for sparse tensors) but there is no validation for this:\n  \n```cc\n    const Tensor& indices = ctx->input(0);\n    const Tensor& values = ctx->input(1);\n    const Tensor& dense_shape = ctx->input(2);\n    const int rank = dense_shape.NumElements();\n    OP_REQUIRES(ctx, rank == 2 || rank == 3,\n                errors::InvalidArgument(\"SparseTensor must have rank 2 or 3; \",\n                                        \"but indices has rank: \", rank));\n    auto dense_shape_vec = dense_shape.vec<int64_t>();\n    // ...\n    OP_REQUIRES_OK(\n        ctx,\n        coo_to_csr(batch_size, num_rows, indices.template matrix<int64_t>(),\n                   batch_ptr.vec<int32>(), csr_row_ptr.vec<int32>(),\n                   csr_col_ind.vec<int32>()));\n```\n\n### Patches\nWe have patched the issue in GitHub commit [ea50a40e84f6bff15a0912728e35b657548cef11](https://github.com/tensorflow/tensorflow/commit/ea50a40e84f6bff15a0912728e35b657548cef11).\n\nThe fix will be included in TensorFlow 2.9.0. We will also cherrypick this commit on TensorFlow 2.8.1, TensorFlow 2.7.2, and TensorFlow 2.6.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 Neophytos Christou from Secure Systems Lab at Brown University.","format":"markdown","source":"ghsa"},{"lang":"es","text":"TensorFlow es una plataforma de código abierto para el aprendizaje automático. En versiones anteriores a 2.9.0, 2.8.1, 2.7.2 y 2.6.4, la implementación de \"tf.raw_ops.SparseTensorToCSRSparseMatrix\" no comprueba completamente los argumentos de entrada. Esto resulta en un fallo de \"CHECK\" que puede ser usado para desencadenar un ataque de denegación de servicio. El código asume que \"dense_shape\" es un vector y que \"indices\" es una matriz (como parte de los requisitos para los tensores dispersos) pero no es comprobado esto. Las versiones 2.9.0, 2.8.1, 2.7.2 y 2.6.4 contienen un parche para este problema","source":"nvd"}],"published":"2022-05-20T21:50:12.000Z","modified":"2026-09-08T08:48:25.227Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:L/AC:L/Au:N/C:N/I:N/A:P","score":2.1,"rating":"LOW"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"MEDIUM"}],"cwes":["CWE-20"],"affected":[{"ranges":[{"version":"< 2.6.4","status":"affected"},{"version":">= 2.7.0rc0, < 2.7.2","status":"affected"},{"version":">= 2.8.0rc0, < 2.8.1","status":"affected"},{"version":">= 2.9.0rc0, < 2.9.0","status":"affected"}],"vendor":"tensorflow","product":"tensorflow","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.6.4"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.7.0","status":"affected","fixed":"2.7.2"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.8.0","status":"affected","fixed":"2.8.1"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.6.4"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.7.0","status":"affected","fixed":"2.7.2"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.8.0","status":"affected","fixed":"2.8.1"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.6.4"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.7.0","status":"affected","fixed":"2.7.2"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.8.0","status":"affected","fixed":"2.8.1"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.6.4"},{"status":"affected","introduced":"2.7.0","fixed":"2.7.2"},{"status":"affected","version":"2.7.0"},{"status":"affected","version":"2.7.0"},{"status":"affected","version":"2.8.0"},{"status":"affected","version":"2.8.0"},{"status":"affected","version":"2.8.0"},{"status":"affected","version":"2.9.0"},{"status":"affected","version":"2.9.0"}],"vendor":"google","product":"tensorflow","cpe":"cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.6.4"},{"type":"ecosystem","introduced":"2.7.0","status":"affected","fixed":"2.7.2"},{"type":"ecosystem","introduced":"2.8.0","status":"affected","fixed":"2.8.1"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"pysec"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.6.4"},{"type":"ecosystem","introduced":"2.7.0","status":"affected","fixed":"2.7.2"},{"type":"ecosystem","introduced":"2.8.0","status":"affected","fixed":"2.8.1"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"pysec"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.6.4"},{"type":"ecosystem","introduced":"2.7.0","status":"affected","fixed":"2.7.2"},{"type":"ecosystem","introduced":"2.8.0","status":"affected","fixed":"2.8.1"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"pysec"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.6.4"},{"type":"semver","introduced":"2.7.0","status":"affected","fixed":"2.7.2"}],"ecosystem":"Bitnami","package":"tensorflow","purl":"pkg:bitnami/tensorflow","source":"bitnami"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/releases/tag/v2.6.4","tags":["advisory","release-notes","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/releases/tag/v2.7.2","tags":["advisory","release-notes","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/releases/tag/v2.8.1","tags":["advisory","release-notes","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/releases/tag/v2.9.0","tags":["advisory","release-notes","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-mg66-qvc5-rm93","tags":["advisory","exploit","patch","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/commit/ea50a40e84f6bff15a0912728e35b657548cef11","tags":["advisory","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/blob/f3b9bf4c3c0597563b289c0512e98d4ce81f886e/tensorflow/core/kernels/sparse/sparse_tensor_to_csr_sparse_matrix_op.cc#L65-L119","tags":["advisory","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-29198","tags":["advisory","web"],"sources":["ghsa","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/tensorflow-gpu","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-mg66-qvc5-rm93","tags":["advisory"],"sources":["pysec"]},{"url":"https://pypi.org/project/tensorflow","tags":["package"],"sources":["pysec"]},{"url":"https://pypi.org/project/tensorflow-cpu","tags":["package"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-04-22T15:47:26.445Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-29198","url":"https://www.cve.org/CVERecord?id=CVE-2022-29198","licence":"CVE Terms of Use","modified":"2025-04-22T17:59:29.034Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-mg66-qvc5-rm93","url":"https://github.com/advisories/GHSA-mg66-qvc5-rm93","licence":"CC-BY-4.0","modified":"2026-07-13T16:43:41.806Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-29198","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-29198","licence":"Public domain","modified":"2026-06-17T04:39:47.997Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-1018","url":"https://osv.dev/vulnerability/PYSEC-2026-1018","licence":"CC-BY-4.0","modified":"2026-07-13T16:43:41.806Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3214","url":"https://osv.dev/vulnerability/PYSEC-2026-3214","licence":"CC-BY-4.0","modified":"2026-07-13T16:43:41.806Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3350","url":"https://osv.dev/vulnerability/PYSEC-2026-3350","licence":"CC-BY-4.0","modified":"2026-07-13T16:43:41.806Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-TENSORFLOW-2022-29198","url":"https://osv.dev/vulnerability/BIT-TENSORFLOW-2022-29198","licence":"Apache-2.0","modified":"2026-09-08T08:48:25.227Z"}],"updatedAt":"2026-11-25T22:58:11.868Z","epss":{"score":0.00325,"percentile":0.18,"date":"2026-11-30T12:00:22.000Z"}}