# A Blockchain-Based Cooperative Authentication Mechanism for Smart Grid
## 5 Security Analysis  
In this section, we will analyse the potential attacks and security features of our proposed mechanism in detail. We assume that the cryptographic principles and blockchain in our proposed mechanism are secure. As smart grid devices in each domain are connected to the Internet, they are vulnerable to many attacks. An attacker may be able to obtain critical information about a device and launch a forgery attack. An attacker may also intercept information sent by the sender and send a different message to the receiver, which is known as a man-in-the-middle attack. In a replay attack, the attacker repeats the packets received by the destination host, spoofing the system and bringing it down. When an attacker operates multiple machines to attack one or more targets, this attack is known as a DDoS attack. In addition, an eavesdropping attack occurs when an attacker uses sniffing tools to steal communication information between two devices. Finally, an authorized user can launch an internal attack. The following is an analysis of how our proposed mechanism protects against these attacks. Forgery Attack: In our proposed mechanism, each device generates and saves its own private key. As long as the private key is not compromised, it is guaranteed to be infeasible to forge a signature. Even if the attacker knows the public key \(pk_{i}\) and the base \(G\) of the device, it is almost impossible for the attacker to compute the private key of the device, which is the classical discrete logarithm problem. Man-in-the-Middle Attack: In our proposed mechanism, the communication between any two communicating parties is encrypted. Therefore, even if a man-in-the-middle hijacks the communication data, the attacker cannot obtain valid information without the key. In our mechanism, if an attacker steals the random character \(RS\) sent by \(M_{B}\) to the device, the attacker needs to sign this string with their private key. \(M_{B}\) then needs the attacker's certificate and goes to the blockchain to query and verify the legitimacy of this certificate. Due to the nature of the underlying blockchain technology that we use, an  
Figure 4: Schematic diagram of key negotiation. attacker cannot tamper with the data in the blockchain and generate an illegal certificate. Therefore, our solution is able to resist man-in-the-middle attacks. Replay Attack: In our proposed authentication mechanism, when performing cross-domain authentication, the domain manager \(M_{B}\) stores the certificate of the device \(D_{i}\) in domain A in its own local database. Therefore, even if the attacker repeatedly sends the same cross-domain authentication request, \(M_{B}\) will check in the local database whether the device has previously performed cross-domain authentication and the validity of the certificate. If the device has already performed cross-domain authentication and the certificate is legitimate, \(M_{B}\) will not repeat the cross-domain authentication. DDoS Attack: In our proposed authentication mechanism, the authentication information is stored in the blockchain. The blockchain is distributed in nature, meaning that each blockchain proxy node has the ledger of the entire blockchain. In the federated chains that we use, the failure of less than one-third of the nodes does not affect the entire distributed ledger. Additionally, when the attacked ledger is restored to normal, the complete ledger information can be obtained from other nodes. Therefore, our proposed mechanism is fully resistant to DDoS attacks. Eavesdropping Attack: In our proposed authentication mechanism, the information transmitted between the smart device and the domain management is non-private information, which means that it is not valuable even if it is intercepted by an eavesdropper. Other non-private information is encrypted with a key and, even if an eavesdropper obtains this information, it cannot be decrypted without the key. Therefore, our proposed authentication mechanism is fully resistant to eavesdropping attacks.