Hello! Welcome to the final lesson of our first module, "Cellular Network Foundations."
Introduction
In our previous lesson, we established that the USIM card is a secure microcomputer holding the "crown jewels" of your mobile identity: a unique, secret key K that it shares only with your home network's authentication center. We saw that this key is designed to never leave the USIM, which acts as a secure black box, performing cryptographic operations on demand.
Today, we will see exactly how the network uses that secret key to verify your identity and establish a secure channel for communication. This lesson addresses the learning outcome: Explain the high-level purpose of the Authentication and Key Agreement (AKA) protocol. We'll tie together everything we've learned about identifiers, SIM cards, and network components to understand this fundamental security procedure.
For your goal of learning telecommunication hacking, this is the most critical lesson in this module. The AKA protocol is the gatekeeper of the network. Every data session, every call, and every text message is preceded by this procedure. Understanding its mechanics is the first step to understanding major vulnerabilities like IMSI catching, downgrade attacks, and session hijacking.
The Core Purpose of AKA
At its heart, the Authentication and Key Agreement (AKA) protocol has three main objectives. It's a cryptographic handshake designed to ensure that when your phone connects, it's talking to a legitimate network, and the network is talking to a legitimate subscriber.
Breaking Down AKA: Authentication & Key Agreement Protocols in Mobile Networks
This article from the security research firm P1 Security provides a concise definition of AKA and its goals. It also sets the stage by placing AKA within the context of different cellular generations.
Read the first two sections, 'What Is AKA (Authentication and Key Agreement)?' and 'The AKA Family Tree'. Focus on the three core functions of AKA and how the protocol has evolved from the weak security of 2G to the more robust systems in 4G and 5G.
As you just read, the three primary goals are:
- User Authentication: The network verifies the identity of the user (or more accurately, the USIM).
- Network Authentication: The user's device verifies that it is connected to a legitimate network, not a malicious rogue base station. This is often called mutual authentication.
- Key Agreement: Both the user's device and the network independently generate an identical set of temporary session keys. These keys are then used to protect the communication through encryption and integrity protection.
Let's watch a video that breaks down these security goals in the context of 4G/LTE.
Security in LTE - Authentication, Integrity and Encryption Keys HSS MME UE eNodeb
This video from Telco Bytes explains the 'why' behind LTE security before diving into the 'how'.
Watch the first part of the video (00:03 - 04:52). The narrator explains the three pillars of LTE security: authentication, integrity protection, and encryption. Notice how these align perfectly with the goals of AKA.
The AKA Procedure: A Challenge-Response Handshake
The AKA protocol is a classic challenge-response mechanism. The process relies on the fact that both the USIM card and the network's Home Subscriber Server (HSS) possess the same secret key, K.
The high-level idea is:
- The network sends a random number (the challenge) to the phone.
- The USIM card uses its secret key
Kto perform a set of cryptographic calculations on that random number. - The USIM sends the result (the response) back to the network.
- Meanwhile, the HSS performs the exact same calculations using its copy of the secret key
K. - The network compares the response it received from the phone with the expected response it calculated itself. If they match, the subscriber is authentic.
This is a simplified view. The actual process also includes the mutual authentication step (where the USIM verifies the network) and the key generation. Let's walk through the full 4G EPS-AKA procedure.
Security in LTE - Authentication, Integrity and Encryption Keys HSS MME UE eNodeb
The same Telco Bytes video provides an excellent animated sequence diagram explaining the AKA flow. This is where you'll see all the components we've discussed—UE, MME, HSS—interacting.
Watch the section from 11:52 to 17:56. Pay close attention to these key steps and values: Authentication Information Request: The MME asks the HSS for 'authentication vectors'. Authentication Vectors: The HSS generates RAND (the random challenge), AUTN (the network authentication token), XRES (the expected response), and derives the K_ASME key. Authentication Request (UE): The MME sends the RAND and AUTN to the UE. USIM Validation: The USIM uses K to verify the AUTN (authenticating the network) and computes its own response, RES. Authentication Response (MME): The UE sends RES back to the MME. Final Check: The MME compares the received RES with the XRES from the HSS. If they match, authentication is successful.
Here is a static diagram showing a similar flow. You can use this as a reference to consolidate what you saw in the video.

From Authentication to Agreement: Deriving the Keys
Successful authentication is only half the battle. The "Key Agreement" part of AKA is what allows us to secure the connection after authentication.
Once the UE and MME have successfully authenticated each other, they have both proven they possess the necessary secrets. This allows them to independently derive a hierarchy of session keys, all seeded from the master key K.
This key hierarchy is crucial. Instead of using one key for everything, different keys are generated for different purposes, limiting the impact if any single session key were to be compromised.

Now, let's see how this key derivation fits into the overall process.
Security in LTE - Authentication, Integrity and Encryption Keys HSS MME UE eNodeb
Let's revisit the 'Security in LTE' video to understand this key hierarchy and see how the keys are put into use after the authentication handshake is complete.
First, watch from 04:52 to 11:52 to understand the key hierarchy. Focus on how everything originates from K and leads to K_ASME, which is the root key for the serving network. Then, watch from 17:56 to 22:47. This part explains the Security Mode Command procedure, which is how the network and UE officially activate encryption and integrity protection using the newly derived NAS and RRC keys.
To summarize the entire process:
- Authentication: The UE and network perform the AKA challenge-response to prove their identities.
- Key Derivation: Upon success, both sides calculate the same master session key for the serving network (
K_ASME). - Security Activation: The network sends a
Security Mode Commandto the UE. From this point on, all further signaling communication is encrypted and integrity-protected using keys derived fromK_ASME.
The Hacker's Perspective: A "Secure-in-Theory" Protocol
The EPS-AKA protocol is cryptographically sound. However, its implementation in the real world creates vulnerabilities. Your experience in web security has likely taught you that a perfectly good cryptographic algorithm can be undermined by a weak protocol design.
The most significant flaw in the 4G attach procedure relates to what happens before AKA even begins.
Breaking Down AKA: Authentication & Key Agreement Protocols in Mobile Networks
Let's return to the P1 Security article, which does a great job of highlighting the practical weaknesses of EPS-AKA.
Read the section titled 'EPS-AKA (4G): Authentication in the Evolved Packet System', paying special attention to the subsection 'Where It Fails'.
As the article points out, the biggest issue is IMSI disclosure. When a phone connects to a network for the first time (or its temporary identifier, GUTI, is no longer valid), it sends its permanent identifier, the IMSI, in an Attach Request message. This message is sent in cleartext before any security is established.
This is the fundamental vulnerability that enables IMSI Catchers (also known as "Stingrays"). A rogue base station can simply sit and listen for these initial Attach Request messages to collect the IMSIs of all phones in the area, allowing an attacker to track specific individuals. We will build and operate an IMSI Catcher later in this course.
Conclusion
You have now completed the foundational module of this course and understand the core security mechanism of cellular networks.
Key Takeaways:
- The Authentication and Key Agreement (AKA) protocol has two main goals: mutual authentication (UE ↔ Network) and the agreement of session keys.
- It is a challenge-response protocol that works because both the USIM and the HSS share a long-term secret key,
K. - A successful AKA procedure results in a hierarchy of keys (
K_ASME, NAS keys, RRC keys) used to encrypt and integrity-protect signaling and user data. - While the cryptography is strong, the 4G/LTE protocol has a major weakness: the IMSI is sent in cleartext before the AKA procedure begins, enabling IMSI catching attacks.
Preview of the Next Module:
With this theoretical foundation in place, it's time to get your hands dirty. In our next module, "Passive Reconnaissance with Software-Defined Radio," we will move from diagrams and theory to the real world. You'll learn how to use your RTL-SDR and open-source software to find and listen to the very cellular signals that carry these protocols. Our first lesson will be: Configure an RTL-SDR to scan for cellular signals.