Skip to Content
ElectronicsElectronics
  • Article
  • Open Access

10 October 2026

29 Pages

SanctumSPA: Architectural Decoupling and Confidential Verification for High-Throughput Single Packet Authorization

,
and
1
College of Computer Science, Beijing University of Technology, Beijing 100124, China
2
School of Computer and Information Technology, Shanxi University, Taiyuan 030006, China
*
Author to whom correspondence should be addressed.

Abstract

In high-throughput network perimeters, traditional single packet authorization (SPA) for zero trust network access faces performance bottlenecks and memory-safety risks from user-space packet capture and untrusted rich execution environments. To address these limitations, this study proposes SanctumSPA, an architectural integration and decoupling framework separating the policy enforcement point from the policy decision point. Authorization is modeled as an asynchronous pipeline in which the extended Berkeley Packet Filter (eBPF) performs kernel-level packet interception, while cryptographic verification is offloaded to an Intel Software Guard Extensions-based trusted execution environment. Security-critical parsing and control logic use Safe Rust and asynchronous input/output to reduce cross-boundary overhead. Cloud-based experiments showed up to two orders of magnitude higher throughput than a traditional user-space baseline, with hundreds of thousands of requests per second and sub-millisecond latency before queue saturation. During a 3,310,503-packet adversarial storm, the multi-tier defense separated capacity-driven overload shedding (92.2%) from deterministic security enforcement (7.7%), limiting the maximum observed queuing latency at 7.56 s while supporting legitimate probe recovery via burst redundancy. These findings indicate that combining eBPF with confidential computing provides a resilient gateway for high-throughput infrastructures.

1. Introduction

TCP/IP underpins modern computer networks, but its open connectivity exposes critical services to traffic interception and large-scale denial-of-service (DoS) attacks, particularly under high-volume, concurrent traffic flows. Traditional perimeter defenses, including static firewalls and virtual private networks, lack the flexibility required for dynamic authorization and struggle with the scale and heterogeneity of modern networks [1]. Zero-trust network access (ZTNA) addresses these limitations through the principle “never trust, always verify,” requiring identity and cryptographic authentication before a connection is established [2]. One architectural implementation is the software-defined perimeter (SDP), which separates the policy decision point (PDP) from the policy enforcement point (PEP) to provide dynamic, policy-based access control [3].
Within the SDP framework, single packet authorization (SPA) provides a lightweight authorization mechanism. A client encapsulates cryptographic credentials in a single packet, which the server captures and verifies before updating the firewall rules to permit the connection. This “authenticate-then-connect” model conceals protected services from unauthorized probes and disrupts attacks during network reconnaissance.
Despite these advantages, existing SPA schemes face limitations in architectural scalability and execution security. On the data plane, legacy systems rely on kernel firewalls such as Netfilter/iptables for packet capture and policy updates. Processing concurrent authorization requests therefore incurs substantial context-switching and rule-update overhead, making the central SDP controller susceptible to DoS attacks [4,5]. Under high concurrency, synchronous rule management may also fail to remove expired entries, creating “zombie rules” that leave gateways exposed. In the control plane, previous studies have paid limited attention to the execution environment of server-side authorization daemons. In cloud and edge deployments, these daemons commonly run in untrusted rich execution environments (REEs), where cryptographic credentials and parsing logic may be exposed to memory extraction, tampering, or corruption [6].
To address these challenges, we propose SanctumSPA, an architectural integration and decoupling framework that combines the extended Berkeley Packet Filter (eBPF) with confidential computing. On the data plane, eBPF serves as the PEP and performs line-rate packet interception, ultrafast preprocessing, and dynamic policy enforcement in the kernel. On the control plane, an Intel Software Guard Extensions (SGX) trusted execution environment (TEE) serves as the PDP and isolates cryptographic verification and authorization logic from the host operating system. An asynchronous bridge decouples these planes, reducing cross-boundary blocking while supporting controlled backpressure and state synchronization under bursty traffic.
We implemented SanctumSPA’s security-critical parsing and control pipelines in Safe Rust and evaluated the architecture on a cloud-based SGX testbed. This study addresses three research questions:
  • RQ1: To what extent does the proposed decoupled eBPF-based architecture improve SPA throughput and DoS resilience relative to the traditional fwknopd baseline?
  • RQ2: What microarchitectural capacity cost does TEE-based cryptographic verification impose, and is this cost acceptable for practical deployment?
  • RQ3: Does the multilayer architecture protect the TEE from exhaustion during multimodal DoS attacks?
The study makes three contributions. First, SanctumSPA introduces an architectural decoupling that integrates an eBPF/XDP data plane with an SGX-isolated control plane via an asynchronous Rust bridge, amortizing enclave boundary overhead while isolating credentials from a root-privileged host adversary under the stated assumptions. Second, the architecture enforces two deterministic state-machine invariants: an active-connection tracking table (ℳconn) in eBPF that eliminates non-SYN port scanning bypasses, and an enclave-resident sliding-window cache (𝒞replay) guaranteeing in-window anti-replay freshness without global cache flushes. Third, we evaluate SanctumSPA under a 3.31M-packet flood, demonstrating that it eliminates state-consistency failures and separates 92.2% wire-speed overload shedding from 7.7% security enforcement, with a maximum observed queuing latency of 7.56 s while preserving high legitimate session establishment probability.
The remainder of this paper is organized as follows. Section 2 reviews related work, and Section 3 introduces the technical background. Section 4 defines the threat model, Section 5 presents the SanctumSPA architecture, and Section 6 describes its implementation. Section 7 reports the evaluation results, Section 8 discusses the limitations and future work, and Section 9 concludes the paper.

3. Background and Preliminaries

This section introduces the core technologies underlying SanctumSPA’s high-performance data plane and isolated control plane.

3.1. eBPF and eXpress Data Path (XDP)

eBPF is a Linux kernel technology that allows verified, sandboxed programs to execute dynamically without modifying the kernel source code or rebooting the system [28,29]. These event-driven programs execute at predefined kernel or application hook points.
For high-performance packet processing, XDP provides an early packet-processing hook in the Linux networking path. This placement allows eBPF programs to intercept, modify, or drop packets before they enter the main Linux networking stack, including TCP/IP and Netfilter/iptables [28]. Dropping invalid or malicious packets at this stage reduces processing overhead and supports high-rate DoS mitigation [28,29].
eBPF maps are kernel-resident key–value data structures that share state among eBPF programs and between kernel and user space [28,29]. In SanctumSPA, XDP forms the SPA data plane and serves as the PEP, while eBPF maps support policy-state synchronization between the data and control planes.

3.2. Intel SGX and Confidential Computing

Intel SGX is a hardware-based confidential computing technology that creates protected memory regions called enclaves [30].
Its security model minimizes the trusted computing base by excluding privileged software, including the operating system and hypervisor, from the enclave trust boundary [30,31]. Enclave code and data reside in the Enclave Page Cache (EPC), where hardware mechanisms protect them against direct access and unauthorized modification from outside the enclave [30].
However, native SGX deployment presents two main challenges. First, porting legacy applications often requires substantial refactoring to partition trusted and untrusted components, increasing engineering effort [30,31]. Second, enclave entry and exit operations incur state-transition and security-check overhead that can exceed that of conventional system calls [30]. Therefore, an SGX-based network authorization control plane requires an architecture that minimizes or amortizes enclave-boundary transitions.

3.3. Occlum Library Operating System

To reduce the development and compatibility burden of native SGX applications, library operating systems (LibOSes) package operating-system services, including file systems, networking, and memory management, as user-space libraries within an enclave [31,32]. This approach allows many legacy applications to run inside SGX with limited modification.
Occlum is a memory-safe, multiprocess SGX LibOS [32]. Unlike earlier designs that assign a separate enclave to each process, Occlum uses a single-enclave multitasking architecture [31]. It applies software fault isolation (SFI), implemented with Intel Memory Protection Extensions, to create multiple lightweight SFI-isolated processes (SIPs) within one enclave [32].
Because the SIPs share a LibOS instance and enclave address space, this design reportedly accelerates process creation by several orders of magnitude and reduces encryption and copying overhead during interprocess communication (IPC), facilitating migration of SPA daemons and cryptographic verification modules into the TEE [32]. Occlum also provides a system-call interface compatible with the Portable Operating System Interface (POSIX), enabling these components to run inside the TEE without extensive source-code modification. In SanctumSPA, Occlum provides the trusted runtime for the control-plane components, isolating authorization logic and cryptographic material from direct access by the untrusted host operating system while reducing process-management and interprocess communication overhead under concurrent workloads.

4. Threat Model

SanctumSPA is designed as a robust, high-performance pre-authentication barrier for network gateways. We therefore assume a powerful adversary, denoted by 𝒜, with three goals: (1) 𝒢bypass: bypassing the authorization mechanism to access the protected server; (2) 𝒢extract: extracting sensitive cryptographic credentials; and (3) 𝒢dos: rendering the gateway unavailable through resource exhaustion or state inconsistency, such as by forcing the creation of zombie firewall rules. The threat model has two dimensions: network-level adversary (𝒜net) and system-level adversary (𝒜sys).
Network-level Adversary (𝓐net): We assume that 𝒜net has full control over the network path between the client and the gateway and possesses the following oracle capabilities:
𝒪eavesdrop: Can intercept any legitimate SPA payload Pspa in transit.
𝒪inject: Can inject, modify, or replay arbitrary packets P′ into the network channel.
𝒪flood: Can generate massive volumetric network floods, such as millions of pps, aimed at overwhelming the gateway’s central processing unit (CPU), memory, or the TEE’s limited EPC.
Furthermore, 𝒜net can craft multimodal attacks involving malformed packets, manipulated timestamps, and cryptographic fuzzing probes, including hash-based message authentication code (HMAC) poisoning.
System-level Adversary (𝓐sys): SanctumSPA addresses vulnerabilities in legacy SPA systems, such as fwknopd, in which cryptographic keys reside in host OS memory. We assume a worst-case internal threat scenario in which 𝒜sys has exploited a user-space vulnerability and obtained root privileges on the gateway OS. With root access, 𝒜sys can inspect user-space memory, monitor IPC, and attempt to tamper with the Tokio agent. Specifically, 𝒜sys could intercept authorization directives, such as ACCEPT:IP, emitted by the SGX enclave or bypass the enclave to inject forged entries directly into the eBPF map through the standard bpf() system call.
Assumptions and Out-of-Scope Threats: To bound the scope of this study while maintaining a realistic security posture, we make the following assumptions:
  • Cryptographic Security: We assume that the Advanced Encryption Standard with a 256-bit key in Cipher Block Chaining mode (AES-256-CBC) provides indistinguishability under chosen-plaintext attack (IND-CPA). We also assume that HMAC based on the 256-bit Secure Hash Algorithm (SHA-256), denoted HMAC-SHA256, provides existential unforgeability under chosen-message attack (EUF-CMA).
  • Kernel Integrity: We assume that the host kernel is protected by the Linux Kernel Lockdown feature and signature verification for eBPF programs. Thus, even a root-privileged 𝒜sys cannot arbitrarily modify running kernel code or inject malicious eBPF bytecode.
  • Data-Plane State Forgery by Root: Under these assumptions, SanctumSPA protects cryptographic-key confidentiality against a root-privileged 𝒜sys, thereby preventing 𝒢extract. However, preventing a fully compromised host operating system from modifying its firewall rules—for example, by altering eBPF maps (ℳauth, ℳconn) through the bpf() system call—requires hardware isolation, such as smart network interface card (SmartNIC)-based I/O isolation or Trust Domain Extensions (TDX), which is outside of this study’s scope and discussed in Section 8.3 and Section 8.5. The primary objective with respect to 𝒜sys is to prevent a local OS compromise from causing a system-wide cryptographic breach.
  • Hardware TEE Security: Intel SGX protects the cryptographic core; however, hardware-level TEE vulnerabilities, such as sophisticated microarchitectural side-channel attacks or physical fault injection, are outside the scope of this study.
  • Trusted Key Provisioning: Server-side master keys (Kmac, Kenc) are provisioned into the enclave at boot time over an authenticated Transport Layer Security (TLS) channel after Intel SGX Data Center Attestation Primitives (DCAP) validates the signed enclave quote and its MRENCLAVE measurement, before secret injection. Client-side credential management and out-of-band pre-shared key distribution before gateway deployment are assumed secure and are treated as outside the scope of the proposed architecture; client-side hardware roots of trust are discussed in Section 8.1.

5. System Architecture

5.1. Architectural Modeling and System Overview

The key insight of this study is that traditional SPA architectures suffer from inherent performance bottlenecks and security vulnerabilities because they rely on user-space packet sniffing and OS-level cryptographic processing. As illustrated in Figure 1a, legacy systems such as fwknopd rely on libpcap to extract packets (T-1a and T-1b) and use iptables for access control (T-1c). This flow introduces significant context-switching overhead, is prone to state inconsistency—for example, by leaving “zombie rules” under stress—and exposes sensitive cryptographic keys to potential OS compromise. Consequently, these legacy paradigms struggle with the high concurrency and large data volumes typical of modern high-throughput network infrastructures.
Figure 1. Architectural modeling and comparison of traditional SPA systems and SanctumSPA. The upper half (a) shows the legacy fwknopd flow and its synchronous bottlenecks. The lower half (b) shows the SanctumSPA flow and its multiobjective optimization, decoupling high-speed eBPF data-plane filtering for large-scale traffic from hardware-isolated SGX control-plane verification through an asynchronous Tokio agent. Blue dashed arrows denote control/authorization flows; red solid arrows denote business data flows; yellow boxes represent Linux kernel components; and green boxes represent SGX enclave components. The notation S-* denotes the proposed SanctumSPA pipeline stages (S-1a to S-2c), while T-* denotes the traditional baseline flows (T-1a to T-2b).
SanctumSPA addresses these limitations by decoupling high-speed packet interception from cryptographic verification. As depicted in Figure 1b, the SanctumSPA flow (S-*) operates through the following securely bridged three-tier pipeline:
  • eBPF-Driven Data Plane (High-Speed Intercept): SanctumSPA deploys an eBPF XDP program directly at the network interface. When a client sends an SPA packet (S-1a), XDP intercepts it, performs zero-copy extraction, and pushes the raw payload into an eBPF ring buffer (S-1b). For standard business traffic, XDP acts as a high-speed router, forwarding authorized packets at the line rate while completely bypassing the traditional network-filtering stack.
  • Asynchronous Control Plane Bridge: To bridge the kernel and TEE without blocking I/O, SanctumSPA employs a Tokio-based asynchronous Rust agent. The agent listens to events from the ring buffer (S-1b), serializes the data, and forwards them across the enclave boundary through an RPC/TCP channel (S-1c). This network-based decoupling, rather than local memory sharing, ensures that the system natively supports future distributed deployments—for example, by separating the data-plane gateway from the TEE verification node—and provides graceful backpressure during DoS attempts.
  • Hardware-Isolated Cryptographic Core and Atomic Synchronization: All cryptographic operations are offloaded to an Intel SGX enclave. Following successful hardware-isolated verification, the enclave returns an authorization directive to the Tokio agent, which performs an atomic map update (S-1d) on the eBPF maps. Unlike traditional systems that fork processes to update firewall rules, SanctumSPA uses eBPF maps shared between user and kernel space to modify the XDP state machine instantly, thereby eliminating the risk of state inconsistency. Consequently, subsequent business traffic (S-2a) is evaluated against the updated map (S-2b) and forwarded (S-2c) with deterministic microsecond-level latency.

5.2. Formal Security Analysis

Before detailing the implementation algorithms, we formalize the SanctumSPA protocol to prove its resilience against the threat model defined in Section 4. Let the SPA protocol be Πspa = (KeyGen, GenToken, Verify).
The client generates an SPA token Pspa by constructing an OpenSSL-compatible encrypted payload with an appended message authentication tag
C = AES − 256 − CBC K enc ( P ) , T = HMAC − SHA 256 K mac ( salt ∥ C ) , P spa = ⟨ salt , C , T ⟩ ,
where P denotes the plaintext payload encapsulating client identification, the requested resource, and the client generation timestamp Tinner; Kmac and Kenc are preshared integrity and encryption keys, respectively; and salt is a pseudo-random cryptographic salt.
The SGX enclave executes the verification function Verify(Pspa):
Verify ( P spa ) = ACCEPT , if   MAC calc = MAC recv ∧ | T sys − T inner | ≤ 120 ∧ Hash ( P spa ) ∉ C replay , DROP , otherwise ,
where Tsys denotes the current system timestamp, and 𝒞replay is the stateful anti-replay cache maintained securely inside the enclave.
Theorem 1 
(In-Window Anti-Replay Invariant). Under the verification function Verify, assuming the volume of valid non-expired requests does not exceed the replay cache capacity threshold (|𝒞replay| ≤ Nreplay) within the freshness window Δt = 120 s, any replayed token P′ = Pspa is deterministically rejected.
Proof of Theorem 1. 
To achieve the unauthorized bypass goal 𝒢bypass, the network adversary 𝒜net must forge a new token or replay an intercepted one. By the EUF-CMA security of HMAC-SHA256, forging a valid tag without knowledge of Kmac succeeds with negligible probability. If 𝒜net replays Pspa outside the freshness interval (|Tsys − Tinner| > 120), the temporal freshness constraint in (2) deterministically rejects it. If replayed within the 120 s freshness interval, the anti-replay state machine evicts only stale entries where T < Tsys − 120. Under the operational capacity bound (|𝒞replay| ≤ Nreplay), the cached digest Hash(Pspa) remains present, causing the condition Hash(Pspa) ∉ 𝒞replay in (2) to be false, yielding an immediate DROP. Beyond this operational bound, single-entry bounded eviction displaces only the oldest record, preventing catastrophic state clearance. □
Theorem 2 
(Parser Robustness in Safe Rust). The parsing of any untrusted network payload Pmal within the Safe Rust pipeline will not induce undefined behavior or memory corruption.
Proof of Theorem 2. 
Traditional C/C++ SPA parsers are susceptible to spatial and temporal memory corruption (e.g., buffer overflows and out-of-bounds reads). SanctumSPA mitigates this risk by restricting untrusted payload decoding in the user-space gateway and SGX enclave exclusively to Safe Rust. By leveraging Rust’s affine type system and ownership semantics—formally verified sound in foundational frameworks such as RustBelt [33]—well-typed Safe Rust execution guarantees freedom from spatial and temporal memory violations. Necessary low-level interfaces (e.g., kernel packet slice indexing and LibOS Foreign Function Interface (FFI) boundaries) are isolated by defensive bounds checks and validation assertions. Consequently, malformed inputs Pmal induce predictable, handled error returns or safe panic unwinding without compromising memory integrity. □
Theorem 3 
(Cryptographic State Isolation against Root Adversary). Conditioned on secure initial attestation and trusted key provisioning, a root-privileged host adversary 𝒜sys cannot compromise the confidentiality of the cryptographic keys (Kmac, Kenc) or the integrity of the replay state 𝒞replay.
Proof of Theorem 3. 
The cryptographic keys (Kmac, Kenc) and the stateful cache 𝒞replay reside exclusively within the SGX Enclave Page Cache (EPC). The SGX hardware Memory Encryption Engine (MEE) transparently encrypts and integrity-protects all EPC lines written to external DRAM. Thus, unauthorized direct memory-reads by 𝒜sys yields ciphertext indistinguishable from random noise under IND-CPA assumptions, preserving state confidentiality against privileged host tampering. □
Theorem 4 
(Bounded State Consumption and Architectural Survivability). Under volumetric saturation by an offered load λ (injected via 𝒪flood), SanctumSPA guarantees constant asymptotic memory consumption and bounded queuing latency, preventing gateway process exhaustion.
Proof of Theorem 4. 
Architectural memory consumption is bounded across all enforcement boundaries: |ℳconn| ≤ Nconn and |ℳauth| ≤ Nauth in kernel space, and |𝒞replay| ≤ Nreplay within enclave memory. The aggregate memory footprint satisfies
Mtotal ≤ |ℳconn| ⋅ Sconn + |ℳauth| ⋅ Sauth + |𝒞replay| ⋅ Sreplay + Bring = 𝒪(1),
where Sconn, Sauth, and Sreplay denote the fixed entry sizes of the respective state structures, Sevent is the size of each event, and Bring is the static ring-buffer memory allocation accommodating up to Nring = ⌊Bring/Sevent⌋ events. When the ingestion rate exceeds the enclave processing rate (λ > μ), the data plane enforces wire-speed backpressure by shedding overflowing frames at the ring buffer. Consequently, the queuing backlog is physically bounded by Nring events, ensuring that queuing delay satisfies Tqueue ≤ Nring/μ < ∞. The system thus prevents unbounded queuing and out-of-memory process crashes. □
Remark on Queue Boundaries and Client Availability: The formal queue bound in Theorem 4 (Tqueue ≤ Nring/μ) strictly applies to the modeled in-kernel ring buffer. Downstream user-space channels within Tokio are separately capacity-bounded by runtime queue limits to prevent process memory exhaustion, while the maximum observed 7.56 s latency and request survivability under saturation remain empirical observations of the end-to-end pipeline, as evaluated in Section 7.4.

6. Implementation

We implemented a fully functional prototype of the SanctumSPA architecture on Ubuntu Linux. To enforce memory safety and mitigate memory-corruption vulnerabilities such as buffer overflows, the security-critical parsing and control pipelines—spanning kernel space, user space, and the trusted execution environment powered by Occlum LibOS v0.31—were implemented in Safe Rust. As illustrated in Figure 2, the implementation uses a three-stage pipeline to process SPA requests securely and efficiently. The core logic of these stages is formalized in Algorithms 1–3.
Algorithm 1: eBPF XDP Data Plane Filtering (Stage 1)
Require: Raw network packet P, Authorized Map ℳauth, Active Flow Map ℳconn, Ring Buffer ℛbuf, Metrics Array ℳstat
Ensure: Action: XDP_PASS or XDP_DROP
1: Tnow ← bpf_ktime_get_ns()
2: Extract IPsrc, Portsrc, Proto, Portdst, TCP_Flags from P
3: if Portdst ∈ {22,122, 51,820} then ▷ Defense Line 1: Business Ports
4:    Keyflow ← {IPsrc, Portsrc, Portdst, Proto} ▷ Four-tuple session key
5:    if Keyflow ∈ ℳconn then ▷ Fast path for established sessions
6:     if Proto = TCP and TCP_Flags ∩ {FIN, RST} ≠ ∅ then
7:        ℳconn.delete(Keyflow) ▷ TCP session teardown
8:     end if
9:     return XDP_PASS
10:   end if
11:   IsInit ← (Proto = TCP and TCP_Flags = SYN) or (Proto = UDP)
12:   if IsInit then ▷ Connection initiation check
13:     Keyauth ← {IPsrc, Proto, Portdst} ▷ Fine-grained access tuple
14:     if Keyauth ∈ ℳauth then
15:       if Tnow ≤ ℳauth[Keyauth].expire then
16:         ℳconn.insert(Keyflow, Tnow) ▷ Track newly authorized flow
17:         ℳstat[0] + + ▷ Metric: Pass
18:         return XDP_PASS
19:       else
20:         ℳstat[1] + + ▷ Metric: Expired Drop
21:         return XDP_DROP
22:       end if
23:      end if
24:   end if
25:   ℳstat[2] + + ▷ Metric: Unauth Drop
26:   return XDP_DROP
27: else if Proto = UDP and Portdst = 62,201 then ▷ Defense Line 2: Knock Port
28:   Payload ← Extract up to 256 bytes from P
29:   Event ← {IPsrc, Tnow, Payload}
30:   if ℛbuf.push(Event) fails then
31:     ℳstat[3] + + ▷ Metric: RingBuf Backpressure Drop
32:   end if
33:   return XDP_DROP
34: else
35:   return XDP_PASS
36: end if
Figure 2. The three-stage optimized data processing pipeline of the SanctumSPA implementation. (1) Stage 1: eBPF XDP data plane performing zero-copy extraction and strict boundary checks on streaming network data; (2) Stage 2: asynchronous event bridging via an eBPF ring buffer and a Tokio user-space agent, using TCP framing for enclave delivery; (3) Stage 3: SGX enclave cryptographic deconstruction, showing the defensive “authenticate-then-decrypt” pipeline and a deterministic capacity-bounded model within the trusted execution environment. Blue dashed arrows indicate zero-copy extraction and kernel timestamping; purple arrows denote LengthDelimitedCodec TCP framing; red dashed arrows illustrate the staged authenticate-then-decrypt verification pipeline inside the TEE.
Algorithm 2: Asynchronous Event Bridging & GC (Stage 2)
Require: eBPF Ring Buffer ℛbuf, Enclave Channel 𝒞enclave, Authorized Map ℳauth
Ensure: Non-blocking forwarding, state synchronization, and garbage collection
1: Task 1: Upstream SPA Forwarding
2: loop
3:   Wait asynchronously for Event ← ℛbuf.pop()
4:   Ttokio ← bpf_ktime_get_ns()
5:   if Ttokio > Event.Tpkt then
6:     RecordMetric(QueueLatency, Ttokio − Event.Tpkt)
7:   end if
8:   Frame ← Serialize(Event.IPsrc, Event.Tpkt, Event.Payload)
9:   𝒞enclave.send(Frame)
10: end loop
11:
12: Task 2: Downstream Authorization Sync
13: loop
14:    Wait asynchronously for Directive ← 𝒞enclave.receive()
15:    if Directive matches “ACCEPT:IP:Proto:Port:Duration:Tpkt” then
16:      Tnow ← bpf_ktime_get_ns()
17:      Texpire ← Tnow + Duration × 109
18:      ℳauth.insert({IP, Proto, Port}, Texpire)
19:      if Tpkt > 0 then
20:        Tend ← bpf_ktime_get_ns() ▷ Sampled after map insertion
21:        if Tend > Tpkt then
22:          RecordMetric(E2ELatency, Tend − Tpkt)
23:        end if
24:      end if
25:   end if
26: end loop
27:
28: Task 3: Periodic Garbage Collection (GC)
29: loop
30:    Sleep for 2 s
31:    Tnow ← bpf_ktime_get_ns()
32:    EvictCount ← 0
33:    for each (Key, Val) in ℳauth do
34:      if Tnow > Val.expire + 3 × 109 then ▷ 3-s grace period
35:        ℳauth.delete(Key)
36:        EvictCount + +
37:      end if
38:    end for
39:    RecordMetric(GCEvicted, EvictCount)
40: end loop
Algorithm 3: Enclave Cryptographic Deconstruction (Stage 3)
Require: Data Frame F, Anti-Replay Cache 𝒞replay
Ensure: Loopback Authorization Directive or Drop
1: if Length(F) ≤ 12 then return Error
2: end if
3: Extract IPsrc (4B), Tpkt (8B), and Pspa from F
4: if Length(Pspa) ≤ 43 then return Error
5: end if
6: Extract MACrecv (trailing 43B Base64) and Ciphertext from Pspa ▷ Split at |Pspa| − 43
 ▷ OpenSSL magic header compatibility
7:  MACcalc ← Base64Unpad(HMAC − SHA256(“U2FsdGVkX1”‖Ciphertext, KHMAC))
8: if MACcalc ≠ MACrecv then
9:    Metrichmac_fail++; return Error
10: end if
11:  Cipherraw ← Base64Decode(“U2FsdGVkX1”‖Ciphertext)
12:  Salt ← Cipherraw[8..16], Cipheract ← Cipherraw[16..] ▷ Extract 8B salt
13:  KAES, IV ← EVP_BytesToKey(KAES_Base, Salt) ▷ Dynamic key derivation
14:  Plaintext ← AES-256-CBC-Decrypt(Cipheract, KAES, IV)
15: Extract Digestinner, Tinner, Directiveraw from Plaintext
16: if SHA256(Plaintext without digest) ≠ Digestinner then return Error
17: end if
18:  Tsys ← CurrentSystemTime()
19: if |Tsys − Tinner| > 120 then
20:  Metricexpire_fail++; return Error ▷ Freshness check
21: end if
22:  Hashraw ← SHA256(Pspa)
23: Lock 𝒞replay
24:  EvictExpiredEntries(𝒞replay, Tsys − 120) ▷ Sliding window eviction
25: if  Hashraw ∈ 𝒞replay then
26:  Metricreplay_fail++; Unlock 𝒞replay; return Error
27: end if
28: if |𝒞replay| ≥ 200,000 then
29:   𝒞replay.evict_oldest() ▷ Bounded FIFO/LRU eviction
30: end if
31:  𝒞replay.insert(Hashraw, Tsys)
32: Unlock 𝒞replay
33:  IPpayload, Proto, Port ← Parse(Directiveraw)
34:  IPfinal ← IPpayload = “0.0.0.0” ? IPsrc:IPpayload
35: return “ACCEPT:“ + IPfinal + ”:“ + Proto + ”:“ + Port + ”:15:” + Tpkt ▷ Loopback Tpkt

6.1. eBPF XDP Data Plane Modeling and High-Speed Filtering (Stage 1)

To achieve line-rate packet filtering before the OS network stack allocates socket buffers (SKBs), we use the XDP framework. The eBPF program is attached directly to the network interface and acts as a high-speed state machine.
As formalized in Algorithm 1 and depicted in the upper tier of Figure 2, the data plane enforces two defense lines. For business traffic, the program queries the four-tuple session key against ℳconn (Algorithm 1, lines 4–10). Established sessions are forwarded via the fast path, while connection initiation (IsInit) evaluates the client against ℳauth (lines 11–24). Unauthorized non-SYN packets fail the session lookup and are deterministically dropped (line 26), preventing unauthorized probes from bypassing port-level access controls.
Once established, active flows in ℳconn are intentionally maintained beyond the initial knock authorization window to preserve transport-layer continuity for ongoing sessions without repetitive per-packet cryptographic checks. To prevent state exhaustion from inactive flows or connectionless traffic (e.g., UDP, which lacks explicit FIN/RST teardown), ℳconn is enforced as an eBPF LRU map (|ℳconn| ≤ Nconn), where the kernel automatically evicts least-recently active entries under saturation.
For standard business traffic (Defense Line 1), the program performs a lockless lookup against an eBPF least recently used (LRU) map (ℳauth). Using a custom inline function, ptr_at<T>(), the eBPF verifier guarantees that all packet parsing occurs strictly within the ctx.data() and ctx.data_end() boundaries. If the source IP is authorized and the rule has not expired, the packet is forwarded (XDP_PASS); otherwise, it is dropped deterministically.
For SPA packets arriving at the designated authorization port (Defense Line 2), the program performs zero-copy extraction of the raw payload of up to 256 bytes and records a kernel-level timestamp Tnow. These data are encapsulated in a memory-aligned SpaEvent structure (Figure 2, Stage 2) and pushed to a 32 MB eBPF ring buffer ℛbuf. To maintain system resilience during volumetric DoS attacks, the algorithm uses a backpressure mechanism: if ℛbuf is full, the packet is dropped immediately (Algorithm 1, lines 30–32), and a specific telemetry metric is incremented.

6.2. Asynchronous Event Bridging and State Synchronization (Stage 2)

Bridging the kernel-space XDP program and the hardware-isolated verification core requires a mechanism that avoids blocking I/O. We implemented an asynchronous agent using the Tokio framework, as detailed in Algorithm 2.
The agent operates across three concurrent tasks:
  • Upstream SPA Forwarding: The agent uses the epoll mechanism (AsyncFd) to asynchronously read the SpaEvent structures from ℛbuf, reducing queueing delays. To securely transmit these data across the enclave boundary, the agent serializes the event and uses LengthDelimitedCodec (TCP Framing, as shown in Figure 2) over an RPC/TCP channel. This network-based decoupling prevents stream fragmentation and supports future distributed deployments.
  • Downstream Authorization Sync: Upon receiving an authorization directive from the enclave, the agent performs an atomic insertion into ℳauth. Because eBPF maps provide shared state between user and kernel spaces, this update immediately modifies the XDP state machine without the overhead of process forks or context switches.
  • Periodic garbage collection (GC): To prevent map exhaustion and ensure state consistency, a dedicated asynchronous task periodically evicts expired rules from ℳauth, with a 3 s grace period to accommodate in-flight packets (Algorithm 2, line 34).
This stage also aggregates fine-grained telemetry data—such as queue latency (Ttokio − Event.Tpkt) and end-to-end latency—to characterize runtime performance.

6.3. Hardware-Isolated Cryptographic Deconstruction (Stage 3)

The core security verification of the SPA payload is performed within an Intel SGX enclave. Once the framed data crosses the trusted boundary, the enclave executes a defensive parsing pipeline that matches the memory layout illustrated in the bottom tier of Figure 2 and formalized in Algorithm 3.
To mitigate cryptographic oracle attacks and DoS attempts, the deconstruction pipeline strictly enforces an “authenticate-then-decrypt” paradigm. The enclave first verifies the payload’s integrity using HMAC-SHA256 (incorporating an OpenSSL-compatible salt derivation). Only upon a successful integrity check does the system decrypt the ciphertext using AES-256-CBC. Subsequently, the enclave enforces strict freshness checks by comparing the embedded timestamp Tinner with the current system time Tsys and dropping packets older than 120 s (Algorithm 3, lines 19–20).
To thwart replay attacks, a mutex-protected cache Creplay stores the packet digests. Because the EPC is resource constrained, the cache is capacity-bounded to prevent memory exhaustion during high-intensity SPA flooding within the 120 s window. SlidingReplayCache evicts expired entries dynamically using arrival-time ordering (Algorithm 3, line 24). When the cache reaches its 200,000-entry ceiling under heavy traffic, only the oldest entry is evicted (line 29), prioritizing recent in-window freshness without disruptive global cache flushes. Finally, upon successful verification, the enclave generates a stateless loopback directive that returns the original kernel timestamp Tpkt to the host to complete the closed-loop latency measurement.

7. Evaluation

In this section, we present the experiments and results obtained by evaluating SanctumSPA along three dimensions. We aimed to answer the following three RQs, which address the core motivations of our design:
RQ1: Does SanctumSPA overcome the performance and scalability bottlenecks of legacy SPA systems? SanctumSPA aims to provide high-throughput and low-latency pre-authentication for network gateways. As traditional SPA daemons, such as fwknopd, struggle with state consistency and throughput under concurrent loads, SanctumSPA must provide robust macro-level performance. To evaluate its performance, we measured goodput, end-to-end latency, and rule-state consistency against the legacy baseline under increasing target loads.
RQ2: What is the micro-architectural “capacity tax” imposed by the TEE, and how does the system behave at its physical limits? The integration of SGX provides cryptographic protection but introduces inevitable computational overhead. Ideally, the system should degrade gracefully through controlled backpressure rather than fail catastrophically when CPU resources are saturated. We therefore compared SanctumSPA-TEE with SanctumSPA-Native in a micro-ablation study of execution-time breakdowns, asynchronous queue delays, and RingBuf drops under extreme stress.
RQ3: Does SanctumSPA’s multi-layered architecture effectively protect the TEE from resource exhaustion attacks? Our core threat model assumes that an attacker attempts to overwhelm a TEE’s limited computational and memory resources with a massive influx of forged requests. Because the eBPF environment is assumed to be protected, SanctumSPA should limit the offered load reaching the TEE before expensive enclave operations are triggered. To evaluate its resilience, we subjected the system to a “Chaos Storm” involving more than 3.3 million injected packets, measuring overload shedding, security rejection, and memory management across the defense layers.
In summary, RQ1 showed orders-of-magnitude improvements and elimination of the observed state-consistency failures. RQ2 quantified the TEE capacity tax and the system’s controlled degradation through eBPF backpressure. For RQ3, 92.2% of the injected traffic was shed by hardware/NIC and XDP/RingBuf capacity controls, while 7.7% was rejected by eBPF-state and SGX security checks. The details of these experiments are as follows.

7.1. Experimental Setup

To conduct a reproducible evaluation, we deployed a distributed testbed in a cloud environment.
Hardware Environment: The gateway server was equipped with an Intel Ice Lake processor (Intel Corporation, Santa Clara, CA, USA), with two logical cores allocated to the server process, 4 GB of RAM, and a 4 GB SGX EPC. The load generation client ran on a separate machine in the same region, equipped with two virtual CPUs and 2 GB of RAM. Both machines ran on Ubuntu 22.04 LTS (Kernel 5.15.0).
Software Stack: SanctumSPA was implemented entirely in Rust. The eBPF data plane used the Aya framework [34], whereas the user-space control plane used the Tokio asynchronous runtime [35]. To ensure memory safety and strict cross-platform alignment, cryptographic primitives, including AES, HMAC, and SHA-2, were implemented using pure Rust crates [36]. High-precision latency tracking was achieved using state-of-the-art concurrent data structures (DashMap) and high dynamic range histograms (HdrHistogram). Owing to the cloud NIC limitations, the eBPF program operated in the Generic XDP (SKB) mode. The SGX enclave used Occlum LibOS (v0.31.0) [37].
Workload Generation: To simulate heterogeneous large-scale traffic in high-concurrency network environments, we developed a custom zero-cost hot-loop SPA load generator in Rust. This tool bypassed the traditional 65,535-port limit by utilizing a 2D IP-Port authorization matrix (e.g., 20 IPs × 50,000 ports) capable of generating 1,000,000 unique firewall rules. A Python-based orchestrator was used to generate multimodal “Chaos Storm” attacks; its execution logic and correctness assertions are detailed in Algorithm A1 in Appendix A.
Baselines: We compared three configurations: (1) fwknopd 2.6.11 [38], a legacy SPA daemon selected as the representative traditional baseline, running its stable release (v2.6.11); (2) SanctumSPA-Native, the proposed architecture running directly on the host OS; and (3) SanctumSPA-TEE, the proposed architecture secured within the SGX enclave.
Statistical Methodology: To enhance the robustness of our results against transient cloud network jitter and asynchronous execution anomalies, we adopted a percentile-based statistical framework for data aggregation. Because network performance metrics often exhibit long-tailed distributions, relying on arithmetic means and standard deviations can be misleading. Therefore, unless otherwise specified (such as for the legacy baseline, which was evaluated over 3 runs due to stability constraints under high concurrency), macrolevel throughput and microarchitectural latency are reported as medians (50th percentile). Experimental variability across five independent runs per load level is represented by the interquartile range (IQR, 25th–75th percentiles), shown as shaded error bands in the figures. For latency microbenchmarks, each trial comprises 200 warmup rounds followed by 1000 steady-state evaluation rounds. The three configurations also provide an ablation framework for separating the architectural gains of eBPF processing from the microarchitectural overhead of SGX enclave execution.

7.2. RQ1: Macro-Level Performance Optimization Under Large-Scale Traffic

The practical scalability of SanctumSPA is determined by its capability to provide high-throughput and low-latency pre-authentication while maintaining strict state consistency.
First, we measured the goodput of the three schemes to assess scalability (Figure 3a). Both SanctumSPA variants scaled nearly linearly, closely tracking the ideal baseline for hundreds of thousands of pps. In contrast, the legacy fwknopd baseline exhibited severe performance degradation early in the experiment, reaching its operational ceiling at approximately 500 pps before becoming unresponsive. The loss of responsiveness at this threshold was attributed to fwknopd’s synchronous architecture, in which each incoming packet triggered an expensive user-space context switch and a blocking fork/exec system call to update iptables rules.
Figure 3. Macro-level performance optimization and scalability analysis under increasing target loads. (a) Goodput comparison demonstrating SanctumSPA’s scalable processing capability for large-scale data streams; fwknopd was evaluated only up to 500 pps owing to severe performance degradation. (b) Cumulative distribution function (CDF) of end-to-end network latency, highlighting latency minimization. (c) State inconsistency and resource exhaustion in the legacy baseline, which SanctumSPA avoids under the evaluated conditions through stateless cryptographic modeling.
Figure 3b presents the cumulative distribution function (CDF) of the network latency recorded for 1000 individual requests under a light load. SanctumSPA consistently maintained submillisecond latency for the vast majority of requests. Conversely, fwknopd exhibited significantly higher and more variable latency, with the tail extending well beyond 100 ms.
Finally, we investigated state consistency under stress conditions (Figure 3c). As the target load increased from 5 to 500 pps, fwknopd experienced a rapid surge in CPU utilization and firewall rule creation failures. Most importantly, the “zombie rule rate” increased to 100%. This indicates a serious state-consistency failure: the legacy system authenticated packets but failed to remove the corresponding firewall rules after timeout, leaving the gateway exposed until the rules were removed. By design, SanctumSPA avoids these observed state-consistency failures through its stateless cryptographic verification and deterministic eBPF map garbage collection (further evaluated in Section 7.4), supporting an affirmative answer to RQ1.

7.3. RQ2: Micro-Architectural Resource Optimization and Graceful Degradation

Although the integration of Intel SGX provides crucial cryptographic guarantees, it introduces computational overhead. To answer RQ2, we evaluated the micro-architectural “capacity tax” imposed by the TEE and analyzed the system’s backpressure mechanisms at its physical limits.
First, we quantified the baseline microarchitectural overhead. Figure 4a shows the component-wise execution-time breakdown. The TEE Brain requires 36.5 μs per request, nearly double the 18.6 μs required by the Native Brain. This discrepancy is primarily driven by the “Framework & Context” overhead, reflecting the inherent cost of SGX context switching and memory encryption. As the target load increased, the per-packet overhead accumulated, producing a macro-level capacity tax. Figure 4b illustrates this tax; the TEE system reached saturation and began dropping packets at a lower throughput threshold than its native counterpart.
Figure 4. Micro-architectural latency modeling and bottleneck analysis. (a) Component-wise execution time breakdown for a single request, comparing the Native and TEE Brains. (b) TEE capacity tax, quantified as the drop in delivery ratio, and end-to-end 99th-percentile latency as the target load scales. (c) Estimated stacked latency breakdown, highlighting the queuing dynamics and optimization limits of the asynchronous Tokio agent under heavy stress. Shaded blue and green bands in (b) represent the interquartile range (IQR, 25th–75th percentiles) across five independent evaluation runs, illustrating experimental variability.
To understand the mechanics of this degradation, we analyzed the latency composition (Figure 4c). The cryptographic processing times remained stable even at extreme loads. Instead, the increase in total 99th-percentile latency was dominated by Tokio queuing delays. This pattern indicates a mismatch under stress between the network I/O ingestion rate and the processing capacity of the CPU-bound TEE worker thread.
In high-throughput environments, a robust security gateway must degrade gracefully via controlled backpressure rather than collapse unpredictably when resources are saturated. As shown in Figure 5b, Core 1 (dedicated to the TEE Brain) consistently operated at 100% CPU utilization because of its continuous polling architecture. The critical “inflection interval” identifies the point at which Core 0 (the Gateway) experienced a sharp increase in CPU utilization, climbing towards 100%. This surge occurred because, once the user-space Tokio queues were saturated, the gateway propagated active backpressure to the kernel layer, triggering the eBPF RingBuf to drop packets (Figure 5a). By shedding excess load early at the ingress layer, the system prevented control-plane overload and avoided process failure.
Figure 5. Resource scheduling optimization and graceful degradation under extreme stress. (a) Demonstration of the eBPF RingBuf mechanism triggering active packet dropping (backpressure) to optimize resource allocation at the ingress layer; (b) critical inflection interval showing the relationship between CPU utilization and asynchronous queuing behavior. The vertical shaded orange region in (b) marks the critical inflection interval (maximum slope of queuing delay growth) where active ingress backpressure is triggered; shaded ribbons along curve traces indicate the interquartile range (IQR, 25th–75th percentiles) across five independent evaluation runs.

7.4. RQ3: System Resilience Modeling Against Massive Data Injection

To answer RQ3, we evaluated the system’s resilience against our core threat model. SanctumSPA mitigates resource exhaustion threats through deterministic state bounding and an aggressive “early rejection” strategy.
First, we analyzed the system’s memory management under varying stress levels. As depicted in Figure 6a, the memory consumption of both the Gateway and the Brain remained strictly stable regardless of the escalating load. The stable memory footprint of the TEE Brain suggested the absence of EPC memory bloat. This stability was supported by deterministic state management (Figure 6b): the GC mechanism actively purged expired elements, while the LRU map was bounded to a predefined capacity of 262,144 elements.
Figure 6. Memory optimization and deterministic state modeling of SanctumSPA. (a) Stable memory consumption across varying target loads, demonstrating resilience against memory bloat, with the limitation that the host OS cannot directly profile the SGX EPC memory footprint; (b) The relationship between processed requests and GC purges, bounded by the predefined LRU capacity of 262,144 elements.
Furthermore, we subjected the system to a multimodal “Chaos Storm” test, executing the comprehensive correctness auditing protocol detailed in Algorithm A1 (Appendix A). As dictated by this rigorous audit protocol, we injected 3,310,503 packets comprising 1,000,000 malformed short packets, 2,000,000-packet volumetric flood, 100,000 replay attempts, 100,000 expired payloads, 10,000 cryptographic fuzzing (HMAC poisoning) probes, 100,000 baseline unauthorized/expired probes, and 500 burst penetration packets, along with three standalone benchmark packets (one golden SPA seed and two functional data-plane probes). Figure 7a visualizes the survivability of packets across the defensive authorization pipeline. Out of 3.31 million injected packets, the multi-tier defense handled the offered load through a combination of overload shedding and security rejection, allowing exactly two legitimate SPA requests (the initial golden seed and one surviving request from the 500-packet burst) to successfully traverse the full authentication path to reach and update the gateway’s active authorization state. In lockstep, the two functional data-plane probes confirmed end-to-end connectivity across these two newly authorized sessions via XDP_PASS (asserted in Algorithm A1), verifying immediate rule activation without zombie-rule latency.
Figure 7. Packet processing dynamics and drop decoupling under the 3.31M-packet Chaos Storm. (a) Survival funnel of offered packets across architectural layers. (b) Decoupling of packet drops into capacity overload shedding (92.2%) and security rejection/enforcement (7.7%). Percentages reflect single-decimal rounded values; exact sum equals 100.00% across all 3,310,501 dropped packets.
Figure 7b elucidates the distribution of these dropped packets, explicitly separating capacity shedding from security filtering: Layer 0 (Hardware/NIC Overflow) dropped 4.3% (143,345 packets) and Layer 1 (XDP/RingBuf) shed 87.9% (2,910,335 packets) via wire-speed backpressure to limit the offered load reaching the enclave. Layer 2 (eBPF state) filtered 100,000 unauthorized or expired probes (3.0%), and Layer 3 (SGX Enclave) processed the remaining 156,821 attack packets (4.7%) through cryptographic and anti-replay rejection without EPC exhaustion. Both legitimate SPA probes successfully traversed the entire pipeline (Figure 7a).
Under peak saturation, Figure 8a demonstrates that gateway internal latency remained bounded in the observed experiment: unqueued requests exhibit sub-millisecond execution (0.97 ms vs. 0.26 ms baseline, Figure 8b), while heavy queuing elevates median latency to 5.61 s. Tokio asynchronous dispatch accounts for 86.3% of the P99 tail delay (6.47 s out of 7.50 s), and RingBuffer backpressure limited the maximum observed delay to 7.56 s without process failure. Under an idealized independent-arrival assumption, legitimate client sessions yield an analytically estimated >99.999% establishment probability via burst probing (k = 500; Appendix A.2), illustrating how burst redundancy provides a viable recovery mechanism against line-rate backpressure drops.
Figure 8. Gateway internal latency and queuing bounds under storm saturation. (a) Empirical CDF of internal E2E latency (Ttotal) and queuing delay (Tqueue) across 206,180 requests, showing the maximum observed delay of 7.56 s. (b) Quantile-wise latency comparison between the quiescent baseline and peak storm regime.

8. Discussion and Limitations

Although SanctumSPA combines eBPF and Intel SGX to improve gateway security and scalability, the current architecture and cloud-based evaluation have several limitations that motivate future work.

8.1. Protocol Limitations and Network Heterogeneity

We retained compatibility with the widely used fwknopd SPA protocol [38] as a representative baseline. This protocol presents two main limitations. First, static listening ports remain susceptible to scanning; future work could integrate MTD into the eBPF data plane as discussed in Section 2.1. Second, fwknopd relies on legacy symmetric cryptography. SanctumSPA’s decoupled architecture supports cryptographic agility, allowing post-quantum algorithms to execute inside the enclave without modifying the high-speed data plane.
Binding temporary authorization strictly to client IP addresses also introduces operational challenges in complex networks. In network address translation (NAT) and shared-IP environments, IP-based authorization can cause “authorization amplification” [39], potentially granting collateral access to co-located hosts. Terminating a user-space WireGuard tunnel inside the enclave could mitigate this limitation by authenticating session keys rather than mutable IP addresses. Furthermore, supporting IPv6 expands key dimensions—128-bit addresses increase the memory footprint of ℳauth and ℳconn fourfold—and requires parsing chained extension headers within eBPF verifier limits.
Dynamic clients and spoofed traffic introduce further trade-offs. While TCP sequence randomization mitigates blind spoofed-source connection hijacking, stateless UDP knock packets require enclave-verified signatures. For mobile clients undergoing dynamic IP handover, caching short-lived session tickets inside the enclave can minimize re-authentication latency. Finally, server-side enclave isolation cannot prevent authorization abuse if endpoint credentials are compromised; client-side hardware roots of trust (such as TPM 2.0) [40] are needed to anchor private keys for robust end-to-end trust.

8.2. Experimental Constraints and Performance Ceilings

The cloud testbed introduced two principal constraints. First, cloud NIC limitations required the eBPF data plane to operate in Generic XDP (SKB) mode. Although SanctumSPA still achieved orders-of-magnitude improvements over the baseline (RQ1), these results do not represent the performance ceiling of native or hardware-offloaded XDP. Second, the SGX server was limited to two virtual CPUs. As observed in RQ2, with sufficient EPC capacity, CPU processing became the primary bottleneck, limiting our evaluation of Tokio’s multicore scheduling under extreme concurrency. Future evaluations should use bare-metal systems to explore the architecture’s performance limits.

8.3. State Forgery vs. Cryptographic Confidentiality

Under the threat model in Section 4, a root-privileged adversary cannot directly extract cryptographic keys from enclave memory. However, because eBPF maps reside in host-kernel memory, a compromised host operating system can modify them through system calls and inject forged authorization rules. SanctumSPA therefore reduces the risk of a system-wide cryptographic compromise but does not prevent localized state tampering. Migrating the eBPF data plane to SmartNICs, such as NVIDIA BlueField, could provide hardware-enforced I/O isolation and mitigate this residual vulnerability.

8.4. Side-Channel Threats and Cryptographic Resilience

SGX remains susceptible to microarchitectural side-channel attacks [41]. SanctumSPA uses RustCrypto implementations designed for constant-time operation [36,42], reducing timing leakage. However, this protection does not eliminate all side-channel risks. Advanced transient-execution attacks and other SGX-specific vulnerabilities remain outside the current evaluation and require further study.

8.5. Hardware Trust Evolution and Confidential Computing Paradigms

SanctumSPA currently relies on Intel SGX for process-level isolation. However, SGX deprecation on client platforms and the operational overhead of LibOS runtimes motivate the exploration of alternative confidential computing paradigms. Emerging Confidential Virtual Machine (CVM) architectures—such as Intel TDX [43] and AMD SEV-SNP [44]—provide full-VM hardware encryption. Migrating SanctumSPA to a CVM would encapsulate both the eBPF data plane and Tokio control runtime within a unified hardware-isolated domain, potentially mitigating host-kernel map tampering without LibOS translation overhead. Although CVMs simplify deployment, their microarchitectural side-channel resistance requires dedicated evaluation.

9. Conclusions

We proposed SanctumSPA, a gateway architecture that addresses the performance and security limitations of traditional SPA mechanisms in high-throughput network perimeters. SanctumSPA decouples the data and control planes by combining kernel-level eBPF packet processing with cryptographic verification inside an Intel SGX TEE. Its implementation in Safe Rust further mitigates memory-safety risks in the user-space and enclave components.
Cloud-based experiments showed that SanctumSPA processed hundreds of thousands of requests per second with sub-millisecond latency before queue saturation, representing orders-of-magnitude higher throughput than the legacy baseline. The architecture also avoided the observed state-consistency failures associated with zombie firewall rules. During the “Chaos Storm” evaluation involving more than 3.3 million injected packets, the multi-tier defense shed 92.2% of the offered load through capacity-driven backpressure and 7.7% through eBPF-state and SGX security checks, without process failure.
These findings indicate that combining kernel-level packet processing, memory-safe implementation, and confidential computing can provide a scalable and resilient pre-authentication gateway for high-throughput zero-trust network perimeters. However, the results are limited to the evaluated cloud environment and threat-model assumptions; further work should examine hardware-offloaded XDP, SmartNIC-based isolation against kernel state tampering, client-side hardware roots of trust, and emerging confidential virtual machine platforms.

Author Contributions

Conceptualization, B.P. and Y.W.; methodology, B.P.; software, B.P.; validation, Y.W.; formal analysis, J.Z.; investigation, B.P.; resources, Y.W.; data curation, B.P.; writing—original draft preparation, B.P.; writing—review and editing, J.Z.; visualization, B.P.; supervision, Y.W.; project administration, Y.W.; funding acquisition, J.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Natural Science Foundation of China (No. 62501368), Fundamental Research Program of Shanxi Province (No. 202503021212090), Central Leading Local Science and Technology Development Fund (No. YDZJSX2025B001).

Data Availability Statement

The raw data supporting the conclusions of this study will be made available by the authors upon reasonable request.

Acknowledgments

During the preparation of this manuscript, the authors used Gemini-3.1-pro to assist with the development of the Rust prototype and the initial translation of the draft. The authors reviewed and edited all AI-assisted content and take full responsibility for the content of the manuscript. The manuscript subsequently underwent comprehensive human language editing and polishing by Editage. A Certificate of Language Editing has been submitted with the manuscript.

Conflicts of Interest

The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Abbreviations

The following abbreviations are used in this manuscript:
1-RTTOne Round-Trip Time
AESAdvanced Encryption Standard
AHACAdvanced Network-Hiding Access Control
CDFCumulative Distribution Function
CPUCentral Processing Unit
CVMConfidential Virtual Machine
DCAPData Center Attestation Primitive
DoSDenial of Service
eBPFExtended Berkeley Packet Filter
ECCElliptic Curve Cryptography
EPCEnclave Page Cache
ESPEncapsulating Security Payload
EUF-CMAExistential Unforgeability under Chosen Message Attack
FFIForeign Function Interface
GCGarbage Collection
HMACHash-based Message Authentication Code
IND-CPAIndistinguishability under Chosen Plaintext Attack
IoTInternet of Things
I/OInput/Output
IPInternet Protocol
IPCInterprocess Communication
IPsecInternet Protocol Security
IQRInterquartile Range
LibOSLibrary Operating System
LRULeast Recently Used
MACMessage Authentication Code
MTDMoving Target Defense
NATNetwork Address Translation
NICNetwork Interface Card
OSOperating System
PAPCPre-Authentication and Post-Connection
PDPPolicy Decision Point
PEPPolicy Enforcement Point
POSIXPortable Operating System Interface
ppsPackets Per Second
RAMRandom-access Memory
REERich Execution Environment
RoTRoot of Trust
RPCRemote Procedure Call
RQResearch Question
SDPSoftware-Defined Perimeter
SEV-SNPSecure Encrypted Virtualization-Secure Nested Paging
SFISoftware Fault Isolation
SGXSoftware Guard Extension
SIPSFI-Isolated Process
SKBSocket Buffer
SmartNICSmart Network Interface Card
SPASingle Packet Authorization
SYNSynchronize
TCTraffic Control
TCPTransmission Control Protocol
TDXTrust Domain Extensions
TEETrusted Execution Environment
TLSTransport Layer Security
TPMTrusted Platform Module
UDVSUniversal Designated Verifier Signature
XDPeXpress Data Path
ZTNAZero Trust Network Access

Appendix A

Appendix A.1. Supplementary Experimental Details

To evaluate the correctness and resilience of the SanctumSPA architecture under extreme conditions, we designed a comprehensive audit protocol. Algorithm A1 details the execution flow, concurrent injection modes, and state-reconciliation assertions used in the “Chaos Storm” test. The protocol systematically stresses each defense layer and compares the observed results with the expected baseline metrics.
Algorithm A1: Multi-Modal Chaos Storm and Correctness Auditing
Input: Target Gateway G, SGX Enclave E, Cryptographic Keys KAES, KHMAC
Output: Boolean indicating whether all security assertions passed
▷ Phase 0: Preparation & State Generation
1:  Pexpire ← GenerateValidSPA(KAES, KHMAC)
2: Sleep(125 s) ▷ Force packet to physically expire (>120 s)
3: InitializeEnvironment(G, E)
▷ Phase 1: Baseline eBPF Map Verification
4: SendProbes(GIP, count = 50,000) ▷ Inject unauthorized probes
5:  Pfresh ← GenerateValidSPA(KAES, KHMAC)
6: SendSPA(GIP, Pfresh) ▷ Inject Golden Seed
7: SendProbes(GIP, count = 1) ▷ Verify Golden Seed (Should pass)
8: Sleep(15.2 s) ▷ Wait for eBPF authorization to expire
9: SendProbes(GIP, count = 50,000) ▷ Inject expired probes
▷ Phase 2: The Chaos Storm (Concurrent Injection)
10: Parallel Execution Begin
 ▷ Modality 1: Malformed XDP Blind Attack
11:   Thread1: SendUDP(GIP, payload = “X” × 10, count = 106)
 ▷ Modality 2: Cryptographic Fuzzing (Poison HMAC)
12:   Thread2: SendSPA(GIP, wrong_key, count = 104)
 ▷ Modality 3: SGX Timestamp Expiration Attack
13:   Thread3: ReplayPacket(GIP, Pexpire, count = 105)
 ▷ Modality 4: Replay Storm (State Lock Exhaustion)
14:   Thread4: ReplayPacket(GIP, Pfresh, count = 105)
 ▷ Modality 5: RingBuf Capacity Flood
15:   Thread5: SendSPA(GIP, valid_keys, count = 2 × 106)
 ▷ Burst Penetration Test (Availability under DoS)
16:   Thread6:
17:     Sleep(3 s)
18:     SendSPA(GIP, valid_keys, count = 500) ▷ Force renewal in deep congestion
19:     Sleep(3 s) ▷ Wait for kernel/TEE to process the renewal
20:     SendProbes(GIP, count = 1) ▷ Penetration probe (Should pass)
21: Parallel Execution End
22: Sleep(5 s) ▷ Wait for TEE and kernel queues to drain
▷ Phase 3: State Reconciliation & Assertions
23:  ℳ ← FetchTelemetry(G, E)
24: Assert(ℳ.XDP_Pass = 2) ▷ Golden probe + Penetration probe
25: Assert(ℳ.XDP_Drop_Unauth = 50,000)
26: Assert(ℳ.XDP_Drop_Expire = 50,000)
▷ Due to RingBuf backpressure, SGX receives a subset of injected packets
27: Assert(ℳ.RingBuf_Drop > 0) ▷ Backpressure successfully triggered
28: Assert(0 < ℳ.SGX_HMAC_Fail ≤10,000)
29: Assert(0 < ℳ.SGX_Replay_Fail ≤100,000)
30: Assert(0 < ℳ.SGX_Expire_Fail ≤100,000)
31: return True if all assertions hold, else False

Appendix A.2. Probabilistic Analysis of Legitimate Probe Survivability Under Saturation

Under extreme saturation conditions where volumetric flooding triggers line-rate backpressure shedding, individual legitimate SPA packets face non-negligible drop rates. To estimate legitimate probe survivability under saturation, as requested by protocol auditing (Thread 6 in Algorithm A1), we model probe survival as a Bernoulli trial.
Let Psingle denote the probability that an individual packet traverses Layer 0 (NIC ring buffers) and Layer 1 (eBPF RingBuffer) to reach the SGX enclave during peak flood. Across the 3,310,503 injected packets, 156,823 reached the enclave (Figure 7), yielding an empirical ingress survival rate of:
P single = N enclave N injected = 156,823 3,310,503 ≈ 4.74 % .
For an authorized client transmitting a burst of k redundant SPA probes, the cumulative probability of achieving at least one successful enclave verification—thereby establishing the session and updating ℳauth—is given by:
Psession(k) = 1 − (1 − Psingle)k.
For a burst parameter of k = 500:
Psession(500) = 1 − (1 − 0.0474)500 ≈ 1 − 2.85 × 10−11 > 99.999%.
This formulation provides a baseline analytical estimate under the simplifying assumption of independent Bernoulli trials, though correlated losses may occur during shared buffer saturation. Empirically, approximately 500 × Psingle ≈ 24 burst probes reached the enclave. The first arriving probe successfully verified credentials and established the firewall state (Figure 7a); subsequent redundant copies within the same burst window were deterministically discarded by the enclave’s SlidingReplayCache (Algorithm 3, line 26), ensuring state consistency without memory exhaustion.

References

  1. Buck, C.; Olenberger, C.; Schweizer, A.; Völter, F.; Eymann, T. Never trust, always verify: A multivocal literature review on current knowledge and research gaps of zero-trust. Comput. Secur. 2021, 110, 102436. [Google Scholar] [CrossRef] [Scilit]
  2. Rose, S.; Borchert, O.; Mitchell, S.; Connelly, S. Zero Trust Architecture; NIST SP 800-207; National Institute of Standards and Technology: Gaithersburg, MD, USA, 2020. [Google Scholar] [CrossRef] [Scilit]
  3. Ren, Y.; Wang, Z.; Sharma, P.K.; Alqahtani, F.; Tolba, A.; Wang, J. Zero trust networks: Evolution and application from concept to practice. Comput. Mater. Contin. 2025, 82, 1593–1613. [Google Scholar] [CrossRef] [Scilit]
  4. Syed, N.F.; Shah, S.W.; Shaghaghi, A.; Anwar, A.; Baig, Z.; Doss, R. Zero trust architecture (ZTA): A comprehensive survey. IEEE Access 2022, 10, 57143–57179. [Google Scholar] [CrossRef] [Scilit]
  5. Itodo, C.; Ozer, M. Multivocal literature review on zero-trust security implementation. Comput. Secur. 2024, 141, 103827. [Google Scholar] [CrossRef] [Scilit]
  6. Altaibek, M.; Issainova, A.; Aidynov, T.; Kuttymbek, D.; Abisheva, G.; Nurusheva, A. A survey of cross-layer security for resource-constrained IoT devices. Appl. Sci. 2025, 15, 9691. [Google Scholar] [CrossRef] [Scilit]
  7. Jiang, K.; Xiao, Y.; Yuan, S.; Si, X. Implementing continuous authentication in network connection based on improved SPA. In Proceedings of the IEEE 22nd International Conference on Communication Technology (ICCT), Nanjing, China, 11–14 November 2022; pp. 1318–1322. [Google Scholar] [CrossRef] [Scilit]
  8. Yu, S.; Won, Y. Port-based pre-authentication message transmission scheme. Comput. Model. Eng. Sci. 2025, 143, 3943–3980. [Google Scholar] [CrossRef] [Scilit]
  9. Liu, J.; Wen, W.; Wang, F.; Yan, M. A zero-trust security access model based on port hopping. In Proceedings of the 3rd IEEE International Conference on Big Data and Data Mining (BDDM), Hengyang, China, 12–14 December 2025; pp. 1–7. [Google Scholar] [CrossRef] [Scilit]
  10. Guerrieri, P.L.; Bouakkaz, F.; Ahmed, T. Moving-target single packet authorization to protect network service from sniffing. In Proceedings of the 11th International Conference on Network Softwarization (NetSoft), Budapest, Hungary, 23–27 June 2025; pp. 1–5. [Google Scholar] [CrossRef] [Scilit]
  11. Yu, S.; Won, Y. Enhanced single packet authorization system via dynamic input port allocation using one-time passwords. In Advances in Computer Science and Ubiquitous Computing; Park, J.S., Yang, L.T., Pan, Y., Park, J.J., Eds.; Springer Nature: Singapore, 2024; pp. 318–324. [Google Scholar] [CrossRef] [Scilit]
  12. Xu, M.; Chen, B.; Tan, Z.; Chen, S.; Wang, L.; Liu, Y.; San, T.I.; Fong, S.W.; Wang, W.; Feng, J. AHAC: Advanced network-hiding access control framework. Appl. Sci. 2024, 14, 5593. [Google Scholar] [CrossRef] [Scilit]
  13. Guerrieri, P.L.; Bouakkaz, F.; Ahmed, T. CRYPTNA: A purely cryptographic zero trust network access with 1-RTT packet authorization. In Proceedings of the 9th Cyber Security in Networking Conference (CSNet), Abu Dhabi, United Arab Emirates, 20–22 October 2025; pp. 1–8. [Google Scholar] [CrossRef] [Scilit]
  14. Tang, F.; Ma, C.; Cheng, K. Privacy-preserving authentication scheme based on zero trust architecture. Digit. Commun. Netw. 2024, 10, 1211–1220. [Google Scholar] [CrossRef] [Scilit]
  15. Wang, X.; Lin, C.; Wu, W.; Yang, X.; Zhang, Y. Bilinear-pairing-free universal designated verifier signatures for private access in zero trust network. IEEE Internet Things J. 2025, 12, 37734–37746. [Google Scholar] [CrossRef] [Scilit]
  16. Zhao, J.; Zhao, G.; Liu, A. Zero-trust single-package authorization authentication scheme supporting privacy protection and traceability. In Proceedings of the IEEE International Conference on Computer and Communications (ICCC), Chengdu, China, 13–16 December 2024; pp. 520–526. [Google Scholar] [CrossRef] [Scilit]
  17. Zhang, L.; Li, H.; Ge, J.; Wu, Y.; Li, L.; Wu, B.; Deng, H. EDP: An eBPF-based dynamic perimeter for SDP in data center. In Proceedings of the 23rd Asia-Pacific Network Operations and Management Symposium (APNOMS), Takamatsu, Japan, 28–30 September 2022; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
  18. Paya, A.; Vicente-García, V.; Gómez, A. Securesdp: A novel software-defined perimeter implementation for enhanced network security and scalability. Int. J. Inf. Secur. 2024, 23, 2793–2808. [Google Scholar] [CrossRef] [Scilit]
  19. Xu, M.; Guo, J.; Yuan, H.; Yang, X. Zero-trust security authentication based on SPA and endogenous security architecture. Electronics 2023, 12, 782. [Google Scholar] [CrossRef] [Scilit]
  20. Liu, C.; Zhu, Y. A ZTNA-based architecture for secure and trusted access in campus networks. In Proceedings of the International Conference on Communication Networks and Machine Learning (CNML), Chongqing, China, 30 January–1 February 2026; pp. 323–327. [Google Scholar] [CrossRef] [Scilit]
  21. Han, C.; Kim, T.; Lee, W.; Shin, Y. S-ZAC: Hardening access control of service mesh using Intel SGX for zero trust in cloud. Electronics 2024, 13, 3213. [Google Scholar] [CrossRef] [Scilit]
  22. Cheng, R. A zero-trust based security protection scheme for industrial IoT. In Proceedings of the International Conference on Frontier Technologies of Information and Computer (ICFTIC), Qingdao, China, 5–7 December 2025; pp. 986–989. [Google Scholar] [CrossRef] [Scilit]
  23. Hari, N.; Jain, K.; Prabu, P.; Krishnan, P. Hardware-anchored ES-SPA: A dynamic zero-trust architecture for secure eSIM provisioning in 6G IoT via moving target defense. Future Internet 2026, 18, 187. [Google Scholar] [CrossRef] [Scilit]
  24. Jung, B.G.; Yoo, Y.S.; Yim, J.; Hong, K.; Lee, J.; Park, H. Zero trust black network access for mobile broadband mission-critical services. In Proceedings of the 14th International Conference on Information and Communication Technology Convergence (ICTC), Jeju Island, Republic of Korea, 11–13 October 2023; pp. 1416–1418. [Google Scholar] [CrossRef] [Scilit]
  25. Zhou, X. Design and research on the secure interconnection access standard of port inspection and testing equipment based on zero trust strategy. In Proceedings of the 6th International Conference on Electronic Communication and Artificial Intelligence (ICECAI), Chengdu, China, 20–22 June 2025; pp. 652–656. [Google Scholar] [CrossRef] [Scilit]
  26. Ruambo, F.A.; Masanga, E.E.; Lufyagila, B.; Ateya, A.A.; Abd El-Latif, A.A.; Almousa, M.; Abd-El-Atty, B. Brute-force attack mitigation on remote access services via software-defined perimeter. Sci. Rep. 2025, 15, 18599. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  27. Deshmukh, T.S.; Franklin, A.A. Building a security canopy over O-RAN: The SDP paradigm. In Proceedings of the 27th International Conference on Modeling Analysis and Simulation of Wireless and Mobile Systems (MSWiM), Barcelona, Spain, 27–31 October 2025; pp. 369–374. [Google Scholar] [CrossRef] [Scilit]
  28. Sharaf, H.; Ahmad, I.; Dimitriou, T. Extended Berkeley Packet Filter: An application perspective. IEEE Access 2022, 10, 126370–126393. [Google Scholar] [CrossRef] [Scilit]
  29. Soldani, D.; Nahi, P.; Bour, H.; Jafarizadeh, S.; Soliman, M.F.; Giovanna, L.D.; Monaco, F.; Ognibene, G.; Risso, F. eBPF: A new approach to cloud-native observability, networking and security for current (5G) and future mobile networks (6G and beyond). IEEE Access 2023, 11, 57174–57202. [Google Scholar] [CrossRef] [Scilit]
  30. Will, N.C.; Maziero, C.A. Intel software guard extensions applications: A survey. ACM Comput. Surv. 2023, 55, 322. [Google Scholar] [CrossRef] [Scilit]
  31. Tsai, C.C.; Porter, D.E.; Vij, M. Graphene-SGX: A practical library OS for unmodified applications on SGX. In Proceedings of the USENIX Annual Technical Conference (USENIX ATC), Santa Clara, CA, USA, 12–14 July 2017; pp. 645–658. [Google Scholar]
  32. Shen, Y.; Tian, H.; Chen, Y.; Chen, K.; Wang, R.; Xu, Y.; Xia, Y.; Yan, S. Occlum: Secure and efficient multitasking inside a single enclave of Intel SGX. In Proceedings of the Twenty-Fifth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), Lausanne, Switzerland, 16–20 March 2020; pp. 955–970. [Google Scholar] [CrossRef] [Scilit]
  33. Jung, R.; Jourdan, J.-H.; Krebbers, R.; Dreyer, D. Safe systems programming in Rust. Commun. ACM 2021, 64, 144–152. [Google Scholar] [CrossRef] [Scilit]
  34. aya-rs Repository. Available online: https://github.com/aya-rs/aya (accessed on 21 July 2026).
  35. tokio-rs: A Runtime for Writing Reliable, Asynchronous, and Slim Applications with the Rust Programming Language. Available online: https://github.com/tokio-rs/tokio (accessed on 21 July 2026).
  36. RustCrypto: Cryptographic Algorithms Written in Pure Rust. Available online: https://github.com/RustCrypto (accessed on 21 July 2026).
  37. Occlum Releases v0.31.0. Available online: https://github.com/occlum/occlum/releases/tag/v0.31.0 (accessed on 21 July 2026).
  38. Software Release: Fwknop-2.6.11. Available online: https://www.cipherdyne.com/ (accessed on 21 July 2026).
  39. Dong, L.; Niu, Z.; Zhu, Y.; Zhang, W. Specifying and verifying SDP protocol based zero trust architecture using TLA+. In Proceedings of the 7th International Conference on Cyber Security and Information Engineering (ICCSIE), Brisbane, QLD, Australia, 23–25 September 2022; pp. 35–43. [Google Scholar] [CrossRef] [Scilit]
  40. Trusted Computing Group. TPM 2.0 Library. Available online: https://trustedcomputinggroup.org/resource/tpm-library-specification/# (accessed on 21 July 2026).
  41. Fei, S.; Yan, Z.; Ding, W.; Xie, H. Security vulnerabilities of SGX and countermeasures: A survey. ACM Comput. Surv. 2021, 54, 126. [Google Scholar] [CrossRef] [Scilit]
  42. Kolosick, M.; Shivakumar, B.A.; Cauligi, S.; Patrignani, M.; Vassena, M.; Jhala, R.; Stefan, D. Robust constant-time cryptography. Proc. ACM Program. Lang. 2025, 9, 1491–1515. [Google Scholar] [CrossRef] [Scilit]
  43. Intel Corporation. Intel Trust Domain Extensions. Available online: https://www.intel.com/content/www/us/en/developer/tools/trust-domain-extensions/overview.html (accessed on 21 July 2026).
  44. AMD. Secure Encrypted Virtualization (SEV). Available online: https://www.amd.com/en/developer/sev.html (accessed on 21 July 2026).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.