## 6 Security and Feature Analysis
### Security Analysis  
The security analysis focuses on identifying and evaluating potential security risks, threats, and vulnerabilities associated with the 3-Tier AKA. It involves assessing the effectiveness of security measures implemented within the protocol when facing common attacks, such as spoofing attacks, information disclosure, denial of service, and elevation of privilege. The aim is to identify any weaknesses or potential areas of exploitation that could compromise 3-Tier AKA's security. * Data integrity and tampering attack: Data integrity in authentication protocols ensures data remain uncorrupted and untampered, while tampering attacks involve unauthorized modification of message exchanges for malicious purposes, thereby preventing data tampering. The proposed protocol is designed to prevent message leakage. Each message sent between participants is encrypted. Once the attacker modifies the plaintext sent among the protocol participants, the receiver cannot decrypt it with the specified secret key. This modification will be discovered immediately. The following scenarios depict the potential consequences when a message undergoes modifications during Authentication and Key Agreement phase message transmission; see Figure 6. In step1, if the token \(O_{\delta_{d}}\) is modified, the 5G service provider \(u_{v}\) will not be able to retrieve the accurate secret key \(K_{\delta_{d}}\) due to it being encrypted by \(u_{v}\) master secret key \(S_{u_{v}}\). If \(proofMe\) is modified, \(u_{v}\) cannot obtain the time stamp, compare it to the current one, or obtain the correct user ID. Moreover, it is highly improbable for an adversary to create a legitimate \(O_{\delta_{d}}\) since its creation involves the utilization of \(S_{u_{v}}\), which represents the master key of the 5G service provider. During step 2, it is important to note that the adversary does not know the edge user's secret key \(K_{\delta_{d}}\). Hence, any attempts to modify \"\(\delta_{d}to_{c}^{*}\)\", \(K_{\delta_{d}\delta_{c}}\), or \(proof_{\delta_{d}}\) would be unfeasible for the adversary. Similar to step 2, the adversary is unable to tamper with \"\(\delta_{d}to_{c}^{*}\)\" or the timestamp in step 3. Suppose the adversary modifies the transmission message in the fourth step. In that case, the 5G service provider will be unable to retrieve any valid information due to using the master secret key. Then, the authentication fails. It is crucial to emphasize that safeguarding data integrity is not solely reliant on the authentication protocol but is a vital aspect to be considered across the entire system's design and implementation. * Spoofing: A security attack where an attacker pretends to be a specific edge device to deceive the fog node (the victim) into revealing the key information, or vice versa. In this protocol, if a malicious attacker M wants to pretend to be a legitimate user, \(M\) must calculate a self-authentication message \(proofMe=E(T\parallel``\delta_{m}to_{c}^{*}\)\", \(K_{\delta_{m}}\)) and a token \(O_{\delta_{m}}=E(``\delta_{m}ID^{\prime\prime}\parallel K_{\delta_{m}},S_{u_{v}})\), where \(K_{\delta_{m}}\) is a faked secret key for \(M\) and \(S_{u_{v}}\) is the master key of the 5G service provider. The attacker can generate a fake \(proofMe\) message, but not the token, because \(S_{u_{v}}\) is known only by the 5G service provider. Therefore, the attacker will send a token that is recorded from previous sessions as a fake token instead. However, the 5G network will drop and close the session because the retrieved secret key in the received token does not match the attacker faked secret key for \(M\). Therefore, the proposed protocol can prevent spoofing attacks. * Man-in-the-middle attack (MitM): This is a cybersecurity attack where an attacker intercepts and potentially alters communications between two parties, allowing them to capture, manipulate, or eavesdrop on the exchanged information.