← Book home
Part 8 · Practical Labs and Training Material
33

Practical 5G Security Lab Design

Build it, break it, watch it — security you can touch

"You can read about 5G-AKA a hundred times. The first time you watch RES* travel across your own packet capture, you finally understand it." — WHY LABS MATTER

Every chapter of this book ended with a mini lab pointing here. This chapter ties them together into a coherent, safe, reproducible lab environment built on free, open tools — Open5GS, UERANSIM, and Wireshark — so you can observe 5G security mechanisms with your own eyes, reproduce the misconfigurations, and practice the detections. It's the hands-on companion to the whole book.

🎯 Learning objectives
⚠️ Safety & legal boundary
Run all labs on an isolated test network with your own SIMs/UEs. Transmitting on licensed spectrum, or interfering with real networks or subscribers, is illegal in most jurisdictions. Use a shielded/conducted setup or software-only emulation. Never test against a production or third-party network without explicit written authorization.

33.1 The Reference Lab

FIGURE 33.1Reference Lab Topology — Open5GS + UERANSIM + Tools
UERANSIMsimulated gNB + UEconfigurable SUCI, K,algorithms Open5GS 5GCAMF·AUSF·UDM·SMF·UPF·NRF·NEFreal 5G core proceduressubscriber DB, configs Wiresharkcapture NAS, SBI, NGAP private CA + toolsTLS/cert labs N2/N3 tap all software, all isolated — no radio, no spectrum, no legal risk; reproduces the security procedures of the whole book
Purpose: the whole lab on one page. UERANSIM emulates the radio side, Open5GS runs a real 5G core, Wireshark watches — entirely in software, entirely safe.
FIGURE 33.2Lab Segmentation and Safety Boundaries
isolated lab network (host-only / VLAN)UERANSIM + Open5GS + captureno bridge to production or live radio production / internetDO NOT BRIDGEseparate management only keep the lab air-gapped from anything real — emulation is safe only while it stays isolated
Purpose: the one safety rule that matters. Keep the lab isolated — emulation is legal and safe precisely because it never touches real spectrum or networks.
FIGURE 33.3Lab 1 — Observing 5G-AKA in Wireshark
register UEcapture NAS find Auth RequestRAND, AUTN, ngKSI find Auth ResponseRES* correlate AUSF logRES*==XRES* (Ch6) → the full Chapter-6 flow, in your own packets. Then corrupt K → MAC failure; stale SQN → sync failure.
Purpose: Chapter 6 made tangible. Watch the real Authentication Request/Response, then induce both failure modes (MAC, sync) and confirm their signatures.
FIGURE 33.4Reading NAS Security Mode Command in a Capture
expand the Security Mode Command IE read selected NEA/NIA · ngKSI · replayed UE security capabilities (Ch 8) — confirm non-null and that caps match what the UE sent this single capture is the Chapter-25 quick-scan items #1 and the bidding-down check, live
Purpose: Chapter 8 in a packet. The SMC capture shows the selected algorithms and the replayed-capabilities bidding-down defense — and reveals null-crypto misconfigs instantly.
FIGURE 33.5Lab 2 — SUCI On/Off Comparison
scheme A/B (SUCI)capture shows ephemeral key,ciphertext — identity concealedre-register → different SUCI null schemecapture shows the IMSI-equivalentin the clear (Ch 4)the picture to show any manager
Purpose: Chapter 4 proven in two captures. Scheme A/B hides identity (and changes each time); null scheme exposes it — the most persuasive demonstration of why SUCI configuration matters.
FIGURE 33.6Lab 3 — SBA API and Token Inspection
capture inter-NF HTTP/2 (SBI) read the Authorization: Bearer token (JWT) → decode scope & audience claims (Ch 10); find an NF discovery + registration at the NRF see the three SBA pillars — mTLS, OAuth, NRF — as real traffic
Purpose: Chapter 10 made concrete. Decode a real access token's scope/audience and watch NRF discovery/registration — the SBA security model as packets.
FIGURE 33.7Lab 4 — TLS/Certificate Lab with a Private CA
private CA → per-NF certsissue, deploy enable mTLS on SBIcapture handshake negative testwrong-audience token expect 403 prove the Chapter-25 #4 finding: a wrong-audience token MUST be rejected — if it isn't, you've reproduced the bug
Purpose: Chapters 10 and 25 in practice. Run a private PKI, enable mTLS, and prove the audience-validation negative test — the highest-yield SBA audit item.
FIGURE 33.8Lab 5 — SEPP Conceptual Exercise
PLMN A + cSEPP N32 + filteringallowlist message types PLMN B + pSEPP send a disallowed (e.g., location-query-like) message and watch the filter DROP it — Chapter 13's defense, demonstrated
Purpose: Chapter 13 conceptually. Even a simplified two-SEPP model shows how message filtering drops a malicious-but-valid message — the SS7-attack fix in action.
FIGURE 33.9Lab Result Validation Flow
expected observatione.g. "RES*==XRES*" run + capture confirm vs expected document define the expected result BEFORE running — a lab without an expected observation teaches nothing reproducible
Purpose: make labs rigorous. State the expected observation first, then confirm — turning play into reproducible verification you can trust and teach.
FIGURE 33.10Lab-to-Production Mapping
lab skill production activity read NEA/NIA in SMC capturenull-crypto audit + KPI (Ch 25, 26) SUCI on/off comparisonSUCI enforcement check (Ch 4, 28) token scope/audience decodeauthorization audit (Ch 10, 28) auth failure-cause analysisSOC funnel + rogue-gNB hunt (Ch 26, 27) every lab skill maps to a real audit or SOC activity — the lab is where you build the muscle memory
Purpose: close the loop. The skills built in the lab are exactly the audit and SOC activities of Chapters 25–28 — the lab is professional practice, not just play.

33.2 The Practical Operator View

33.3 Lab-to-Chapter Map

LabDemonstratesChapters
5G-AKA captureRAND/AUTN/RES*, MAC vs sync failure5,6
NAS SMC readNEA/NIA, bidding-down8
SUCI on/offidentity concealment4,19
SBA token inspectmTLS, OAuth, NRF10
TLS/cert + audience testauthorization validation10,25
SEPP filteringroaming defense13

33.4 Terminology

TermMeaning
Open5GSOpen-source 5G core implementation
UERANSIMOpen-source 5G UE/gNB simulator
WiresharkPacket capture/analysis tool (NAS, NGAP, HTTP/2 dissectors)
conducted/shielded setupRF testing without radiating on licensed spectrum

Real network example. A telecom operator's security team struggled to get RAN and core engineers to take SUCI configuration seriously — it was abstract. The security lead built Lab 2 (Figure 33.5) and, in a 20-minute session, captured a registration with scheme A (showing an opaque, ever-changing blob) and then with the null scheme (showing the subscriber's IMSI-equivalent in plain text on the projector). The room went quiet. The same engineers who'd shrugged at "enforce SUCI scheme" now understood, viscerally, what null scheme leaked. The lab did what a hundred slides hadn't. The team made that capture a standard part of onboarding. Security people learn from specs; everyone else learns from seeing the IMSI on the screen.

Chapter Summary

? Review Questions

  1. What three tools form the core lab, and what does each provide?
  2. Why must the lab stay isolated, and what is illegal otherwise?
  3. What would you observe in a 5G-AKA capture, and how do you induce each failure mode?
  4. How does the SUCI on/off lab demonstrate identity privacy?
  5. What token claims do you decode in the SBA lab, and why?
  6. What negative test proves the authorization audit, and what result do you expect?
  7. How does each lab map to a production audit/SOC activity?
  8. Why define expected observations before running a lab?
🧪 Mini lab — build the whole thing

Stand up the reference lab (Figure 33.1) on isolated VMs: install Open5GS, configure a subscriber, run UERANSIM, and capture with Wireshark. Then execute all five core labs in sequence: (1) 5G-AKA + both failure modes, (2) NAS SMC read, (3) SUCI on/off, (4) SBA token decode, (5) TLS/cert + audience negative test. For each, write the expected observation first, then confirm it. Finally, reproduce one misconfiguration from Chapter 25 and the detection from Chapter 26. You will finish with hands-on command of the entire book — and a lab you can use to train every engineer who needs to see, not just read, why 5G security works the way it does.