betaFeedback

WorksComputer Science

Mitigating Nested GTP Attacks: A Closed-Loop eBPF Defense for 5G and Beyond Networks

Abstract

The evolving cellular networks continue to rely on the legacy GPRS Tunneling Protocol-User Plane (GTP-U) to encapsulate and route user data traffic across the data plane. Recent security research demonstrated that nested GTP-U (GTP-in-GTP) payload vulnerabilities enable a diverse range of attacks on victim users. To address this vulnerability, in this paper, we propose a closed-loop extended Berkeley Packet Filter (eBPF) and eXpress Data Path (XDP) defense to detect and mitigate nested GTP-U attacks in 5G and beyond networks. The proposed framework contains three components: an in-kernel XDP Detection and Drop Module (XDP-DDM), a user-space User-Plane Telemetry Agent (UP-TA), and a multi-threaded Control-Plane Mitigation Orchestrator (CP-MO). We implement and evaluate the proposed defense on a sliced 5G testbed integrating Free5GC, UERANSIM, and Containerlab. Experimental results indicate that the XDP-DDM detects and drops malicious nested GTP-U packets at line rate, while the UP-TA and CP-MO asynchronously report and revoke the attacker's network access, respectively. Under a 10,000 packets-per-second cross-slice nested GTP-U flood, the proposed solution preserves the baseline performance of the victim slices while introducing minimal overhead. We also show that the proposed solution has minimal impact on the user's throughput and round-trip time.

Index Terms—5G and 6G security, closed-loop mitigation, eBPF, XDP, GTP-U encapsulation, network slicing.

Introduction

As cellular networks evolve from Fifth Generation (5G) towards Sixth Generation (6G) networks, recent 3rd Generation Partnership Project (3GPP) Release 20 standardization studies on the 6G system architecture, 3GPP TR 23.801-1 [1], establish that 6G will adopt the current 5G Service-Based Architecture (SBA), Control and User Plane Separation (CUPS), and network slicing as its baseline starting point [1]. However, the Data Plane (DP) of cellular networks relies on the legacy General Packet Radio Service Tunnelling Protocol (GTP) User Plane (GTP-U) [2].

Recently, Shaik et al. [3, 4] demonstrated at ACM Conference on Computer and Communications Security (CCS) 2025 that a compromised User Equipment (UE), operating with only a smartphone and a valid SIM, can exploit the vulnerabilities in GTP-U packet processing at the User Plane Function (UPF) to execute severe protocol tunneling and network boundary bridging attacks across six 5G cores, including commercial networks. Because emerging 6G architectures are expected to preserve GTP-U tunneling for user-plane forwarding across the N3 and N9 interfaces [1], these underlying protocol vulnerabilities represent a persistent threat that will be directly inherited by 6G networks unless automated DP defenses are established.

Problem Statement

GTP-U was originally standardized in 2.5G/3G networks and was engineered for high-throughput forwarding rather than adversarial resilience [3, 5]. In a standard 5G deployment, uplink user traffic is encapsulated by the serving GNodeB (gNB) into an outer GTP-U header containing the destination UPF’s Internet Protocol (IP) address and a 32-bit Tunnel Endpoint Identifier (TEID) for the UE [2, 3]. Because GTP-U lacks source authentication or recursive payload validation, standard UPF implementations validate only the outermost GTP-U header and treat the inner encapsulated payload as an opaque byte stream [3, 4].

As Shaik et al. [3] demonstrated, an authenticated adversary can abuse this blind decapsulation by injecting a crafted packet containing a nested GTP-U header (GTP-in-GTP) into their legitimate uplink tunnel. When the UPF strips the legitimate outer GTP-U header, it fails to inspect the inner protocol layer and blindly routes the inner forged GTP-U packet back into the internal user-plane or control-plane interfaces. While Shaik et al. [3] demonstrated these exploits in unsliced cores, the threat is further magnified in multi-tenant 5G/6G network slicing environments [6].

Motivation

Mitigating nested GTP-U attacks is critical due to the severity of their impact on legitimate subscribers and the multi-vector exploitation [7]. Rather than resulting in a single attack, nested GTP-U encapsulation functions as a highly exploitable mechanism for “Protocol Tunneling”, a critical threat category formally recognized by the MITRE FiGHT framework [8]. By varying the inner encapsulated payload, an adversary can execute: ① TEID and Session Endpoint Identifier (SEID) enumeration [3], ② direct UE-to-UE packet injection [3], ③ control-plane boundary bridging (Packet Forwarding Control Protocol (PFCP)-in-GTP) [3, 9], ④ amplified reflection attacks causing billing fraud and quota depletion [3, 5], and ⑤ cross-slice injection [6]. Hence, neutralizing nested GTP-U encapsulation at the UPF ingress is crucial for eliminating these attack vectors.

In this work, we focus on neutralizing nested GTP-U-in-GTP-U encapsulation at the UPF ingress, while noting that the same eXpress Data Path (XDP) parsing pipeline can be directly extended to detect control-plane boundary bridging, such as PFCP-in-GTP.

Research Questions

This work investigates how to construct an autonomous, closed-loop, zero-trust defense directly within the UPF DP and 5G core Control Plane (CP). Specifically, we address three core research questions (RQs) that directly guide our architectural design goals and experimental evaluation:

RQ1 (Data-Plane Enforcement): How can nested GTP-U encapsulation attacks be deterministically detected and dropped at wire speed within the UPF without imposing significant performance penalties on legitimate traffic?

  • Addressed by our ‘Lightweight Processing’ and ‘Plug-and-Play Integration’ design goals via the in-kernel XDP Detection & Drop Module (XDP-DDM) in § 4.2, and validated in § 6.2 and 6.3.

RQ2 (Non-Blocking Cross-Plane Telemetry): How can high-volume attack detections in the kernel be communicated to the user-space and across the N4 interface without inducing alert storms or CPU bottlenecks during a volumetric flood?

  • Addressed by our ‘High Reliability’ design goal via a 10-second BPF Least Recently Used (LRU) map debounce mechanism and the User-Plane Telemetry Agent (UP-TA) in § 4.2 & § 4.3, and quantified in § 6.3.

RQ3 (Automated Closed-Loop Session Revocation): How can the 5G/6G CP autonomously translate DP threat telemetry into synchronized, permanent UE session termination and blacklisting across 3GPP SBA functions while preserving victim slice resilience under active flooding?

  • Addressed by the multi-threaded Control-Plane Mitigation Orchestrator (CP-MO) interacting with 5G CP Network Functions (NFs) in § 4.4, and evaluated under a 10,000 Packets Per Second (PPS) flood in § 6.1.

Contributions

The main contributions of this paper are summarized as follows:

  1. Closed-Loop eBPF/XDP Security Defense: We propose a novel Closed-Loop defense framework that enables kernel-space DP threat mitigation along with automated CP attacker revocation to defeat nested GTP-U attacks. ⓵ Line-Rate Detection & Telemetry: We develop the in-kernel eBPF/XDP program (XDP-DDM) attached to the UPF N3 ingress interface that inspects nested GTP headers and drops malicious packets in < 0.4 μs. Using a BPF LRU map for 10-second per-attacker alert debouncing, a user-space agent UP-TA dispatches lightweight JSON alerts to the CP within ~ 1 ms without bottlenecking the UPF CPU. ⓶ Automated CP Revocation: We engineer a multi-threaded CP-MO agent which resolves malicious inner IPs to their SUPI and executes a 3GPP REST API teardown across the SMF, AMF, and UDR to permanently blacklist the adversary.

  1. Plug-and-Play Compatibility for 5G/6G: Our XDP-DDM solution operates natively within the Linux network driver before packets reach the UPF application; it is completely decoupled from the underlying UPF implementation. It can be seamlessly deployed as a plug-and-play security layer on any Linux-based UPF across current 5G and future 6G architectures without modifying existing VNF source code.

  1. Empirical Validation on a Sliced 5G Testbed: We deploy and evaluate the proposed defense on a 5G network slicing testbed integrating Free5GC, UERANSIM, and Containerlab. Under a volumetric cross-slice nested GTP-U flood, our defense neutralizes the attack and preserves the victim’s legitimate traffic from the severe impacts observed with the baseline UPF. To foster reproducibility, we release our core eBPF/XDP modules, telemetry/orchestration agents, and deployment scripts as open-source artifacts1.

The remainder of this paper is organized as follows. Section 2 reviews the related work and establishes the research gap. Section 3 defines the system assumptions and threat model, and explains the attack, while Section 4 details the proposed closed-loop extended Berkeley Packet Filter (eBPF)/XDP defense. Section 5 outlines the 5G testbed environment and evaluation methodology, followed by a comprehensive analysis of the experimental results in Section 6.

The limitations of our work are discussed in § 7, and § 8 outlines the ethical considerations of our work. § 9 concludes the paper.

Related Works

This section reviews the state of the art across three domains relevant to our work. Table 1 summarizes the most closely related studies and highlights how our proposed closed-loop eBPF/XDP defense advances the state of the art.

ReferencePrimary ScopeDefense ParadigmNested GTP-U InspectionLine-Rate Drop (μ\mus-level XDP)Automated 3GPP UE RevocationEmpirical 5G Attack Testbed
Salim (Trend Micro) [10]5G User Plane (N3)CT-aware DPI✓×××
Zhang et al. [5]Exposed 4G/5G GTPProtocol Auth. / Auditing×××✓(Open5GS/free5GC)
Kwon et al. [9]5G SA Core (N3/N4)Routing / ACL Hardening✓(PFCP-in-GTP)××✓(Carrier / 5G SA)
Shaik et al. [3]5G SA Core (N2/N3/N4)VPP/BESS Rules & Depth Limit✓××✓(6 Cores + SDR)
Sattar et al. [11]5G Core SlicingProactive MILP Host Isolation×××✓(OpenVZ vEPC)
Mahyoub et al. [12]5G CP ProceduresProactive MINLP VNF Sharing×××× (Simulation)
Bolourian et al. (5Guard) [13]E2E 5G SlicingOnline MIP Ensemble (L0–L2)×××× (Simulation)
AbdulGhaffar & Matrawy [6]Multi-UPF SlicingProactive MINLP Phy/VNF Tiers× (Topological)××✓(Free5GC + Clab)
Khan et al. (SliceSecure) [14]5G Slice Data PlaneReactive DL Anomaly Detection×××✓(Free5GC)
Parola et al. [15]5G Mobile GatewayeBPF/XDP Forwarding & Policing×× (Policing Only)×✓(Polycube PoC)
Messaoudi et al. [16]5G UPF (N3/N6)eBPF/XDP + tc HTB×× (QoS Enforcement)×✓(100G OAI-UPF)
Akem & Fiore [17]5G UPF Data PlaneIn-Switch P4 Decision Tree ML×✓(P4)×✓(Tofino Switch)
Repetto et al. (ASTRID) [18]NFV / 5G UPF EdgeeBPF Sidecar + ARIMA Controller×∼ (∼ 2.4 s Load)×✓(Open5GS + K8s)
Loureiro et al. [19]5G Control Plane (NRF)XDP Fixed-Window SYN Filter×✓(TCP SYN Only)× (Temp. Block)✓(Open5GS)
Proposed Defense5G/6G Sliced UPFClosed-Loop eBPF/XDP + UP-TA + CP-MO✓✓(< 0.4 μ\mus)✓(SMF/AMF/UDR)✓(Free5GC + Clab)

Table 1. Comparison of Related Works Across 5G User-Plane Security, Slice Isolation, and Programmable Data Planes

GTP-U Protocol Vulnerabilities and Encapsulation Attacks

Designed over two decades ago for trusted telecom backhauls, the General Packet Radio Service (GPRS) Tunneling Protocol User Plane (GTP-U) prioritizes packet forwarding based solely on IP addresses and TEID, lacking native source authentication, integrity verification, or recursive payload inspection [4]. Recent offensive security research has demonstrated that 5G UPFs inherit these fundamental protocol flaws [3].

Industry threat intelligence from Trend Micro Research [10] first warned that compromised user devices in private 5G networks can inject malformed or nested GTP-U payloads to trigger packet reflection and crash unpatched UPFs, recommending Cellular Technology (CT)-aware Deep Packet Inspection (DPI) firewalls for mitigation. At the global internet scale, Zhang et al. [5] scanned the publicly exposed GTP nodes and identified around 749,000 exposed hosts across numerous providers and countries. The authors demonstrated that adversaries can exploit the vulnerabilities to perform various attacks. In contrast to our work, Zhang et al. focus on external Internet-facing GTP exposure and suggest authentication-based protocol replacements rather than defending the internal N3 user plane against authenticated insider UEs launching cross-slice nested GTP-U attacks.

Focusing on the insider threats originating from authenticated UEs, Kwon et al. [9] demonstrated that encapsulating PFCP (PFCP-in-GTP) and ICMPv6-in-GTP payloads allows a malicious UE to bypass DP isolation and reach internal Session Management Function (SMF) and UPF nodes across operational 5G networks. However, while the authors discuss high-level routing and Access Control List (ACL) hardening recommendations, they do not design or empirically evaluate an implementable countermeasure to mitigate these attacks.

Most recently, Shaik et al. [3, 4] evaluated Protocol Tunneling (PT) via nested GTP-U-in-GTP-U packets across four open-source and two commercial 5G cores. By exploiting predictable TEID allocations and permissive UPF routing, the authors executed multiple attacks, including direct UE-to-UE packet injection and reflective charging fraud. Although Shaik et al. outline high-level hardening guidelines, they evaluate only unsliced cores and do not design or empirically evaluate an in-kernel defense or automated closed-loop session revocation framework.

Proactive and Reactive 5G Network Slicing Defenses

To prevent adversaries in one network slice from degrading co-hosted slices, existing slicing security literature largely follows two paradigms: proactive topological isolation via mathematical optimization and reactive anomaly detection via Machine Learning (ML).

In the proactive optimization domain, Sattar et al. [11] formulated a Mixed-Integer Linear Programming (MILP) model that enforces hardware inter-slice isolation (ISI), intra-slice Virtualized Network Function (VNF) distribution, and dedicated secure hypervisor zones to mitigate Distributed DoS (DDoS) flooding and slice-initiated CPU exhaustion attacks. Building on mathematical VNF sharing, Mahyoub et al. [12] proposed a CP procedure-level Mixed-Integer Nonlinear Programming (MINLP) model that restricts VNF sharing between 3GPP procedures using maximum VNF traffic and external exposure constraints.

Bolourian et al. [13] introduced 5Guard, an end-to-end (E2E) isolation-aware network slicing framework aimed at maximizing infrastructure provider profit. However, 5Guard evaluates resource overheads purely in numerical simulation without subjecting slices to live cyberattacks. A study by AbdulGhaffar and Matrawy [6] bridged mathematical optimization and empirical validation by proposing the Slice Isolation-as-a-Service MINLP framework across multi-UPF data paths and deploying the generated topologies on a 10-Virtual Machine (VM) Free5GC and Nokia Containerlab testbed. Empirical evaluations under volumetric floods and cross-slice GTP-in-GTP reflection attacks proved that logical VNF-only isolation on a shared physical host suffers significant performance degradation without physical hardware isolation. Unlike our runtime data-plane defense, these studies rely on an offline mathematical model to proactively isolate slices and reduce the attack surface.

On the other hand, reactive slicing defenses rely on ML and Deep Learning (DL) anomaly detectors, such as SliceSecure by Khan et al. [14], reinforcement learning-based DDoS slice isolation by Javadpour et al. [20], and Radio Access Network (RAN) performance isolation by Yarkina et al. [21]. These reactive ML approaches evaluate flow-level features over conventional transport-layer flooding datasets that do not contain GTP-in-GTP protocol exploits, and their feature aggregation and inference delays are too slow to prevent immediate Linux kernel queue saturation during high-rate volumetric floods.

Kernel-Level eBPF/XDP and Programmable UPF Defenses

Recent works have also leveraged programmable DPs (P4 and eBPF/XDP) within the 5G UPF. Parola et al. [15] demonstrated an early proof-of-concept 5G mobile gateway in eBPF/XDP using the Polycube framework for traffic classification and Quality of Service (QoS) management. Extending this paradigm to carrier-grade 3GPP compliance,

Messaoudi et al. [16] designed a high-performance OAI-UPF that combines XDP, Linux Traffic Control (tc-bpf) and Hierarchical Token Bucket (HTB) queuing for QoS enforcement and traffic classification and forwarding. However, both Parola et al. [15] and Messaoudi et al. [16] focus strictly on benign GTP packets; their uplink XDP parsers only strip a single outer GTP-U header and neither inspect inner payloads for nested GTP-in-GTP exploits nor perform security mitigation.

Several studies have applied programmable data planes to 5G security and DDoS mitigation. Akem and Fiore [17] embedded a trained tree-based ML classifier in a P4-programmable UPF to classify malicious 5G traffic at sub-microsecond line rates. Unlike our kernel-native eBPF/XDP solution that runs on commodity Linux VPS, Akem and Fiore’s solution requires specialized, expensive P4 switches and operates as an open-loop classifier without automated 3GPP control-plane session revocation. Repetto et al. [18] developed an eBPF framework to detect and mitigate Domain Name System (DNS) amplification attacks.

Loureiro et al. [19] implemented an eBPF/XDP program to protect Network Repository Function (NRF) from Transmission Control Protocol (TCP) SYN flood attacks in an Open5GS testbed. While effective at protecting NRF, their solution only inspects unencapsulated transport-layer TCP SYN flags and temporarily throttles connections, rather than parsing N3 GTP-U user-plane tunnels or permanently terminating compromised UE sessions.

Summary and Research Gap: As pointed out in Table 1, a clear research gap exists in securing 5G and future 6G user planes against cross-slice encapsulation exploits.

Offensive security studies [3, 5, 9, 10] expose the severity of nested GTP-in-GTP and protocol tunneling attacks. Proactive mathematical slice isolation models [6, 11, 12, 13] can prevent cross-slice bleeding only by provisioning dedicated physical servers. Meanwhile, existing eBPF/XDP and programmable UPF works either focus exclusively on benign forwarding [15, 16] or do not support the inspection of nested GTP-U traffic [15]–[19].

To the best of our knowledge, this work is the first to design, implement, and empirically validate a closed-loop eBPF/XDP security defense that unifies sub-microsecond (< 0.4 μ\mus) nested GTP-U packet dropping, kernel-level debounced telemetry, and asynchronous 3GPP control-plane session revocation and blacklisting of malicious UE to preserve cross-slice QoS on shared UPF infrastructure.

System Assumptions and Threat Model

System Assumptions

  • Infrastructure Security: The 5G core network utilizes a virtualized architecture to enable multiple network slices deployment through shared or isolated VNFs. The underlying bare-metal hardware and hypervisor configurations are assumed to be physically secure and tamper-proof [6, 22].

  • Control Plane Isolation: The attack surface is strictly confined to the DP. CP NFs, such as SMF

and Access and Mobility Function (AMF), are isolated and protected from attacks [6].

  • Adversary Access: The attacker is considered a legitimate UE of the network; however, acting maliciously. The UE successfully completes initial authentication and session establishment procedures to acquire a legitimate IP address and attach to a network slice [3], [6].

  • Trusted RAN and Source-IP Binding: The serving gNB is assumed to be a legitimate, uncompromised network node that encapsulates uplink UE traffic with valid outer GTP-U headers and TEIDs. Furthermore, for the control-plane revocation proposed in this work, we assume that the compromised UE transmits uplink packets using its legitimately assigned Protocol Data Unit (PDU) session IP address in the non-nested inner IP header, while spoofing victim identifiers inside the nested GTP-U payload. The implications of relaxing this inner source-IP assumption and extending revocation to outer TEID correlation are discussed in § 7.

Adversary Capabilities

  • Protocol Manipulation: Possessing a comprehensive understanding of 3GPP specifications, the adversary can programmatically craft protocol-compliant IP packets [3], [6].

  • Tunnel Injection: The attacker injects customized payloads directly into the uplink data stream. The serving gNB blindly encapsulates the malicious payload within legitimate GTP-U headers and forwards it to the UPF [3], [6].

  • Reconnaissance and Spoofing: Through probing, enumeration, or documentation, the attacker can identify the internal IP addresses of critical core components. Leveraging this reconnaissance, the adversary spoofs internal IP addresses and TEIDs within the nested payloads to exploit UPF decapsulation logic [3], [6].

  • Volumetric Resource Exhaustion: The attacker can generate flooding traffic from a single compromised UE. By combining these volumetric floods with GTP-U protocol tunneling, the attacker aims to disrupt the service of the victim UE and to cause billing fraud [6].

Nested GTP Attack

This attack was recently demonstrated in 5G networks by Shaik et al. at ACM CCS [3] [3]. Due to the lack of nested GTP header verification and routing logic enforcement at the UPF, an attacker can exploit this vulnerability by injecting traffic into a victim’s uplink GTP tunnel [2], [23]. The malicious actor creates an illegitimate nested GTP-in-GTP packet targeting the victim by setting the victim UE’s IP address and TEID in the spoofed inner IP and GTP headers. Furthermore, the attacker sets the inner destination IP to the victim’s serving UPF, and directs the inner payload (a DNS or Internet Control Message Protocol (ICMP) request, etc.) to a public server.

The attacker then sends this crafted packet to their respective gNB, which, as part of normal operation, adds the outer IP header (with the serving gNB and UPF N3 IP addresses) and the outer GTP-U header containing the attacker’s uplink TEID, and forwards it to the UPF. Due to the lack of nested GTP header verification at the UPF, it decapsulates the outer GTP headers and routes the inner payload based on the inner malformed GTP header. As the attacker crafted the inner headers with the information of the victim, the UPF routes the packet through the victim’s uplink tunnel, appearing to be originated from the victim UE. This, in turn, results in routing the public server’s response towards the victim UE through its downlink tunnel. As a consequence of this attack, the victim’s uplink and downlink tunnels are filled with attack traffic, causing quota depletion, billing fraud, and reflection attacks. Figure 1 shows the sequence of the nested GTP attacks.

Figure 1. Reflection Attack Sequence Diagrams. Red arrows for attack traffic. Green is legitimate traffic, but becomes part of the attack. Note: The attacker’s gNB is not under the control of the attacker, but instead it is a legitimate gNB serving the attacker (malicious user) [3]. (Packet headers are shown in abbreviated inner-to-outer order to save space.)

Proposed Closed-Loop eBPF Defense

Overview and Design Principles

To neutralize the threat of nested GTP-U attacks without compromising the performance of the legitimate user traffic, we propose a closed-loop detection and mitigation defense. This solution operates across the 5G DP and CP boundaries, leveraging eBPF.

eBPF was selected as the foundational technology for this defense due to its unique capabilities in modern cloud-native environments. eBPF operates as an abstract virtual machine that executes user-defined programs inside a secure sandbox within the Linux kernel, allowing developers to extend kernel behavior without modifying the kernel source code or risking system crashes [24]. To achieve the stringent low-latency requirements of 5G/6G data planes, this defense specifically relies on XDP, which is a high-performance, programmable network data path integrated directly into the Linux kernel [25]. It provides a safe execution environment for custom packet processing applications within the network device driver context [25]. By shifting data processing to this earliest possible point, before the kernel allocates memory or engages the standard networking stack, XDP enables wire-speed packet manipulation and dropping [25, 26].

Leveraging these capabilities, the proposed defense is built upon three core design principles:

  1. Lightweight Processing: Utilizing a minimal footprint to guarantee low-latency packet processing at wire speed.

  2. High Reliability: Ensuring rapid and accurate detection of malicious nested GTP-U traffic.

  3. Plug-and-Play Integration: Designed to be fully compatible with any Linux-based UPF deployment in current 5G or future 6G networks.

As illustrated in Figure 2 and the call flow in Figure 3, the proposed defense consists of three specialized components: XDP Detection & Drop Module (XDP-DDM), User-Plane Telemetry Agent (UP-TA), and the Control-Plane Mitigation Orchestrator (CP-MO).

Figure 2. Proposed closed-loop eBPF/XDP detection and automated 5G/6G control-plane mitigation defense: (1) ingress N3 GTP-U inspection, (2) asynchronous telemetry emission via trace_pipe governed by a 10-second eBPF backoff map, (3) inline line-rate packet dropping (XDP_DROP), (4a–4b) out-of-band alert forwarding to the 5G Core, and (5–7) sequential SBI/REST session teardown, UE deregistration, and subscriber profile revocation across the SMF, AMF, and UDR, respectively. The green blocks represent Free5GC Network Functions (NFs)/components, whereas the orange blocks show our proposed closed-loop eBPF/XDP detection and automated mitigation components.

Figure 3. Call Flow of the Proposed Closed-Loop eBPF Defense. The Green dotted block shows the flow for legitimate traffic, while the Red dotted block shows the procedure for nested GTP attack traffic.

XDP Detection & Drop Module (XDP-DDM)

The XDP Detection & Drop Module (XDP-DDM) is a lightweight, kernel-space enforcement module attached to the UPF’s N3 ingress interface (Algorithm 1). Operating at the XDP hook, it intercepts traffic at the earliest possible stage in the networking stack.

To maintain the highest processing speeds, the XDP-DDM restricts its operations to purely line-rate header parsing and packet dropping. ① XDP-DDM intercepts the arriving frames from the RAN and inspects the outer GTP-U headers and parses the encapsulated payload. Legitimate user-plane packets immediately return XDP_PASS and are forwarded to the UPF (gtp5g) Module [27, 28] for standard decapsulation toward the Data Network (DN) via the N6 Interface. ② If a nested User Datagram Protocol (UDP) packet destined for port 2152 is detected, the XDP-DDM queries the eBPF Map indexed by the attacker IP to enforce a 10-second alert backoff timer. This prevents exhausting CPU resources during a volumetric flooding attack.

Rather than executing computationally expensive JSON serialization in the kernel, the module asynchronously sends raw telemetry (Attacker IP, TEID, monotonic timestamp, and XDP detection delay (TdetectT_{\mathrm{detect}})) to user-space via the kernel trace_pipe. ③ Immediately following the transmission of telemetry (or detecting the attack traffic), the XDP-DDM returns XDP_DROP, discarding the malicious frame at line rate.

User-Plane Telemetry Agent (UP-TA)

The UP-TA acts as the intermediary bridging the DP line-rate and the core CP (Algorithm 2). Deployed as a user-space daemon on the UPF node, it continuously polls the eBPF trace_pipe for incoming threat telemetry.

Upon receiving an event, the UP-TA calculates the kernel-to-user reporting delay and formats the raw parameters into a structured JSON alert. This decoupling ensures that the DP’s dropping efficiency remains unaffected by telemetry serialization. ④ Finally, the UP-TA dispatches the JSON alert to the CP-MO via an out-of-band UDP socket established over the N4 interface.

Control-Plane Mitigation Orchestrator (CP-MO)

The CP-MO serves as the final component of the closed-loop defense, responsible for permanently revoking the attacker’s network access (Algorithm 3). Residing within the 5G CP, it continuously listens for incoming UDP alerts from the UP-TA.

To prevent socket blocking during coordinated attacks, the CP-MO utilizes an asynchronous, multi-threaded execution mode. Upon resolving the attacker’s IP to a specific Subscription Permanent Identifier (SUPI) and SM (Session Management) Context, it triggers a sequential, three-stage mitigation via SBA REST Application Programming Interfaces (APIs). ⑤ First, it issues a release command to the SMF to release the attacker’s PDU session and delete the UPF tunnels. ⑥ Secondly, it commands the AMF to purge the signaling context and deregister the attacker UE. ⑦ Finally, it invokes an HTTP DELETE request to the Unified Data Repository (UDR), permanently blacklisting the attacker’s subscriber profile based on their permanent identifier (SUPI). At the end of the closed-loop mitigation, CP-MO logs the XDP-DDM detection delay (TdetectT_{\mathrm{detect}}), reporting delay (TreportT_{\mathrm{report}}), and CP-MO mitigation delay (TmitigateT_{\mathrm{mitigate}}).

Implementation Details and State Machine Synchronization

Translating this defense into a functioning 5G prototype required overcoming significant SBA state-synchronization challenges. By default, when the Free5GC [29] AMF triggers a Network-Initiated Deregistration, it only deletes its local context but ignores the active DP PDU tunnels allocated to the UE. To prevent ghost tunnels and ensure the

Algorithm 1: XDP-DDM: XDP Detection & Drop Module (UPF Kernel-Space)

Input: Ingress packet p
Output: Action (XDP_PASS or XDP_DROP)
Shared State: M_state ← BPF LRU Hash Map (Debounce tracking)
Shared State: τ_db ← 10 seconds (Debounce timeout)

1  t_start ← current nanosecond;
2  if p lacks valid outer IPv4/UDP/GTP headers then
3      return XDP_PASS;        // Step 1: Parse Outer Headers
4  end
5  teid ← p.gtp.teid;          // Extract Outer TEID
6  Extract encapsulated payload as p_inner;
   // Log Normal Traffic Execution Time (Evaluation Baseline)
7  if p_inner.protocol == ICMP then
8      T_detect ← current nanosecond − t_start;
9      Log T_detect to trace_pipe;
10     return XDP_PASS;
11 end
12 if p_inner.protocol ≠ UDP then
13     return XDP_PASS;         // Pass non-UDP payloads
14 end
   // Step 2: Detect Nested GTP-U Signature
15 if p_inner.dest_port == 2152 then
16     t_end ← current nanosecond;
17     T_detect ← t_end − t_start;
18     ip_src ← p_inner.saddr;
19     t_last ← M_state[ip_src];
20     if t_last is NULL or (t_end − t_last) > τ_db then
21         M_state[ip_src] ← t_end;
22         Export ⟨ip_src, teid, t_end, T_detect⟩ to User-Space (UP-TA);
23     end
24     return XDP_DROP;         // Step 3: Drop & Export Telemetry
25 end
26 return XDP_PASS;              // Pass legitimate inner UDP traffic

AMF and SMF state machines remain perfectly synchronized per 3GPP TS 23.502 [30], our CP-MO orchestrates a strict teardown sequence. The system explicitly invokes the Nsmf_PDUSession_ReleaseSMContext service operation for every active PDU session tied to the attacker, forcing the SMF to tear down the UPF tunnels before the UE is fully deregistered and blocked. While session release and deregistration invoke 3GPP SBI operations, UE IP-to-SUPI resolution and UDR profile removal are executed via Free5GC’s WebConsole management REST API. While recent open-source community prototypes have

Algorithm 2: UP-TA: User-Plane Telemetry Agent (UPF User-Space)

Input: Event stream from BPF TracePipe

1  while listening to BPF TracePipe do
2      On receiving event
       e = ⟨ip_src, teid, t_end, T_detect⟩;
3      t_arr ← current nanosecond;
4      Δt_hop1 ← t_arr − t_end;      // Hop 1: Kernel-to-User delay
5      A ← construct JSON Alert
       ⟨ip_src, teid, Δt_hop1, T_detect⟩;
6      Forward Alert A to CP-MO via N4; // Step 4: Dispatch Telemetry
7  end

demonstrated the basic feasibility of using eBPF/XDP for unencapsulated application-layer filtering (such as DNS) on UPF interfaces [31], our proposed defense utilizes eBPF/XDP for a comprehensive security framework. Specifically, the design and scope of our work fundamentally differ by parsing recursive GTP-in-GTP encapsulation, implementing kernel-space debouncing, and closing the loop with automated CP revocation.

Evaluation Methodology

This section outlines the experimental methodology utilized to evaluate the efficacy, resilience, and performance impact of the proposed closed-loop eBPF defense.

Testbed Environment

To rigorously evaluate the proposed closed-loop eBPF defense, we utilize the 5G network slicing testbed, as shown in Figure 4. The 5G Core is deployed using Free5GC [29] in a dedicated VM, providing the requisite NFs, while the RAN and UE are emulated using UERANSIM [32]. Two distinct VMs are used to host the emulated UE and gNB instances for Slice 1 (enhanced Mobile Broadband (eMBB)) and Slice 2 (Ultra-Reliable Low Latency Communications (URLLC)). Each slice is served by its corresponding DN: DNeMBBDN_{\mathrm{eMBB}} and DNURLLCDN_{\mathrm{URLLC}}, respectively. The 5G DP UPFs are deployed and orchestrated using Containerlab [33] inside a VirtualBox VM [34] to allow flexible and custom data path creation. This containerized topology provides a highly reproducible environment for deploying our XDP hooks and executing high-fidelity traffic generation.

Figure 4. Experimental 5G network slicing testbed architecture. The control plane relies on Free5GC, while the RAN and UEs are emulated via UERANSIM across dedicated VMs for the eMBB (Slice 1) and URLLC (Slice 2) slices. The data plane is orchestrated using Containerlab, featuring a multi-tiered UPF topology interconnected via dedicated bridges (N2, N3, N4, N6, and N9) to isolate traffic and validate the eBPF defense under cross-slice attack scenarios.

To accurately model a realistic core network, we assume a multi-tiered UPF topology consisting of intermediate UPFs (II-UPFUPF), Central UPFs (CC-UPFUPF), and PDU Session Anchor UPFs (PP-UPFUPF). The II-UPFUPF acts as an edge branching node, routing latency-critical URLLC traffic directly to an edge DN while forwarding eMBB traffic deeper into the core. The CC-UPFUPF acts purely as a transit node to mimic multi-hop core transit and does not connect to

Algorithm 3: CP-MO: Control-Plane Mitigation Orchestrator (Control Plane)

Input: Alert $\mathcal{A} = \langle ip_{src}, teid, \Delta t_{hop1}, T_{detect} \rangle$ from UP-TA

1  while listening on UDP port do
2      Receive Alert $\mathcal{A}$;
3      $t_{n4\_arr} \leftarrow$ current nanosecond;
4      Parse JSON payload $\mathcal{A}$;
       // Calculate Total N3-to-N4 Reporting Time
5      $T_{report} \leftarrow \mathcal{A}.\Delta t_{hop1} +$ (current nanosecond $- t_{n4\_arr}$);
       // Asynchronous execution to maintain non-blocking socket
6      Spawn Background Thread
       Mitigate($\mathcal{A}.ip_{src}, \mathcal{A}.teid, \mathcal{A}.T_{detect}, T_{report}$);
7  end
8  Procedure Mitigate($ip_{src}, teid, T_{detect}, T_{report}$)
9      $t_{mit\_start} \leftarrow$ current nanosecond;
10     $L_{ue} \leftarrow$ HTTP GET AMF Registered UEs;
11     $supi, sm\_ctx, plmn \leftarrow$ NULL, NULL, NULL;
12     foreach $ue \in L_{ue}$ do
13         if $ue$ contains $ip_{src}$ then
14             $supi \leftarrow ue.SUPI$;
15             $sm\_ctx \leftarrow ue.SmContextRef$;
16             $plmn \leftarrow ue.PLMN$;
17             break; // Resolve Attacker SUPI & SM Context
18         end
19     end
20     if $supi \ne$ NULL and $sm\_ctx \ne$ NULL then
           // Step 5: Trigger UPF Session Teardown
21         HTTP POST SMF($sm\_ctx$, release);
           // Step 6: Trigger Deregistration
22         HTTP POST AMF($supi$, release);
           // Step 7: Blacklist UE
23         HTTP DELETE UDR($supi$, $plmn$);
24     end
25     $T_{mitigate} \leftarrow$ current nanosecond $- t_{mit\_start}$;
26     Append $\langle ip_{src}, teid, T_{detect}, T_{report}, T_{mitigate} \rangle$
       to Evaluation Logs;

any DN. Finally, the PP-UPFUPF terminates the connection to the cloud DN. Consequently, the PDU data path for URLLC is modeled as (gNB→I-UPF→DNURLLC)(gNB \rightarrow I\text{-}UPF \rightarrow DN_{URLLC}), whereas the path for eMBB slices is modeled as (gNB→I-UPF→C-UPF→P-UPF→DNeMBB)(gNB \rightarrow I\text{-}UPF \rightarrow C\text{-}UPF \rightarrow P\text{-}UPF \rightarrow DN_{eMBB}).

Resilience Under Volumetric Attack

To evaluate the resilience of our defense under active attack, we orchestrate a cross-slice nested GTP volumetric flood. The attacker UE is provisioned in Slice 1, while the victim UE operates in Slice 2. To circumvent the inherent limitation of the UERANSIM software crashing under high traffic generation scenarios [35], we utilize the TRex traffic generator [36]. A crafted nested GTP payload is captured into a PCAP file and aggressively replayed by TRex at a sustained rate of 10,000 PPS.

Throughout the attack window, we continuously measure the victim UE’s Round-Trip Time (RTT) delay and TCP throughput. Simultaneously, the penetrating attack traffic is captured via the victim UE’s UERANSIM tunnel and logged to a PCAP file. This methodology enables a direct comparison of network resilience between the baseline environment (without the proposed eBPF/XDP defense) and the mitigation environment.

Performance Impact on Legitimate Traffic

Carrier-grade 5G deployments demand that security mechanisms do not degrade the QoS for benign users. To quantify the system overhead, we measure the impact of the proposed eBPF/XDP program on legitimate user traffic.

The evaluation focuses on two primary performance metrics: End-to-End RTT Delay and TCP Throughput. We conduct clean tests using standard ICMP and TCP flows traversing URLLC and eMBB slices in an attack-free environment. By recording these metrics, we establish a baseline and compare it directly against the user’s end-to-end delay and throughput when the eBPF/XDP program is enabled at the UPF.

Delay of the Closed-Loop Defense

To precisely quantify the responsiveness of the closed-loop pipeline, we decompose the total system delay into three distinct metrics corresponding to the architectural components:

  • Detection Delay (TdetectT_{\mathit{detect}}): The execution time required for the XDP-DDM to identify an ingress packet as either normal or malicious traffic. It is measured from the moment the eBPF/XDP program receives the packet until the forwarding or dropping decision is finalized. For attack traffic, this timing mechanism is natively integrated into the signature detection logic. To establish a baseline for normal traffic, the eBPF program was specifically instrumented to measure the execution time of benign ICMP packets during the evaluation.

  • Reporting Delay (TreportT_{\mathit{report}}): The time elapsed to dispatch a threat alert to the 5G core network. This is computed as the sum of the kernel-to-user transfer delay (from XDP-DDM detection to UP-TA reception via trace_pipe) and the JSON payload parsing time at the CP-MO, as detailed in Algorithm 2 and Algorithm 3. As noted in the Limitations (§ 7), this measurement explicitly excludes the virtual switch delay introduced by inherent hypervisor clock skew.

  • Mitigation Delay (TmitigateT_{\mathit{mitigate}}): The duration required for the CP-MO to successfully orchestrate the mitigation. This metric wraps the execution of the control-plane Mitigate procedure (execute_mitigation).

Experimental Results

Resilience Under Volumetric Attack

Figure 5 and Figure 6 illustrate the resilience of the victim UE deployed in URLLC Slice 2 against a nested GTP-U volumetric flood originating from an attacker in Slice 1. Both figures utilize a dual-axis representation, mapping the primary user performance metrics, including RTT and Throughput, against the volume of injected attack packets penetrating the victim’s tunnel.

Figure 5. Dual-axis evaluation of Round-Trip Time (RTT) resilience for a victim UE in Slice 2. The baseline UPF suffers severe impact and latency spikes (> 500 ms) during the nested GTP-U flood, while the proposed eBPF defense successfully shields the victim, maintaining a stable baseline delay.

Figure 6. Dual-axis evaluation of TCP throughput resilience for a victim UE in Slice 2. The baseline UPF experiences complete resource exhaustion (0 Mbps) as attack traffic floods the queues. In contrast, the proposed eBPF defense perfectly isolates the slices, silently dropping the attack volume and preserving an optimal 25–40 Mbps throughput for the victim.

Pre-Attack Baseline Stability: During the initial pre-attack duration (0 to 15 seconds), the RTT delay and TCP throughput are highly comparable in both scenarios. The baseline UPF and the proposed eBPF solution exhibit nearly identical performance, establishing that the eBPF hook introduces minimal overhead to legitimate user traffic under normal operating conditions.

Severe Impact on the Baseline UPF: At t=16t = 16 s, the nested GTP volumetric attack is initiated (shown in the pink shaded area). In the baseline UPF scenario (without the proposed eBPF solution), the injected nested GTP attack traffic instantly overwhelms the core. The victim’s RTT increases significantly, remaining above 100 ms throughout the attack duration and peaking at over 500 ms in the worst-case scenario, as shown in Figure 5. On the other hand, the victim’s throughput drops entirely to zero during the attack, as illustrated in Figure 6, causing a massive degradation in QoS and Quality of Experience (QoE).

Although the attacker injects traffic at a rate of 10,000 PPS at the source, the attack volume traversing the victim’s tunnel registers between 500 and 1,200 PPS. This discrepancy highlights the core mechanism of the Denial-of-Service (DoS) attack: the Linux kernel’s standard gtp5g module becomes entirely saturated. As the queues reach maximum capacity, the operating system indiscriminately drops the majority of incoming packets, effectively starving the victim’s legitimate traffic. The brief 6 Mbps throughput anomaly observed at t=58t = 58 seconds is a characteristic artifact of TCP starvation, where network window probes temporarily succeed during micro-fluctuations in the congested queue.

Resilience with Proposed Defense: In stark contrast, when the proposed eBPF defense is enabled, the user’s RTT delay and TCP throughput remain completely consistent with pre-attack levels, as demonstrated in Figure 5 and Figure 6. The attack volume recorded in the victim’s tunnel remains at absolute zero, indicating that the malicious nested GTP traffic is intercepted and dropped immediately by the XDP-DDM at the network driver level. While the line-rate XDP-DDM absorbs the attack shock, the CP-MO asynchronously revokes the attacker’s connection and blacklists the attacker UE to prevent future associations (as quantified in § 6.3).

Key Takeaway: The proposed eBPF defense successfully enforces strict cross-slice isolation at the data plane. While standard UPF suffers severe connection deterioration due to queue saturation during nested GTP volumetric floods, our line-rate XDP-DDM guarantees minimal overhead in the victim’s legitimate traffic, maintaining optimal QoS.

Performance Impact on Legitimate Traffic

Carrier-grade security solutions must operate transparently without penalizing benign users. To quantify the operational overhead of the proposed defense under normal, attack-free conditions, we evaluate its impact on legitimate UE traffic across both the eMBB and URLLC network slices.

Impact on End-to-End Delay (RTT)

Impact on End-to-End Delay (RTT). Figure 7 illustrates the end-to-end RTT delay for legitimate ICMP traffic traversing the eMBB and URLLC slices, comparing the baseline UPF against the UPF running the proposed

Figure 7. Impact of the proposed eBPF defense on legitimate end-to-end RTT delay across eMBB and URLLC slices over 100 samples (95% CI), demonstrating minimal latency overhead (< 2 ms) compared to the baseline UPF.

eBPF solution. To ensure statistical rigor, each bar represents the mean RTT computed across 100 clean packet samples, accompanied by its 95% confidence interval.

In the baseline configuration, the eMBB slice exhibits an average RTT of 16.8 ms, while the URLLC slice averages 19.1 ms. Although the eMBB topology traverses three UPF hops compared to a single UPF hop in the URLLC slice, the URLLC slice exhibits a marginally higher baseline RTT. This behavior is an expected artifact of containerized 5G emulation and the UERANSIM’s abstraction of physical-layer 5G NR (New Radio) over user-space UDP sockets. Because inter-container forwarding across virtual Ethernet (veth) pairs within the shared host kernel occurs in microseconds, the additional UPF hops in the eMBB path introduce negligible delay compared to normal inter-core thread scheduling variance across separate gNB and UE processes.

When the proposed eBPF defense is enabled on the N3 interface, the average RTT increases marginally by 1 to 2 ms across both slices, reaching approximately 18.3 ms for the eMBB slice and 20.5 ms for the URLLC slice. Given that the in-kernel XDP-DDM inspection requires less than 0.4 μ\mus per packet (as established in Figure 9), this 1–2 ms difference reflects normal virtualized network variance across test runs, minor user-space context switching, and the evaluation ICMP telemetry logging (Algorithm 1), rather than data-plane queuing delay. Crucially, the tight 95% confidence intervals confirm that the XDP hook introduces no latency spikes or jitter, preserving deterministic performance for latency-sensitive slices.

Figure 9. XDP-DDM detection delay (TdetectT_{\mathrm{detect}}) for normal and attack traffic across standard and Maximum Transmission Unit (MTU) packet sizes, averaged over 100 samples (95% CI). Algorithm 1 details the exact computation of this metric.

Impact on User Throughput

Impact on User Throughput. Figure 8 demonstrates the end-to-end TCP throughput for legitimate UE traffic across the eMBB and URLLC network slices, comparing the baseline UPF against the proposed eBPF defense. Consistent with the delay evaluation, each bar represents the average throughput computed across 100 clean samples, accompanied by its 95% confidence interval.

Figure 8. Impact of the proposed eBPF defense on legitimate TCP throughput across eMBB and URLLC slices over 100 samples, where overlapping 95% confidence intervals demonstrate statistically insignificant overhead compared to the baseline UPF.

Across both network slices, the integration of the proposed eBPF program preserves baseline bandwidth performance. Specifically, in the eMBB slice, both the baseline UPF and the proposed eBPF configuration achieve an average throughput of approximately 24.5 to 25 Mbps. Similarly, in the URLLC slice, the throughput remains stable at approximately 27.5 to 28 Mbps under both scenarios. Notably, in contrast to the idle ICMP RTT measurements, the URLLC slice achieves higher throughput than the eMBB slice. Under continuous, high-volume TCP transmissions, the data plane is actively saturated, meaning the cumulative GTP-U encapsulation and virtual interface forwarding overhead across the three UPF hops in the eMBB topology slightly reduces maximum throughput compared to the single-UPF URLLC path.

Crucially, when comparing the baseline UPF to the proposed eBPF defense within each respective slice, the 95% confidence intervals overlap substantially. This statistical overlap confirms that the minor difference in average throughput is not statistically significant and represents natural testbed variance rather than eBPF processing overhead. Because the XDP-DDM performs lightweight, zero-copy header inspection directly within the kernel before packets reach the UPF forwarding logic, it introduces no noticeable bottlenecks to active TCP flows.

In summary, evaluating both end-to-end delay and sustained bandwidth confirms that the proposed eBPF security mechanism operates transparently in the data plane, safeguarding the UPF without degrading the performance of benign slice traffic.

Key Takeaway: The proposed closed-loop eBPF defense introduces little to no performance impact on legitimate user traffic. By executing packet inspection directly at the network driver level, the XDP-DDM preserves baseline end-to-end latency and throughput across heterogeneous network slices without compromising QoS.

Delay of the Closed-Loop Defense

Any security mechanism introduces a performance cost, which in our solution is measured by processing delay. To evaluate the processing efficiency of the proposed eBPF/XDP defense, we first analyze the delay of each operational phase: detection (TdetectT_{\mathrm{detect}}), reporting (TreportT_{\mathrm{report}}), and mitigation (TmitigateT_{\mathrm{mitigate}}). We assess the detection delay using two packet sizes, a small 130-byte packet and a large 1455-byte packet representing the maximum transmission unit payload.

XDP-DDM Detection Delay: As illustrated in Figure 9, the XDP-DDM detection delay is remarkably low, consistently remaining under 0.4 μ\mus across all test scenarios. For 130-byte packets, the detection time for normal traffic averages 0.313 μ\mus, while attack traffic requires slightly more time at 0.338 μ\mus. A similar marginal gap exists for 1455-byte packets: 0.325 μ\mus and 0.377 μ\mus for normal and attack traffic, respectively.

This slight increase in delay for attack traffic is a direct result of the algorithm’s execution path. For benign traffic, the XDP program terminates early upon reading the protocol headers. On the other hand, when nested GTP-U attack traffic is identified, the algorithm executes additional operations, parsing the inner UDP header, matching the destination port signature, and extracting the inner source IP address prior to performing the BPF LRU map lookup and packet drop.

Crucially, while a tenfold increase in total packet size (130 bytes to 1455 bytes) occurs, the detection delay increases by merely 12 to 40 nanoseconds. This proves that the eBPF/XDP program correctly parses headers without buffering or copying the entire payload into memory, maintaining near-constant execution speeds regardless of payload volume. Overall, the detection delay results are highly comparable, with values differing by just under 100 nanoseconds.

Reporting and Mitigation Delay: Figure 10 presents the reporting and CP-MO mitigation latencies using a brokenaxis scale, highlighting the disparity in reporting and core orchestration latencies.

Figure 10. UP-TA telemetry reporting delay (TreportT_{\mathrm{report}}) shown in purple color and CP-MO mitigation orchestration delay (TmitigateT_{\mathrm{mitigate}}) shown in grey color, averaged over 100 samples (95% CI). Algorithm 2 and Algorithm 3 detail the exact computation of these metrics.

The UP-TA reporting delay (TreportT_{\mathrm{report}}) averages just 0.988 ms. This 1 ms overhead represents the time required to transfer the monotonic event through the kernel trace_pipe to user-space (UP-TA) and parse the resulting JSON alert at the CP-MO. This demonstrates that the telemetry dispatch is incredibly lightweight and will not bottleneck the UPF node’s CPU, even during high-frequency alert generation.

In contrast, the CP-MO mitigation delay (TmitigateT_{\mathrm{mitigate}}) is the most time-consuming phase of the closed-loop defense, averaging 132.6 ms. This represents the natural networking and processing overhead of executing complex HTTP REST APIs across the 5G core, including invoking the SMF for session release, the AMF for UE deregistration, and the UDR for the attacker’s profile purging.

In summary, while the total closed-loop delay is primarily dominated by the 132.6 ms mitigation phase, this delay does not expose the victim UE to the nested GTP attack. Because the XDP-DDM has already isolated and dropped the malicious packets in the DP within 0.4 μ\mus, the victim is instantly protected. Furthermore, because the CP-MO executes the REST API teardown in a separate background thread, it never blocks the reception of new UDP alerts from the UP-TA. The system is perfectly asynchronous; the XDP-DDM absorbs the nested GTP attack instantly, while the CP-MO permanently revokes the attacker’s network access in the background.

Key Takeaway: The proposed defense achieves sub-microsecond (< 0.4 μ\mus) threat isolation in the data plane, instantly shielding victim UEs from nested GTP attacks. By asynchronously offloading the control-plane teardown, the system permanently revokes attacker access without introducing blocking overhead or bottlenecks to the UPF data path.

Limitations

While the experimental results demonstrate the sub-microsecond efficacy and resilience of the proposed closed-loop eBPF defense, several implementation and environmental limitations of this work are as follows:

Hypervisor Clock Skew in Reporting Measurements: As noted in § 5.4, the measurement of the reporting delay (TreportT_{\mathrm{report}}) excludes the intermediate virtual switch transit delay. Because the UP-TA and CP-MO execute across isolated virtualized boundaries, inherent hypervisor clock skew introduces sub-millisecond drift between independent system clocks. Consequently, one-way network transit delay across the virtual switch could not be reliably isolated without hardware timestamping and was excluded to preserve measurement accuracy.

Testbed Virtualization and Scalability Bounds: Our experimental testbed deploys the 5G and RAN components across VirtualBox VMs interconnected via paravirtualized (virtio-net) network interfaces. Because UERANSIM emulates the 5G NR protocol stack in user space over standard UDP sockets and packet forwarding traverses the host hypervisor’s virtual switch, baseline user throughput is bounded to approximately 25–35 Mbps, and virtio-net XDP execution remains subject to hypervisor context-switching overhead. Consequently, our evaluation focuses on functional efficacy and cross-slice protection under a single-attacker 10,000 PPS flood rather than saturating XDP-DDM’s upper line-rate ceiling. Extensive bare-metal stress testing, including UPF and CP CPU utilization profiling, coordinated multi-UE flooding, and comparative benchmarking against alternative filtering approaches, remains an important future direction.

Encrypted N3 Interfaces (IPsec): Because XDP programs execute at the network driver level prior to the Linux kernel’s memory allocation and IPsec decryption stack, the XDP-DDM requires visibility into cleartext GTP-U headers. Our defense assumes that N3 IPsec tunnels, if deployed, are terminated at an external security gateway prior to reaching the UPF N3 ingress interface, or decrypted in hardware via SmartNIC inline IPsec offload.

Inner IP Spoofing and Outer TEID Correlation: While the XDP-DDM extracts and reports both the outer GTP-U TEID and the inner IPv4 source address in its telemetry payload, the current defense indexes the 10-second eBPF debounce map and performs CP-MO session lookup and revocation using only the inner source IP address. This design assumes that ingress source-IP validation is enforced prior to the UPF N3 interface (e.g., at the gNB). If an adversary can transmit nested GTP-U packets with spoofed inner source IPs, three secondary risks arise: ① randomized inner IPs can bypass the per-IP debounce map and flood the telemetry channel, ② unrecognized spoofed IPs can evade CP-MO session lookup, and ③ spoofing another active subscriber’s IP could trigger an unintended session revocation of an innocent victim UE. Because the outer GTP-U TEID is assigned by the trusted serving gNB and cannot be forged by the UE (unless the attacker controls the gNB), basing both the eBPF debounce map and the CP-MO subscriber resolution strictly on the outer GTP-U TEID resolves all three risks without altering the closed-loop architecture.

Detection Signature and Parsing Scope: Our proposed XDP-DDM identifies nested GTP-U packets by matching inner UDP traffic destined for the GTP-U port 2152. In case a benign UE communicates with an external server on port 2152, this check could trigger a false positive. In commercial deployments, this can be eliminated by verifying that the inner destination IP address is targeting the operator’s core/internal network rather than the DN, and by validating the inner GTP-U header fields. For the scope of our work, we assume benign UEs do not generate non-GTP UDP traffic destined for port 2152. Additionally, the current solution targets untagged, unfragmented IPv4 traffic, while IPv6, 802.1Q VLAN tags, and IP fragmentation can be accommodated via standard XDP parser extensions.

Ethical Considerations

All experimental evaluations and the data plane attack in this study were conducted in a localized, privately hosted 5G testbed. To guarantee absolute containment and ensure that no malicious traffic could escape the controlled environment, the Virtual Machines (VMs) hosting the 5G testbed were entirely isolated from the public internet. Furthermore, this work does not introduce any novel attack vectors or zero-day exploits. The implemented attack, specifically the Nested GTP (GTP-in-GTP) attack, relies on previously published and academically acknowledged vulnerabilities. These known exploits were reproduced in our isolated environment solely to empirically validate the defensive efficacy of the proposed framework.

Conclusion

This paper presents a closed-loop eBPF/XDP security defense designed to mitigate recently uncovered nested GTP-U protocol tunneling attacks in 5G and future 6G core networks. Empirical evaluations demonstrated that the system neutralizes cross-slice attacks in under 0.4 µs, fully preserving the performance of the victim slice. The findings of this study carry several practical implications for the design and operation of 5G-Advanced and future 6G data planes. First, our results indicate that integrating lightweight, debounced eBPF/XDP filters directly at the UPF ingress provides strong active protection against cross-slice GTP-U attacks, allowing operators to safely share underlying UPF resources across heterogeneous slices. Second, because XDP-DDM processes frames within the network driver, the defense operates independently of the specific UPF software implementation. As standardization bodies transition towards 6G while retaining 5G SBA and GTP-U foundations, this plug-and-play defense offers network operators a practical path to harden existing and future Linux-based UPFs without modifying VNF source code.

Acknowledgment

This work was supported by the Natural Sciences and Engineering Research Council of Canada (NSERC). This research was enabled in part by support provided by Research Computing Services (https://carleton.ca/rcs) at Carleton University.

Generative AI Usage Considerations

We, the authors, are fully responsible for the originality and correctness of all content in this paper, including the contributions, proposed defense, evaluation methodology, experimental results, and conclusions. Generative AI was used for editorial purposes in this manuscript, and all outputs were inspected by the authors to ensure accuracy and originality.

References

  1. [1]3GPP, “Study on Architecture for 6G System; Stage 2,” Technical Report (TR), 3GPP TR 23.801-1, Version 0.8.0 Release 20, 3rd Generation Partnership Project, 2026.
  2. [2]3GPP, “General Packet Radio System (GPRS) Tunnelling Protocol User Plane (GTPv1-U),” Technical Specification (TS), 3GPP TS 29.281, Version 19.2.0 Release 19, 3rd Generation Partnership Project, 2025.
  3. [3]A. Shaik, R. Jaschek, and J.-P. Seifert, “Uncovering hidden paths in 5g: Exploiting protocol tunneling and network boundary bridging,” in Proceedings of the 2025 ACM SIGSAC Conference on Computer and Communications Security, pp. 231–245, 2025.DOI
  4. [4]A. Shaik and R. Jaschek, “The 5G Titanic,” in Black Hat USA, 2025.
  5. [5]Y. Zhang, T. Wan, Y. Yang, H. Duan, Y. Wang, J. Chen, Z. Wei, and X. Li, “Invade the walled garden: Evaluating gtp security in cellular networks,” in 2025 IEEE Symposium on Security and Privacy (SP), pp. 1159–1177, IEEE, 2025.DOI
  6. [6]A. AbdulGhaffar and A. Matrawy, “Slice Isolation-as-a-Service: An Isolation Mechanism to Proactively Defend Cross-Slice Attacks in 5G-Advanced and Beyond.” arXiv preprint arXiv:2611.23826, 2026. DOI: https://doi.org/10.48550/arXiv.2611.23826.
  7. [7]S. I. Salim, “A Deep Dive into the Packet Reflection Vulnerability Allowing Attackers to Plague Private 5G Networks — TrendAI (US).” TrendAI™ Deep Research, 2023. [Online]. Available: https://www.trendainsecurity.com/en-us/resources-insights/deep-research/plague-private-5g-networks. Accessed: 2026-10-15.
  8. [8]MITRE, “MITRE FiGHT (5G hierarchy of threats) framework: Protocol tunneling: Ue access via gtp-u (FGT1572),” 2025. [Online]. Available: https://fight.mitre.org/techniques/FGT1572.501/.
  9. [9]S. Kwon, S. Park, D. Kim, D. Kim, S. Kim, and T. Shon, “Mobile core network attack techniques using ue,” IEEE Access, 2026.
  10. [10]S. I. Salim, “Attacks on 5G Infrastructure From Users’ Devices.” Trend Micro Research, 2023.
  11. [11]D. Sattar, A. Matrawy, and A. AbdulGhaffar, “Secure 5g core network slicing for ddos mitigation,” IEEE Systems Journal, vol. 19, no. 3, pp. 754–765, 2025.
  12. [12]M. Mahyoub, A. AbdulGhaffar, E. Alalade, and A. Matrawy, “A security-aware network function sharing model for 5g slicing,” Security and Privacy, vol. 8, no. 3, p. e70039, 2025.
  13. [13]M. Bolourian, N. Limam, M. A. Salahuddin, and R. Boutaba, “5Guard: Isolation-aware end-to-end slicing of 5G networks,” IEEE Transactions on Mobile Computing, 2025.
  14. [14]M. S. Khan, B. Farzaneh, N. Shahriar, N. Saha, and R. Boutaba, “Slicesecure: Impact and detection of dos/ddos attacks on 5g network slices,” in 2022 IEEE Future Networks World Forum (FNWF), pp. 639–642, 2022.
  15. [15]F. Parola and F. Risso, “A proof-of-concept 5g mobile gateway with ebpf,” Proceedings of the SIGCOMM’20 Poster and Demo Sessions, 2020.
  16. [16]F. Messaoudi, L. Wang, A. Mekrache, A. Ksentini, B. Li, J. Su, S. Messaoudi, and S. El Ghalbzouri, “The Brewing Storm in 5G’s Data Plane: Design and Evaluation of a High-Performance eBPF/XDP-Based User Plane Function,” IEEE Transactions on Network and Service Management, 2026.
  17. [17]A. T.-J. Akem and M. Fiore, “Towards real-time intrusion detection in p4-programmable 5g user plane functions,” in 2024 IEEE 32nd International Conference on Network Protocols (ICNP), pp. 1–6, IEEE, 2024.
  18. [18]M. Repetto, G. Bruno, J. Yusupov, G. Lamanna, B. Ertl, and A. Carrega, “Automating mitigation of amplification attacks in nfv services,” IEEE Transactions on Network and Service Management, vol. 19, no. 3, pp. 2382–2396, 2022.
  19. [19]L. Loureiro, V. Pereira, T. Cruz, and P. Simões, “Enhancing 5g core security with ebpf/xdp,” in NOMS 2024-2024 IEEE Network Operations and Management Symposium, pp. 1–6, IEEE, 2024.DOI
  20. [20]A. Javadpour, F. Ja’fari, T. Taleb, and C. Benzaïd, “Reinforcement learning-based slice isolation against ddos attacks in beyond 5g networks,” IEEE Transactions on Network and Service Management, vol. 20, no. 3, pp. 3930–3946, 2023.DOI
  21. [21]N. Yarkina, A. Gaydamakа, D. Moltchanov, and Y. Koucheryavy, “Performance assessment of an itu-t compliant machine learning enhancements for 5g ran network slicing,” IEEE Transactions on Mobile Computing, vol. 23, no. 1, pp. 719–736, 2022.DOI
  22. [22]A. AbdulGhaffar, M. Mahyoub, and A. Matrаwy, “On the impact of flooding attacks on 5g slicing with different vnf sharing configurations,” in 2024 20th International Conference on the Design of Reliable Communication Networks (DRCN), pp. 136–142, IEEE, 2024.
  23. [23]M. Mahyoub, A. AbdulGhaffar, E. Alalade, E. Ndubisi, and A. Matrawy, “Security analysis of critical 5g interfaces,” IEEE Communications Surveys & Tutorials, vol. 26, no. 4, pp. 2382–2410, 2024.DOI
  24. [24]Y. He, R. Guo, Y. Xing, X. Che, K. Sun, Z. Liu, K. Xu, and Q. Li, “Cross container attacks: The bewildered eBPF on clouds,” in 32nd USENIX Security Symposium (USENIX Security 23), pp. 5971–5988, 2023.
  25. [25]T. Høiland-Jørgensen, J. D. Brouer, D. Borkmann, J. Fastabend, T. Herbert, D. Ahern, and D. Miller, “The express data path: Fast programmable packet processing in the operating system kernel,” in Proceedings of the 14th international conference on emerging networking experiments and technologies, pp. 54–66, 2018.
  26. [26]D. Soldani, P. Nahi, H. Bour, S. Jafarizadeh, M. F. Soliman, L. Di Giovanna, F. Monaco, G. Ognibene, and F. Risso, “ebpf: A new approach to cloud-native observability, networking and security for current (5g) and future mobile networks (6g and beyond),” IEEE Access, vol. 11, pp. 57174–57202, 2023.DOI
  27. [27]Free5GC, “GitHub - free5gc/go-upf.” [Online]. Available: https://github.com/free5gc/go-upf. Accessed: 2026-07-10.
  28. [28]Free5GC, “GitHub - free5gc/gtp5g: GTP-U Linux Kernel Module.” [Online]. Available: https://github.com/free5gc/gtp5g. Accessed: 2026-07-10.
  29. [29]Linux Foundation, “free5GC.” [Online]. Available: https://free5gc.org/. Accessed: 2026-07-10.
  30. [30]3GPP, “Procedures for the 5G System (5GS),” Technical Specification (TS), 3GPP TS 23.502, Version 19.9.0 Release 19, 3rd Generation Partnership Project, 2026.
  31. [31]H.-X. Huang (clydhehxh), “Efficient and Hardware-Independent Deep Packet Inspection for Free5GC.” free5GC Blog and Source Code Repository, 2026. [Online]. Available: https://free5gc.org/blog/20260225/20260225/ and https://github.com/c1ydehxh/dpi5g. Accessed: 2026-10-15.
  32. [32]UERANSIM, “GitHub - aligungr/UERANSIM: Open source 5G UE and RAN (gNodeB) implementation.” [Online]. Available: https://github.com/aligungr/UERANSIM/. Accessed: 2026-08-10.
  33. [33]Nokia, “containerlab.” [Online]. Available: https://containerlab.dev/. Accessed: 2026-07-10.
  34. [34]Oracle, “Oracle VirtualBox.” [Online]. Available: https://www.virtualbox.org/. Accessed: 2026-07-10.
  35. [35]Adamali1985, “signal lost for cell [1] from gNB at bursty traffic from UE - Issue #714 - aligungr/UERANSIM.” [Online]. Available: https://github.com/aligungr/UERANSIM/issues/714. Accessed: 2026-07-10.
  36. [36]CISCO, “TRex.” [Online]. Available: https://trex-tgn.cisco.com/. Accessed: 2026-07-10.

Paper details

vlnc:W_8xu6td9g
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Generative AI

View statement
Looking for related papers…
Contents