TL;DR — Despite significant security improvements over 4G LTE, 5G networks inherit legacy protocol attack surfaces through SS7/Diameter interconnects, remain vulnerable in Non-Standalone (NSA) deployment mode to IMSI catchers and downgrade attacks, and expose new API-level attack vectors through the Service-Based Architecture (SBA) HTTP/2 interfaces — making 5G core security a critical research domain for telecom penetration testers and national security researchers.
Executive Summary
Fifth generation mobile networks were designed with security as a first-class requirement, addressing known weaknesses in 3G and 4G that allowed SS7-based location tracking, call interception, and subscriber impersonation. 5G's Security Architecture introduces mutual authentication between the device and the network using 5G-AKA and EAP-AKA' protocols, encrypts the subscriber identifier (SUCI instead of plaintext IMSI), and mandates TLS for inter-network signaling. On paper, this represents a massive security improvement.
In practice, the picture is considerably more complex. The vast majority of current 5G deployments use Non-Standalone (NSA) architecture, where the 5G New Radio (NR) radio layer operates atop a 4G LTE core — inheriting 4G's security properties, including SS7 exposure through roaming interconnects. Even in Standalone (SA) 5G deployments, the Service-Based Architecture exposes HTTP/2 APIs that may be inadequately secured in real-world implementations. The GTP-U tunneling protocol underpinning 5G user plane transport has documented attack vectors for tunnel injection and location spoofing. Network slicing, while providing logical isolation, shares physical infrastructure in ways that enable resource exhaustion and — in some implementations — cross-slice data access.
This post provides a comprehensive technical analysis of the 5G attack landscape: legacy protocol bridges that preserve SS7 vulnerabilities in a 5G world, fake base station attacks in NSA mode, SBA API exploitation, GTP-U attacks, network slice isolation failures, baseband processor vulnerabilities, and rogue network function registration. The goal is to give telecommunications security professionals, mobile network operators, and offensive security researchers a complete understanding of where 5G security succeeds and where it falls short.
5G Architecture Deep Dive
5G Core (5GC) Network Functions
The 5G Core replaces the monolithic evolved Packet Core (EPC) of 4G with a cloud-native microservices architecture. Each network function exposes a REST-like API over HTTP/2:
| Network Function | Role | Key API Endpoints |
|---|---|---|
| AMF (Access and Mobility Management) | Handles UE registration, mobility | /namf-comm, /namf-evts |
| SMF (Session Management) | Manages PDU sessions | /nsmf-pdusession |
| UPF (User Plane Function) | Routes user data packets | (GTP-U control via PFCP) |
| UDM (Unified Data Management) | Stores subscriber profiles | /nudm-sdm, /nudm-ueau |
| AUSF (Authentication Server) | Authenticates UEs | /nausf-auth |
| NRF (Network Repository Function) | Service discovery registry | /nnrf-nfm, /nnrf-disc |
| PCF (Policy Control Function) | Manages QoS policies | /npcf-am-policy |
| SEPP (Security Edge Protection Proxy) | Inter-PLMN signaling security | N32 interface |
The NRF acts as a service registry — network functions register themselves and discover others through it. This centralized discovery mechanism is a significant attack target.
Service-Based Architecture Communication
graph TD
UE[User Equipment 5G Phone] -->|N1 NAS| AMF
gNB[gNB Base Station] -->|N2 NGAP| AMF
gNB -->|N3 GTP-U| UPF
AMF <-->|SBI HTTP/2| SMF
AMF <-->|SBI HTTP/2| AUSF
AMF <-->|SBI HTTP/2| UDM
AUSF <-->|SBI HTTP/2| UDM
SMF <-->|SBI HTTP/2| UDM
SMF <-->|SBI HTTP/2| PCF
SMF <-->|PFCP N4| UPF
UPF -->|N6| Internet
AMF <-->|SBI HTTP/2| NRF
SMF <-->|SBI HTTP/2| NRF
NRF -->|Registry| AllNFs[All Network Functions]
SEPP -->|N32 between operators| RemoteSEPP[Remote Operator SEPP]All inter-NF communication uses OAuth 2.0 client credentials for authorization in the reference architecture. However, implementation details matter enormously — and this is where vulnerabilities emerge.
Legacy Protocol Bridges: SS7 in the 5G Era
Why SS7 Still Exists in 5G
SS7 (Signaling System 7) was designed in the 1970s with an implicit trust model: if you're on the SS7 network, you're a trusted telephone company. Every mobile network in the world is still connected to SS7 for roaming interoperability, voice call routing, and SMS delivery. 5G did not replace SS7 — it added a parallel architecture alongside it.
When a 5G user roams internationally, their home network (HPLMN) may be a 5G SA network, but the visited network (VPLMN) may still use 4G or 3G infrastructure. Roaming signaling flows through SS7 MAP (Mobile Application Part) or Diameter — both of which have well-documented attack capabilities.
SS7 Attack Capabilities Against 5G Subscribers
An attacker with access to the SS7 network — which can be purchased from rogue operators, obtained through compromised operators, or accessed through certain research network memberships — can execute:
Location Tracking via SendRoutingInfoForSM:
# SS7 MAP SendRoutingInfoForSM attack# Sends an SMS routing query that returns the MSC address# MSC address → Cell Tower → Subscriber location (city/district level) SRI-SM Request: msisdn: +1-555-TARGET-NUMBER sm-RP-PRI: TRUE serviceCentreAddress: [attacker's fake SMSC address] SRI-SM Response: imsi: 310410XXXXXXXXXXX ← Subscriber's IMSI revealed networkNode-Number: +1-555-MSC-ADDRESS ← Which MSC the phone is camped on # MSC address maps to a geographic area# Combine with ATI (Any Time Interrogation) for precise location:ATI Request: subscriberIdentity: IMSI from above requestedInfo: location-information ATI Response: cellGlobalId: MCC-MNC-LAC-CI ← Specific cell tower IDSMS Interception via UpdateLocation: An attacker registers a fake HLR (Home Location Register) to redirect SMS delivery to an attacker-controlled node. This technique has been used to intercept SMS-based two-factor authentication codes for banking and email accounts.
5G Downgrade Attack: In NSA mode (the dominant current deployment), forcing a device from 5G NR to 4G LTE is trivial — simply jamming the 5G frequency bands or broadcasting a fake cell with higher signal strength causes devices to fall back to 4G. Once on 4G, all 4G attack capabilities apply including IMSI capture and protocol-level man-in-the-middle.
Fake Base Station (IMSI Catcher) Attacks
4G vs 5G Authentication Differences
In 4G, the IMSI is transmitted in plaintext during the attach procedure if the device doesn't have a GUTI (Globally Unique Temporary Identifier). An IMSI catcher (Stingray) presents as a legitimate base station and captures the IMSI during the authentication sequence.
In 5G Standalone mode, the SUCI (Subscription Concealed Identifier) replaces the plaintext IMSI. The SUCI uses Elliptic Curve Integrated Encryption Scheme (ECIES) to encrypt the MSIN (Mobile Subscriber Identification Number) using the Home Network Public Key. Only the home network can decrypt it — a false base station cannot.
However, in NSA mode:
- The 5G radio uses 4G core authentication procedures
- IMSI exposure remains possible through 4G fallback
- The protection depends entirely on whether the 4G LTE layer implements proper IMSI encryption (many don't)
Open-Source IMSI Catcher Research Tools
For authorized research environments and red team exercises against mobile network operators:
# OpenBTS or srsRAN for creating a research base station# Legal use ONLY: requires spectrum license and operator authorization # srsRAN 4G setup for researchgit clone https://github.com/srsran/srsRAN_4Gcd srsRAN_4Gmkdir build && cd buildcmake .. -DENABLE_GUI=ONmake -j$(nproc) # Configure as a small cell for researchcat > enb.conf << 'EOF'[enb]enb_id = 0x19Bmcc = 001 # Test MCC (not a real operator)mnc = 01mme_addr = 127.0.0.1gtp_bind_addr = 127.0.0.1s1c_bind_addr = 127.0.0.1n_prb = 50 [rf]dl_earfcn = 3400tx_gain = 60rx_gain = 40device_name = uhd # USRP hardwareEOF # For 5G NR researchgit clone https://github.com/srsran/srsRAN_Project5G Core API Exploitation
NRF Discovery — Unauthenticated Service Enumeration
The NRF provides service discovery. In some implementations, NF discovery requests may not require authentication, allowing enumeration of all network functions and their API endpoints:
# 5G NRF discovery request (RFC 8259 JSON over HTTP/2)# Enumerate all SMF instancescurl -s --http2 \ -H "Content-Type: application/json" \ "https://nrf.operator.com:8080/nnrf-disc/v1/nf-instances?target-nf-type=SMF" | \ python3 -m json.tool # Expected response (if unauthenticated):{ "validityPeriod": 3600, "nfInstances": [ { "nfInstanceId": "smf-1-uuid", "nfType": "SMF", "nfStatus": "REGISTERED", "ipv4Addresses": ["10.0.0.5"], "nfServiceList": { "nsmf-pdusession": { "apiVersionInUri": "v1", "apiFullVersion": "1.0.0", "ipEndPoints": [{"ipv4Address": "10.0.0.5", "port": 8080}] } } } ]}With SMF endpoint addresses known, an attacker inside the operator network (via supply chain compromise, insider threat, or perimeter breach) can target session management functions directly.
SBI Message Injection
The Service-Based Interface uses JSON-encoded HTTP/2 messages. Injection vulnerabilities arise when network functions fail to validate input:
# Hypothetical SBI injection against a vulnerable AMFimport httpximport json # Attacker scenario: insider with access to SBI network segment# Target: Force AMF to deregister a subscriber (DoS) AMF_ENDPOINT = "https://amf.internal:8080" # Craft malicious Namf_Communication_N1N2MessageTransfer# with oversized or malformed JSON to test input validationmalicious_payload = { "n1MessageContainer": { "n1MessageClass": "SM", "n1MessageContent": { "contentId": "A" * 10000 # Oversized content ID } }, "n2InfoContainer": { "n2InformationClass": "' OR 1=1 --" # JSON injection attempt }, "ueId": "imsi-310410123456789", "pduSessionId": 999999 # Out-of-range value} async def test_sbi_injection(): async with httpx.AsyncClient(http2=True, verify=False) as client: response = await client.post( f"{AMF_ENDPOINT}/namf-comm/v1/ue-contexts/imsi-310410123456789/n1-n2-messages", json=malicious_payload, headers={ "Authorization": "Bearer STOLEN_OAUTH_TOKEN", "Content-Type": "application/json" } ) print(f"Status: {response.status_code}") print(f"Response: {response.text}")GTP-U Tunneling Attacks
GPRS Tunneling Protocol (GTP) carries user data between the gNB (5G base station) and UPF. GTP-U packets are UDP-encapsulated with a Tunnel Endpoint Identifier (TEID). Attacks against GTP:
GTP-U Tunnel Injection
If an attacker gains access to the GTP network segment (the N3 interface between gNB and UPF), they can inject forged GTP-U packets into an existing tunnel:
GTP-U Packet Structure:┌─────────────────────────────────────────────┐│ UDP Header (src: 2152, dst: 2152) │├─────────────────────────────────────────────┤│ GTP Header ││ Version: 1 PT: 1 E/S/PN flags ││ Message Type: 0xFF (G-PDU) ││ Length: [payload length] ││ TEID: [Tunnel Endpoint ID] ← Key field │├─────────────────────────────────────────────┤│ Inner IP Packet (user data) │└─────────────────────────────────────────────┘ Attack: If TEID is guessable or leaked, inject packets into victim's tunnelResult: Man-in-the-middle of user's data stream, or DoS via malformed packetsLocation Spoofing via GTP-C
GTP-C (Control Plane) manages tunnel creation and modification. By sending forged GTP-C Update Bearer Request messages, an attacker can:
- Modify the UPF's record of where the user's traffic should be tunneled
- Redirect victim's traffic to an attacker-controlled endpoint
- Perform billing fraud by claiming a device is in a different location
Network Slice Isolation Attacks
Network slicing allows operators to create virtual networks for different use cases on shared physical infrastructure. 3GPP defines slices for eMBB (enhanced Mobile Broadband), URLLC (Ultra-Reliable Low Latency), and mMTC (massive Machine Type Communications).
Resource Exhaustion Against Specific Slices
Each slice has configured resource limits. An attacker with a SIM on a shared slice can attempt to exhaust resources allocated to a high-priority slice:
# Using a modified UE simulator (srsRAN UE) to generate traffic# against a specific network slice# This is a DoS attack against slice-specific resources # iperf3 style traffic generation via UE# Attacker controls multiple SIMs on URLLC slice# Floods with UDP packets to exhaust TEID space and processing capacity # In practice: coordinated IoT devices on an mMTC slice# sending maximum-rate signaling messages to overwhelm AMF# processing for all slices on that AMF instanceCross-Slice Data Leakage
In some virtualized 5G core implementations using shared Kubernetes clusters:
- Container network policies may be misconfigured, allowing inter-slice traffic
- Shared memory in hypervisors enables side-channel information leakage between slices
- Logging infrastructure aggregating from all slices may expose sensitive data from higher-security slices to lower-security slice administrators
Baseband Processor Vulnerabilities
The baseband processor handles all radio protocol stack processing — LTE/NR PHY, MAC, RLC, PDCP, RRC layers. It runs proprietary RTOS code on dedicated silicon and has a history of critical vulnerabilities:
| Vendor | CVE | Impact |
|---|---|---|
| Qualcomm | CVE-2020-3655 | Remote code execution via crafted LTE RRC message |
| Qualcomm | CVE-2021-1906 | Heap overflow in LTE RRC processing |
| Samsung Exynos | CVE-2023-24033 | RCE via crafted IP packets (no user interaction) |
| Samsung Exynos | CVE-2023-26072/26073 | Stack overflow in 5G NR RRC decoder |
| MediaTek | CVE-2022-26473 | Privilege escalation via modem control interface |
The Samsung Exynos CVE-2023-24033 class of vulnerabilities is particularly severe: they allow remote code execution with no user interaction via maliciously crafted network packets. An attacker with a software-defined radio can send crafted RRC (Radio Resource Control) messages to any device within radio range — no network operator access required.
Rogue Network Function Registration
In the 5G SBA, network functions must register with the NRF before other NFs will communicate with them. If NRF authentication is weak or the SBI network is compromised, an attacker can register a malicious network function:
sequenceDiagram
participant Attacker as Malicious NF (Attacker)
participant NRF as NRF Registry
participant AMF
participant UPF
Attacker->>NRF: POST /nnrf-nfm/v1/nf-instances/{uuid} [Register as UPF]
NRF-->>Attacker: 201 Created (if auth is weak)
AMF->>NRF: GET /nnrf-disc/v1/nf-instances?target-nf-type=UPF
NRF-->>AMF: Returns both real UPF and malicious UPF endpoints
AMF->>Attacker: PFCP Session Establishment (thinking it's UPF)
Attacker-->>AMF: PFCP Session Establishment Response
Note over Attacker,UPF: Attacker intercepts all user plane traffic<br/>forwarded through the "UPF"
UE-->>Attacker: All user data flows through malicious UPF
Attacker->>UPF: Optionally forward to real UPF (transparent MitM)This attack is theoretically possible when: OAuth 2.0 tokens are not properly validated, network segmentation does not prevent unauthorized access to the SBI network, and the NRF does not implement mutual TLS with certificate pinning for NF registration.
5G Security Testing Tools
# Open5GS — Open source 5G core for researchgit clone https://github.com/open5gs/open5gs# Deploy with Docker Compose for a complete 5G SA test environment # UERANSIM — 5G NR simulator (gNB + UE)git clone https://github.com/aligungr/UERANSIMcd UERANSIMmake # Test 5G registration procedure./nr-ue -c config/open5gs-ue.yaml &./nr-gnb -c config/open5gs-gnb.yaml & # Wireshark dissectors for 5G protocols# NGAP (N2 interface), NAS-5GS, PFCP, GTP-U, HTTP/2 with JSON# Install 5G NAS dissector pluginwireshark -X lua_script:/path/to/5g-nas-dissector.lua # SBIsec — 5G SBI security testing framework (research)# Tests OAuth token validation, input validation on SBI APIs# https://github.com/5GSecLab/SBIsec (illustrative) # SS7 testing (authorized use only)# SigPloit framework for SS7/Diameter/GTP testinggit clone https://github.com/SigPloiter/SigPloit5G Security Comparison: NSA vs SA
| Security Property | 4G LTE | 5G NSA | 5G SA |
|---|---|---|---|
| IMSI Protection | Minimal (GUTI sometimes) | Same as 4G | SUCI encryption |
| False Base Station | Vulnerable | Vulnerable | Improved resistance |
| SS7 Exposure | Full | Full (via 4G) | Reduced (SEPP) |
| Inter-operator Security | SS7/Diameter (no mutual auth) | Same as 4G | SEPP with TLS |
| User Plane Encryption | Optional | Optional | Mandatory in spec |
| Network Slicing | No | Limited | Full isolation spec |
| SBA Security | N/A | N/A | OAuth 2.0 + TLS |
| Baseband Vulnerabilities | Yes | Yes | Yes (hardware issue) |
Conclusion
5G security is a study in the gap between specification and implementation. The 3GPP standards represent genuine security improvements over previous generations: SUCI-based IMSI protection, mandatory mutual authentication, SEPP for inter-operator security, and OAuth 2.0 for intra-core API authorization. These are meaningful advances.
Yet the attack surface remains vast. The NSA deployment model — which dominates global 5G rollout today — preserves 4G's SS7 exposure for roaming scenarios. Baseband processors running proprietary RTOS code continue to harbor remotely exploitable vulnerabilities that affect billions of devices simultaneously. GTP-U's lack of authentication creates injection opportunities on compromised operator networks. The Service-Based Architecture's HTTP/2 APIs introduce web application attack patterns into telecom core infrastructure — a domain where operators may lack the web security expertise to defend against them properly.
5G penetration testing requires a unique combination of telecom protocol knowledge (SS7, Diameter, GTP, NGAP, NAS), web application security skills (OAuth, HTTP/2, REST API testing), hardware capabilities (SDR for radio testing), and cloud-native infrastructure knowledge (Kubernetes, containerized network functions). As 5G becomes the backbone of critical infrastructure — factories, hospitals, smart cities, autonomous vehicles — the security of 5G core networks becomes a matter of national security, not merely telecommunications compliance.
MITRE ATT&CK Mapping
| Technique ID | Technique Name | 5G Context |
|---|---|---|
| T1557 | Adversary-in-the-Middle | GTP-U tunnel injection; rogue UPF registration; SS7-based call interception |
| T1040 | Network Sniffing | Passive interception on unencrypted GTP-U segments; SS7 SMS interception |
| T1499 | Endpoint Denial of Service | Network slice resource exhaustion; AMF flooding via signaling storms |
| T1046 | Network Service Discovery | NRF unauthenticated enumeration of all 5GC network functions |
| T1590.002 | Gather Victim Network Information: DNS | SS7 location tracking via SendRoutingInfoForSM |
| T1563 | Remote Service Session Hijacking | GTP-C control plane session modification for traffic redirection |
| T1195.003 | Supply Chain Compromise: Compromise Hardware | Baseband processor vulnerabilities in Qualcomm, Samsung, MediaTek chipsets |
| T1056.002 | Input Capture: GUI Input Capture | IMSI catcher capture of device identifiers in NSA mode |
| T1205 | Traffic Signaling | GTP-U tunnel creation for covert data exfiltration channels |
| T1583 | Acquire Infrastructure | Setting up rogue gNB or malicious NF for attack operations |