# IoT Anomaly Detection to Strengthen Cybersecurity in the Critical Infrastructure of Smart Cities
## 4 Discussion  
The application of anomaly detection models in the context of smart cities, supported by IoT, is a vitally important field of research that seeks to guarantee the efficiency, security, and reliability of constantly evolving urban systems. The results offer a solid perspective on how anomaly detection models can enhance the topic of IoT in smart cities. The interconnection of various IoT devices in urban areas has generated a vast flow of real-time data [36]. This abundance of data provides a unique opportunity to improve city management but also poses significant challenges in terms of early detection of anomalies and threats. The present work demonstrates that the proposed models, such as Isolation Forest, RNNs, and VAEs, can effectively identify anomalies in urban data, such as unusual fluctuations in electrical energy demand, voltage manipulation attempts, the injection of false data, and frequency alterations. These findings support the usefulness of anomaly detection models in monitoring critical systems in smart cities, such as the power grid [37]. Furthermore, the work highlights the importance of detecting suspicious patterns in power grid communication data, which significantly contributes to protection against cyber threats [38]. The models developed here have demonstrated their ability to identify infiltration attempts, DDoS attacks, vulnerability scans, and other attack patterns, allowing \begin{table}
\begin{tabular}{c c c} \hline \hline
**Date and Time** & **Infiltration Attempt** & **Detected Model** \\ \hline
18 April 2023 03:20:00 & Unauthorized access & Isolation Forest \\
22 April 2023 11:55:00 & Attempted DDoS Attack & RNN \\
1 May 2023 09:30:00 & Vulnerability Scanning & VAE \\
6 May 2023 19:45:00 & Attack Pattern Detection & Isolation Forest \\
15 May 2023 14:20:00 & Malware Infiltration & RNN \\
21 May 2023 08:10:00 & Brute Force Attack & VAE \\
28 May 2023 23:55:00 & Exfiltration Attempt & Isolation Forest \\
3 June 2023 12:30:00 & Impersonation Attack & RNN \\
10 June 2023 07:05:00 & System Intrusion & VAE \\
18 June 2023 16:40:00 & Zero-Day Attack Attempt & Isolation Forest \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Record of detected infiltration attempts and associated models. preventure measures to be taken to safeguard the integrity of the infrastructure [39]. IoT in smart cities covers a variety of applications, such as traffic monitoring, waste management, air quality monitoring, and much more. The results presented in this work lay the foundation for applying anomaly detection models in these areas. The ability to detect unusual events or anomalous behavior in IoT sensor data is essential to guaranteeing the quality of life of citizens and the efficient functioning of urban systems. Research on anomaly detection in smart cities supports existing literature addressing the safety and efficiency of these environments. Numerous previous studies have highlighted the importance of IoT in transforming cities and have underlined the need to address security and threat detection challenges in this context. For example, ref. [40] investigated the use of IoT in smart cities and highlighted the relevance of anomaly detection technologies to ensure the security of urban data and systems. The results of our work align with this perspective, as they demonstrate the effectiveness of anomaly detection models in identifying threats in the power grid. In another study, ref. [41] presented a comprehensive analysis of IoT in smart cities. They highlighted the importance of ensuring the security and privacy of data generated by IoT devices. Our work contributes to this goal by proposing real-time models that can detect abnormal activities and cyber-attacks, strengthening IoT security in smart cities. The anomaly detection algorithms employed in this study, including Isolation Forest, RNN, and VAE, have shown high promise in various anomaly detection applications in time series and unstructured data.