GSM Man-in-the-Middle (MITM) Attack Techniques
Man-in-the-Middle (MITM) attacks on GSM networks are some of the most effective and stealthy methods for intercepting and manipulating mobile communications. By exploiting the inherent vulnerabilities in GSM technology, attackers can position themselves between the victim’s mobile device and the legitimate network, hijacking everything from calls to SMS and data traffic. Using tools like OpenBTS, YateBTS, and Osmocom, an attacker can seamlessly spoof a GSM base station (BTS), tricking nearby mobile devices into connecting through their malicious network.
This guide will take you through how these GSM MITM attacks are executed, including setting up fake base stations, capturing communications, and manipulating the traffic passing through the rogue network.
Step 1: Understanding the GSM MITM Attack
In a GSM MITM attack, the goal is to intercept and manipulate the communication between a mobile phone and the legitimate GSM network. The attacker essentially acts as a proxy, sitting between the mobile device and the network to:
- Intercept calls and SMS: Capture and eavesdrop on voice and SMS traffic.
- Manipulate data traffic: Inject, alter, or block communications.
- Track users: Collect IMSI (International Mobile Subscriber Identity) and other identifying information from connected devices.
Why GSM Is Vulnerable
- No Mutual Authentication: GSM doesn’t require the mobile device to authenticate the base station it connects to. As long as the rogue BTS presents a stronger signal, the phone will connect to it.
- Weak or No Encryption: Many GSM networks still use outdated encryption (like A5/1), or sometimes no encryption at all. This makes it trivial to capture and decrypt communications once connected to the rogue BTS.
Step 2: Setting Up a Rogue GSM Base Station with OpenBTS or YateBTS
The first step in executing a GSM MITM attack is to set up a rogue base station that mimics the legitimate network. This is where tools like OpenBTS or YateBTS come into play. These tools allow you to create a fully functional GSM BTS that tricks nearby phones into connecting to it.
Hardware Requirements
- Software-Defined Radio (SDR): You’ll need a capable SDR like HackRF, USRP (Universal Software Radio Peripheral), or BladeRF to transmit and receive GSM signals.
- Antenna: A GSM-compatible antenna tuned to the frequencies used by your target network.
- Computer: A machine capable of running OpenBTS or YateBTS and controlling the SDR.
Software Requirements
- OpenBTS: An open-source implementation of a GSM base station. It allows you to create your own GSM network.
- YateBTS: Another GSM base station implementation that works similarly to OpenBTS, with more focus on voice-over-IP (VoIP) integration.
- Wireshark: For analyzing GSM packets and traffic.
Step 3: Configuring the Fake Base Station
Once you have the hardware and software in place, the next step is to configure your rogue base station to appear as a legitimate GSM tower. You’ll need to mimic the target network’s Mobile Network Code (MNC) and Mobile Country Code (MCC), which identify the carrier and country.
Setting Up OpenBTS:
Install OpenBTS:
sudo apt-get install openbts
Configure the SDR:
Use OpenBTS to configure your SDR to broadcast on the same frequency as the legitimate network’s base station.
sudo openbts -c /etc/OpenBTS/openbts.conf
In the configuration file, set the MCC and MNC to match the target network. For example, if you’re targeting a network in the U.S., set:
GSM.MCC 310
GSM.MNC 260
Set the Broadcast Signal:
Tune the fake BTS to the appropriate GSM frequency. Depending on your region, you’ll want to operate within the 850/900/1800/1900 MHz bands:
GSM.Radio.C0 512 # (Set to match the legitimate network's control channel)
Once your fake BTS is configured, it will begin broadcasting as if it were a legitimate GSM tower. Any nearby devices that detect a strong signal will attempt to connect to your rogue station.
Step 4: Forcing Devices to Connect to Your Rogue BTS
Now that the rogue BTS is live, the next step is forcing nearby phones to connect to it. GSM phones will always connect to the strongest available signal, even if it’s a rogue BTS. Here’s how attackers ensure devices connect to their fake base station:
1. Broadcast a Stronger Signal
The most straightforward way to force phones to connect to your fake BTS is by broadcasting a stronger signal than the legitimate towers. Mobile devices prioritize connecting to the strongest signal they detect. By boosting the signal strength of the rogue BTS, phones will drop their connection to the legitimate network and join your malicious tower.
2. Disable Encryption
Many GSM networks use outdated encryption (A5/1 or A5/2) or may not use encryption at all. You can configure your rogue BTS to either disable encryption or use the weak A5/1 algorithm. This ensures that any traffic passing through your fake tower is either completely unencrypted or weakly encrypted, making it trivial to intercept.
In OpenBTS, you can force no encryption by setting:
GSM.Identity.Cipher none
With this, any calls, SMS, or data sent through the rogue BTS will be in plaintext.
Step 5: Intercepting and Manipulating Traffic
Once the victim’s phone is connected to your rogue BTS, you can start intercepting and manipulating traffic. Here’s what you can do:
1. Capturing IMSI and IMEI
When a device connects to the rogue BTS, it sends its IMSI (International Mobile Subscriber Identity) and IMEI (International Mobile Equipment Identity) during the initial handshake. These identifiers can be captured and used to track the device or clone the SIM for later use.
In OpenBTS, this information is captured automatically and stored in logs:
tail -f /var/log/openbts.log
You’ll see entries like:
IMSI: 310260000000000
IMEI: 123456789012345
2. Eavesdropping on Calls and SMS
With the victim connected to the rogue BTS, you can intercept calls and SMS messages. Tools like Wireshark can be used to capture and analyze the GSM packets as they pass through the BTS.
- SMS Interception: You can capture SMS messages in real-time, which may include sensitive information like two-factor authentication codes, passwords, or personal messages.
- Call Interception: Voice calls passing through the rogue BTS can be recorded and played back later. This is especially easy if no encryption is used or if weak encryption algorithms like A5/1 are in place.
3. Data Interception and Manipulation
Any data session initiated by the victim (such as web browsing, email, or app activity) can be intercepted. Attackers can capture login credentials, sensitive information, or manipulate the data. For example, redirecting the victim to malicious websites where malware can be served.
- DNS Hijacking: By manipulating the DNS responses on the rogue BTS, attackers can redirect the victim’s web traffic to any destination they choose.
- Man-in-the-Browser Attacks: Injecting malicious code into the victim’s web traffic allows attackers to manipulate the victim’s browsing experience or steal credentials.
Step 6: Manipulating Call Routing and SMS Delivery
An attacker can go beyond just eavesdropping and actively manipulate the traffic. By altering how the rogue BTS forwards traffic to the legitimate network, attackers can control who the victim is actually communicating with.
1. Call Forwarding:
Instead of forwarding calls directly to the intended recipient, the attacker can route them through another phone or VoIP service, allowing them to eavesdrop on the entire conversation.
2. SMS Redirection:
By intercepting SMS messages, attackers can manipulate the content before forwarding them to the intended recipient or block the messages altogether. This could be used to sabotage communications or alter key information in transactional messages.
Step 7: Handoff to the Legitimate Network (Optional)
To remain stealthy and avoid suspicion, attackers can forward traffic from the rogue BTS to the legitimate network, making it appear as though the phone is operating normally. The victim remains connected to the rogue BTS, but their calls, SMS, and data are forwarded to the real network after being intercepted.
In OpenBTS, you can configure the handoff to the legitimate network using a SIP gateway or other VoIP methods to forward the traffic seamlessly.
Conclusion
GSM MITM attacks, facilitated by tools like OpenBTS, YateBTS, and Osmocom, allow attackers to completely hijack the communication between a mobile device and the legitimate network. By setting up a rogue base station and tricking nearby devices into connecting to it, attackers can intercept calls, SMS, and data, manipulate traffic, and even track devices using their IMSI and IMEI.
With the right setup, the attacker essentially becomes the mobile network itself, controlling every aspect of the victim’s communication flow. Once connected, the possibilities for exploitation are endless, from eavesdropping
and data theft to real-time traffic manipulation and redirection.