{"id":"CVE-2021-37678","published":"2021-08-12T23:05:10Z","modified":"2024-08-04T01:23:01Z","title":"Arbitrary code execution due to YAML deserialization","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. In affected versions TensorFlow and Keras can be tricked to perform arbitrary code execution when deserializing a Keras model from YAML format. The [implementation](https://github.com/tensorflow/tensorflow/blob/460e000de3a83278fb00b61a16d161b1964f15f4/tensorflow/python/keras/saving/model_config.py#L66-L104) uses `yaml.unsafe_load` which can perform arbitrary code execution on the input. Given that YAML format support requires a significant amount of work, we have removed it for now. We have patched the issue in GitHub commit 23d6383eb6c14084a8fc3bdf164043b974818012. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.","provenance":"source","from":"CVE.org"},"cvss":{"score":9.3,"severity":"CRITICAL","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00447,"percentile":0.30741,"provenance":"source"},"cwes":[{"id":"CWE-502","name":"Deserialization of Untrusted Data"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-r6jx-9g48-2r5r","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/23d6383eb6c14084a8fc3bdf164043b974818012","tags":["x_refsource_MISC"]}],"priority":{"score":17.7,"factors":[{"name":"EPSS percentile","points":6.15},{"name":"Public exploit code","points":5.0},{"name":"CVSS severity","points":6.51}]},"exploitSources":{"pocGithub":{"count":1,"skipped":0,"earliest":"2021-09-09","earliestUrl":"https://github.com/fran-CICS/ExploitTensorflowCVE-2021-37678","repos":[{"name":"fran-CICS/ExploitTensorflowCVE-2021-37678","url":"https://github.com/fran-CICS/ExploitTensorflowCVE-2021-37678","stars":2,"created":"2021-09-09"}]},"first":{"date":"2021-09-09","source":"PoC-in-GitHub","url":"https://github.com/fran-CICS/ExploitTensorflowCVE-2021-37678"},"provenance":"source"},"vendorSlug":"tensorflow","affectedVersions":[{"vendor":"tensorflow","product":"tensorflow","versions":[">= 2.5.0, < 2.5.1",">= 2.4.0, < 2.4.3","< 2.3.4"]}],"affected":[{"ecosystem":"PyPI","package":"tensorflow","vulnerableRanges":["<2.3.4",">=2.4.0, <2.4.3",">=2.5.0, <2.5.1",">=2.3.0, <2.3.4"],"patched":["2.3.4","2.4.3","2.5.1"],"from":["GHSA-r6jx-9g48-2r5r","PYSEC-2021-300"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-cpu","vulnerableRanges":["<2.3.4",">=2.4.0, <2.4.3",">=2.5.0, <2.5.1",">=2.3.0, <2.3.4"],"patched":["2.3.4","2.4.3","2.5.1"],"from":["GHSA-r6jx-9g48-2r5r","PYSEC-2021-591"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-gpu","vulnerableRanges":["<2.3.4",">=2.4.0, <2.4.3",">=2.5.0, <2.5.1",">=2.3.0, <2.3.4"],"patched":["2.3.4","2.4.3","2.5.1"],"from":["GHSA-r6jx-9g48-2r5r","PYSEC-2021-789"],"provenance":"source"}],"summary":{"text":"The flaw is a deserialization weakness in TensorFlow's and Keras's handling of Keras models stored in YAML format, where the code uses an unsafe YAML loader that can execute arbitrary code on untrusted input. An attacker can achieve code execution by supplying a crafted model in YAML format for the victim to load, which requires local access and some user interaction to open or deserialize the malicious model.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:31:29Z"},"euvd":{"id":"EUVD-2021-0404","exploited":false,"provenance":"source"}}