## 1 Introduction  
Although various IoT applications, such as smart vehicles, green cities, net-zero decarbonization, and healthcare systems, are emerging fast and affecting our life drastically, the smart grid is still recognized as the most critical cyber-physical IoT application. The current traditional power grid is anticipated to be reorganized as a cyber-physical system with smart devices that may communicate data for sophisticated monitoring and control applications, in addition to the basic feature of carrying power flow [1,2]. The bidirectional transfer of electricity and information will highly improve the power grid, creating a smart grid that will have intelligent features like self-healing, customer interaction, and adaptive protection and control.  
A smart grid is a cutting-edge component of modern electricity systems that offers many advantages, including the effective incorporation of distributed energy resources (DERs) [3]. The basic goal of a smart grid is to distribute automation and control systems over the whole power grid to enable a smooth and effective two-way flow of electric power. This bidirectional feature of an SG allows electrical power and information to flow smoothly from distribution centers and companies to end consumers and vice versa, where selling power is permitted and controlled in both directions. This is accomplished by the incorporation of information and communication technology (ICT) to the traditional grid, which transforms it into a type of cyber-physical system (CPS). A wide range of new technologies, algorithms, and solutions, including artificial intelligence and distributed data processing, can now be developed and applied in the smart grid, thanks to the dynamic integration between the actual and virtual worlds [4, 5, 6, 7].  
Although the introduction of smart energy systems and smart grids came with a plethora of impactful advantages, it also increased the attack surface against the energy sector. This opened the door widely for cyber attackers to use their traditional skills against important energy infrastructures such as the smart grid. The critical nature of smart grids makes them very attractive to cyberattacks as well as cyberterrorism in worst-case scenarios. Cybersecurity is considered one of the largest challenges facing smart grids and IoT applications, which need to be well researched and investigated urgently in the near future. Identifying the types of vulnerabilities that may affect a smart energy system is very important to develop efficient countermeasures against cyber threats [8,9].  
Compared to a traditional power grid, a smart grid contains a huge number of interconnected devices, sensors, and ICT networks, which make it prone to various types of attacks, probing, and espionage. In general, cyberattacks aim to breach the main security pillars of confidentiality, integrity and availability (CIA components) of smart grid network. This can include tapping customer sensitive information, affecting the stability and reliability of grid energy distribution, large electricity blackouts, and infrastructure damage or explosion in severe attacks [10, 11, 12].  
Due to its critical nature, there are a number of restrictions associated with how to defend the smart grid against cyberattacks, which prevent the full adoption of some popular IT security techniques. For instance, when an IT system is attacked, the best practices frequently involve the quick disconnection or otherwise isolation of affected devices from the network. A power grid may not be able to use such a strategy because the sudden disconnection of grid control devices could result in massive blackouts or other disastrous system failures [13,14].