{"id":"CVE-2021-41228","aliases":["CVE-2021-41228","GHSA-3rcw-9p9x-582v","BIT-TENSORFLOW-2021-41228","PYSEC-2021-420","PYSEC-2021-637","PYSEC-2021-835"],"related":[],"kind":"vulnerability","state":"published","title":"Code injection in `saved_model_cli`","summary":"TensorFlow is an open source platform for machine learning. In affected versions TensorFlow's `saved_model_cli` tool is vulnerable to a code injection as it calls `eval` on user supplied strings. This can be used by attackers to run arbitrary code on the plaform where the CLI tool runs. However, given that the tool is always run manually, the impact of this is not severe. We have patched this by adding a `safe` flag which defaults to `True` and an explicit warning for users. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"TensorFlow is an open source platform for machine learning. In affected versions TensorFlow's `saved_model_cli` tool is vulnerable to a code injection as it calls `eval` on user supplied strings. This can be used by attackers to run arbitrary code on the plaform where the CLI tool runs. However, given that the tool is always run manually, the impact of this is not severe. We have patched this by adding a `safe` flag which defaults to `True` and an explicit warning for users. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.","source":"cvelist"},{"lang":"en","text":"### Impact\nTensorFlow's `saved_model_cli` tool is vulnerable to a code injection as it [calls `eval` on user supplied strings](https://github.com/tensorflow/tensorflow/blob/87462bfac761435a46641ff2f10ad0b6e5414a4b/tensorflow/python/tools/saved_model_cli.py#L524-L550)\n  \n```python\ndef preprocess_input_exprs_arg_string(input_exprs_str):\n  ... \n  for input_raw in filter(bool, input_exprs_str.split(';')):\n    ...\n    input_key, expr = input_raw.split('=', 1)\n    input_dict[input_key] = eval(expr)\n  ...\n``` \n  \nThis can be used by attackers to run arbitrary code on the plaform where the CLI tool runs.\nHowever, given that the tool is always run manually, the impact of this is not severe. We have patched this by adding a `safe` flag which defaults to `True` and an explicit warning for users. \n\n### Patches\nWe have patched the issue in GitHub commit [8b202f08d52e8206af2bdb2112a62fafbc546ec7](https://github.com/tensorflow/tensorflow/commit/8b202f08d52e8206af2bdb2112a62fafbc546ec7).\n\nThe fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.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 Omer Kaspi from Vdoo.","format":"markdown","source":"ghsa"},{"lang":"es","text":"TensorFlow es una plataforma de código abierto para el aprendizaje automático. En las versiones afectadas, la herramienta \"saved_model_cli\" de TensorFlow es vulnerable a una inyección de código ya que llama a \"eval\" sobre cadenas suministradas por el usuario. Esto puede ser usado por atacantes para ejecutar código arbitrario en la plataforma donde es ejecutada la herramienta CLI. Sin embargo, dado que la herramienta siempre es ejecutada manualmente, el impacto de esto no es grave. Hemos corregido esto añadiendo una bandera \"safe\" que por defecto es \"True\" y una advertencia explícita para usuarios. La corrección será incluida en TensorFlow versión 2.7.0. También seleccionaremos este commit en TensorFlow versión 2.6.1, TensorFlow versión 2.5.2, y TensorFlow versión 2.4.4, ya que estos también se ven afectados y todavía están en el rango admitido","source":"nvd"}],"published":"2021-11-05T22:25:11.000Z","modified":"2026-09-08T08:48:25.299Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:H","score":7.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:H/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:L/AC:L/Au:N/C:P/I:P/A:P","score":4.6,"rating":"MEDIUM"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"HIGH"}],"cwes":["CWE-78","CWE-94"],"affected":[{"ranges":[{"version":">= 2.6.0, < 2.6.1","status":"affected"},{"version":">= 2.5.0, < 2.5.2","status":"affected"},{"version":"< 2.4.4","status":"affected"}],"vendor":"tensorflow","product":"tensorflow","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"2.5.0","status":"affected","fixed":"2.5.2"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.4"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.5.0","status":"affected","fixed":"2.5.2"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.4"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.5.0","status":"affected","fixed":"2.5.2"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.4"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"2.4.0","fixed":"2.4.4"},{"status":"affected","introduced":"2.5.0","fixed":"2.5.2"},{"status":"affected","introduced":"2.6.0","fixed":"2.6.1"},{"status":"affected","version":"2.7.0"},{"status":"affected","version":"2.7.0"}],"vendor":"google","product":"tensorflow","cpe":"cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"8b202f08d52e8206af2bdb2112a62fafbc546ec7"},{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.4"},{"type":"ecosystem","introduced":"2.5.0","status":"affected","fixed":"2.5.2"},{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"},{"type":"ecosystem","introduced":"2.7.0rc0","status":"affected","fixed":"2.7.0"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","repo":"https://github.com/tensorflow/tensorflow","source":"pysec"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"8b202f08d52e8206af2bdb2112a62fafbc546ec7"},{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.4"},{"type":"ecosystem","introduced":"2.5.0","status":"affected","fixed":"2.5.2"},{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"},{"type":"ecosystem","introduced":"2.7.0rc0","status":"affected","fixed":"2.7.0"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","repo":"https://github.com/tensorflow/tensorflow","source":"pysec"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"8b202f08d52e8206af2bdb2112a62fafbc546ec7"},{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.4"},{"type":"ecosystem","introduced":"2.5.0","status":"affected","fixed":"2.5.2"},{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"},{"type":"ecosystem","introduced":"2.7.0rc0","status":"affected","fixed":"2.7.0"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","repo":"https://github.com/tensorflow/tensorflow","source":"pysec"},{"ranges":[{"type":"semver","introduced":"2.4.0","status":"affected","fixed":"2.4.4"},{"type":"semver","introduced":"2.5.0","status":"affected","fixed":"2.5.2"},{"type":"semver","introduced":"2.6.0","status":"affected","fixed":"2.6.1"}],"ecosystem":"Bitnami","package":"tensorflow","purl":"pkg:bitnami/tensorflow","source":"bitnami"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-3rcw-9p9x-582v","tags":["advisory","exploit","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/commit/8b202f08d52e8206af2bdb2112a62fafbc546ec7","tags":["advisory","fix","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-41228","tags":["advisory","web"],"sources":["ghsa","bitnami"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-637.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-835.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-420.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/tensorflow/tensorflow","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-41228","url":"https://www.cve.org/CVERecord?id=CVE-2021-41228","licence":"CVE Terms of Use","modified":"2024-08-04T03:08:31.343Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-3rcw-9p9x-582v","url":"https://github.com/advisories/GHSA-3rcw-9p9x-582v","licence":"CC-BY-4.0","modified":"2026-07-08T06:28:28.838Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-41228","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-41228","licence":"Public domain","modified":"2026-06-17T04:08:08.233Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-420","url":"https://osv.dev/vulnerability/PYSEC-2021-420","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:35.429Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-637","url":"https://osv.dev/vulnerability/PYSEC-2021-637","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:35.429Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-835","url":"https://osv.dev/vulnerability/PYSEC-2021-835","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:35.429Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-TENSORFLOW-2021-41228","url":"https://osv.dev/vulnerability/BIT-TENSORFLOW-2021-41228","licence":"Apache-2.0","modified":"2026-09-08T08:48:25.299Z"}],"updatedAt":"2026-11-25T22:58:05.403Z","epss":{"score":0.00217,"percentile":0.12909,"date":"2026-12-02T12:00:21.000Z"}}