Underwater sensor networks (UWSN) have a broad range of applications requiring accurate and efficient data management. Due to the restricted energy of underwater modems and the harsh UWSN environment, we consider the possibility of mobile malicious nodes interjecting false packets into various networks. With the proper incite, a denial of service (DoS) attack can drastically affect an UWSN. In this work, we first analyse different types of DoS attacks in which UWSNs may be vulnerable. Next, we purpose an adapted algorithm to help detect and restrict potential malicious nodes. Finally, we analyse node behaviour using three different machine learning techniques to find statistical, adaptive, and predictive approaches to DoS restriction. Simulation results show a strong correlation between DoS defensive methods and decreased network traffic in typical attacker scenarios. Furthermore, we introduce more advanced scenarios to test our machine learning techniques in various topologies.