CVE-2022-23586
Tensorflow Open Source DoS via SavedModel
- CVSS 6.5
- CWE-617 Reachable Assertion
- Resource Management
- Remote
Tensorflow is an Open Source Machine Learning Framework. A malicious user can cause a denial of service by altering a `SavedModel` such that assertions in `function.cc` would be falsified and crash the Python interpreter. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.
- CVSS base score
- 6.5
- Published
- 2022-02-04
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- TensorFlow
- Fixed by upgrading
- Yes
Solution
Update TensorFlow to version 2.8.0 or higher.
Vulnerable code sample
import tensorflow as tf
def load_saved_model(model_path):
model = tf.saved_model.load(model_path)
return model
model = load_saved_model("path/to/saved_model")Patched code sample
import tensorflow as tf
import os
def check_model(model_path):
if not os.path.exists(model_path) or not os.path.isdir(model_path):
raise ValueError(f"Model path {model_path} is not valid or accessible")
return True
def load_saved_model(model_path):
try:
if check_model(model_path):
model = tf.saved_model.load(model_path)
return model
except Exception as e:
raise RuntimeError(f"Failed to load model from {model_path}: {e}")
try:
model = load_saved_model("path/to/saved_model")
except Exception as e:
print(f"Error: {e}")Payload
#Maliciously crafted SavedModel
Cite this entry
@misc{vaitp:cve202223586,
title = {{Tensorflow Open Source DoS via SavedModel}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2022},
note = {VAITP Python Vulnerability Dataset, entry CVE-2022-23586},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2022-23586/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
