Nowadays, the Internet of things (IoT), which connect to larger, internet-connected devices, is exponentially increased, and is used across the globe [1]. Integration of such a device into networks to provide advanced and intelligent services has to Protect user privacy against cyber-attacks. Attackers exploit vulnerable end sensors and devices supporting IoT data transmission to gain unauthorized system privileges and access to information and connected resources. This paper investigates how malware attack, especially ransomware attack, exploits IoT devices. Moreover, we deeply review different Machine learning solutions that provide IoT security precisely on a ransomware attack. We focused on HowMachine learning solutions detect malicious incidents, such as a ransomware attack on IoT-connected networks. The authors perform all the experiments in this study using a benchmark dataset from the GitHub repository. We used Random Forest (RF) and Decision Tree (DT) Classifier algorithm to evaluate the performance comparison. Finally, we propose a machine learning detection model with better performance and accuracy.