# Implementation of Efficient 5G AKA Protocol for Light-Weight Environment
## 1 Introduction
### Background
#### 1.1.1 Vulnerability of the 5G AKA protocol  
5G AKA protocol is a third-party authentication protocol [20]. The four objects participating in the AKA protocol can be described as follows:  
* UE: The UE is a device used to access a network. Typically, these are mobile phones, and they can be identified in HNs through a unique identifier called subscription permanent identifier (SUPI), which plays the role of 'IMSI' in pre-5G generations. * SEAF: The security anchor functionality (SEAF) serves in the serving network (SN) as the anchor for security in 5G. The SN controls the base station to communicate wirelessly with the UE. The SEAF provides security anchor functions. * AUSF: The authentication server function (AUSF) serves the HN, which is the service provider of the subscriber. The AUSF handles authentication requests for both 3 GPP and non-3 GPP access. * ARPF: The authentication credential repository and processing function (ARPF) serves in the HN. It provides authentication and key agreement credentials. Before describing the 5G AKA protocol sequence, we provide information about the protocol. The USIM of the subscriber contains important information needed for authentication. The SUPI and HN's public keys (pkHN) and long-term keys (K) are used as shared private keys by the HN. The pkHN can encrypt the SUPI and convert it to a subscription-concealed identifier (SUCI). K is used to calculate the various key materials required to calculate the anchor key (K\({}_{\text{SEAF}}\)) and K\({}_{\text{AUSF}}\)[20]. The function used in the calculations is called the key derivation function (KDF), which is further described in the algorithm section. The protocols authenticate each other via a challenge-response method by calculating the response value (RES) and message authentication code (MAC). The RES is computed in the UE; and the XRES is computed in the HN. The SN authenticates the UE and HN by comparing the XRES and RES. The MAC is an authentication code generated by the HN, and XMAC is the value calculated by the UE. The UE authenticates the HN by comparing the MAC and the XMAC. After each is authenticated, they store the K\({}_{\text{SEAF}}\) computed in the previous process, allowing efficient access to the network in the future. The primary values used in this calculation are as follows:  
* RAND: The 128-bit random value. * AUTN: The authentication token consists of the sequence number (SQN), authentication management field (AMF) and the MAC. These materials require key calculation and synchronization verification for freshness of the authentication(synchronization). * (X)RES*, H(X)RES*: The (X)RES* is a calculated value using RES by KDF to authenticate the UE and the HN. The H(X)RES* is the hash-based authentication code (HMAC) calculated with the RES* using the sha-256 hashing algorithm. Comparing (X)RES*is at HN side and comparing H(X)RES* is at SN side. More details about calculating *-labelled value and HMAC are at Section 1.1.2. * \(\mathrm{K_{AUSF}}\): The top-level key required to compute \(\mathrm{K_{SEAF}}\). \(\mathrm{K_{AUSF}}\) and \(\mathrm{K_{SEAF}}\) are calculated using the KDF. * Cypher key (CK), Integrity key (IK) and Anonymity key (AK): These are the keys for use in KDF. * AV: Authentication vector (AV) is the vector flow in HN and SN. HE AV is the AV flow between the ARPF and AUSF, and SE AV is the AV flow between the SEAF and AUSF. HE AV consists of RAND, XRES*, \(\mathrm{K_{AUSF}}\) and AUTN. SE AV consists of RAND, HXRES* and AUTN. There are two cases in which the protocol fails. The first is when the MAC and XMAC do not match. If these two values do not match, the protocol is interrupted by the MAC failure message. The other is when the sequence number (SQN) is not within the allowed increment range. The SQN is a number that sequentially increases during the protocol. Its value is used during the authentication process. If the difference between the SQN calculated by HN and that calculated by the UE is large, the protocol is interrupted with a synchronization failure message.