# 5G-IPAKA: An Improved Primary Authentication and Key Agreement Protocol for 5G Networks
## 6 Discussion  
### Security of the 5G-IPAKA Protocol  
According to the above formal verification of the 5G-IPAKA protocol, mutual authentication between the \(UE\) and the \(SN\), mutual authentication between the \(SN\) and the \(HN\) are established. Additionally, an injection agreement [28; 29; 30] among the \(UE\), the \(SN\), and the \(HN\) is established. Therefore, the 5G-IPAKA protocol is secure in the mixed strand space model. Because \(K\) is replaced with \(BK=KDF(K,x\cdot y\cdot G||SNN)\) on the \(UE\) and the \(HN\), \(AUTN\) must contain the challenge of the \(UE\) (i.e., \(x\)), which is included in \(SUICI\) generated by the \(UE\). Hence, the \(UE\) can find out whether \(SUICI\) is a replayed message. According to the above formal verification of the 5G-IPAKA protocol, mutual authentication between the \(UE\) and the \(SN\) is established. In addition, an injection agreement [28; 29; 30] among the \(UE\), the \(SN\), and the \(HN\) is established, so \(K_{SEAF}\) can reach an agreement among the \(UE\), the \(SN\), and the \(HN\). Because \(AUTN\) contains the challenge of the \(UE\) (i.e., \(x\)), the first received message of the \(UE\) (including \(AUTN\)) cannot be a replayed message, preventing the location privacy of the \(UE\) from being compromised. Since the received messages of the \(SN\) contain the challenge of the \(SN\) (i.e., \(RAND_{SN}\)), these messages cannot be some replayed messages, preventing DoS attacks against the \(SN\). In addition, the \(UE\) directly discards the first received message without respondingto a \"\(MAC\) failure\" indication when \(XMAC\) messages in the received \(AUTN\) and \(MAC\) calculated locally by the \(UE\) are different, defending against attacks based on \(MAC\) failure. Because \(K\) is replaced with \(BK=KDF(K,x\cdot y\cdot G||SN)\), and both \(K_{AUSF}\) and \(K_{SEAF}\) are generated based on \(BK\), this provides perfect forward secrecy (PFS) based on the Diffie-Hellman exchange. Hence, our proposed 5G-IPAKA protocol can overcome the above shortcomings in the latest version of the 5G AKA protocol. A comparative analysis between the 5G-IPAKA protocol and the recently improved 5G AKA protocols [23; 24; 26; 27] regarding the shortcomings of the latest version of the 5G AKA protocol is shown in Table 1.  
From Table 1, the recently improved 5G AKA protocols still have some of the shortcomings of the latest version of the 5G AKA protocol, but our proposed 5G-IPAKA overcomes all the shortcomings of the latest version of the 5G AKA protocol. In [23], the Eph private key and Eph public key of the \(UE\) (i.e., \(x\) and \(x\cdot G\)), the public-private key pair of the \(SN\), and the public-private key pair of the \(HN\) are used to ensure the security of the channel between the \(UE\) and the \(SN\), the security of channel between the \(UE\) and the \(HN\), and the security of the channel between the \(SN\) and the \(HN\). Since the first received message of the \(UE\) is encrypted by the Eph public key of the \(UE\), this means that the message can only be decrypted by the Eph private key of the \(UE\), so it cannot be a replayed message, preventing the location privacy of the \(UE\) being compromised. In addition, the \(UE\) can find out whether \(SUCI\) is a replayed message. However, the other parts fully inherit the 5G AKA protocol, so the other shortcomings of the 5G AKA protocol still exist in the protocol [23]. In [24], both the synchronization failure and the \(MAC\) failure are constructed as the format of \(RES*\), making it impossible to distinguish them so as to prevent the location privacy of the \(UE\) being compromised and prevent attacks based on \(MAC\) failure. However, the other parts fully inherit the 5G AKA protocol, so the other shortcomings of the 5G AKA protocol still exist in the protocol of [24]. In [26], \(SUCI\) is included in \(AUTH_{SEAF}\) in the second received message of the \(UE\), so the \(UE\) can find out whether \(SUCI\) is a replayed message, where \(AUTH_{SEAF}\) is an authentication token of the \(SEAF\).