← Book home
Part 4 · RAN, Mobility, and Roaming Security
16

Handover Security

Re-keying a moving subscriber, hop after hop, without ever pausing

“Every time you cross a cell boundary in a moving car, your phone silently performs a cryptographic key change. It must be fast enough to be invisible and strong enough that the cell you just left can't follow you.” — THE HANDOVER CHALLENGE

A handover moves a connected UE from one gNB to another without dropping the session. Security-wise, it is a key-management event: the target gNB needs keys, but the source gNB must not be able to compute them (forward security). 5G solves this with the NH/NCC key chain from Chapter 7. This chapter walks the handover types — intra-gNB, Xn, N2 — and the key handling, forward/backward security, and capability transfer behind them.

🎯 Learning objectives
📘 Standards reference box — Chapter 16
SpecificationTitleRelease / version verified
TS 33.5015G security — handover key handling (clause 6.9)Rel-18, v18.11.0 (2026-04)
TS 38.300 / 38.413 / 38.423NG-RAN / NGAP (N2) / XnAP (Xn) proceduresRel-18/19 edition

Checked June 2026 — verify against the latest 3GPP version. NH/NCC mechanics build on Chapter 7.

16.1 Why Handover Is a Cryptographic Event

FIGURE 16.1Handover — a Key Change in Motion
UE UE in motion → source gNB target gNB had K_gNB (source)knows current keys needs FRESH K_gNB (target)ideally source can't compute it the security goal: the target's keys must NOT be derivable by the source gNB → forward security (§16.5)
Purpose: the core tension. A handover must hand the target usable keys, but the ideal is that the source — which may later be compromised — cannot reconstruct them and eavesdrop on the moved subscriber.
FIGURE 16.2The Key Chaining Model Across gNBs
K_AMFin AMF NH (NCC=1) NH (NCC=2) NH (NCC=3) K_gNB @ cell1vertical from NH1 K_gNB @ cell2vertical from NH2 K_gNB @ cell3vertical from NH3 each cell's K_gNB derived from a fresh NH that only the AMF could produce → a compromised gNB can't compute the next cell's key
Purpose: the NH chain in mobility. The AMF pre-computes the chain; each hop ideally draws a fresh NH (vertical), so the key sequence is one-way and the source can't predict forward.
FIGURE 16.3NH/NCC State Machine
AMFadvances NCC, computes NH {NH, NCC} source gNBstores {NH, NCC} HO: pass NCC target gNB + UENCC tells which NH to use the NCC value in the handover command is how the UE knows whether it's a horizontal (same NCC) or vertical (incremented NCC) derivation
Purpose: who holds and advances the chain. The NCC is the on-the-wire signal that lets the UE reproduce the exact derivation the network used.
FIGURE 16.4Horizontal Derivation (Same NCC)
current K_gNB (source)+ target PCI/ARFCN KDF target K_gNBNCC unchanged weakersource knows the input →no forward security this hop
Purpose: the fallback derivation. Used when no fresh NH is available; it works but the source gNB can compute the target's key — so it offers no forward security on that hop.
FIGURE 16.5Vertical Derivation (Fresh NH, NCC+1)
fresh NH (from AMF)+ target PCI/ARFCN KDF target K_gNBNCC incremented strongersource never saw NH →forward security restored
Purpose: the strong derivation. The fresh NH comes from the AMF — an entity the source can't impersonate — so the target's key is beyond the source's reach.

16.2 Intra-gNB, Xn, and N2 Handover

FIGURE 16.6Intra-gNB Handover Key Handling
same gNB, different cell cell A cell B gNB derives the new K_gNB locally (horizontal or with stored NH) — simplest, no inter-node signaling for keys
Purpose: the simplest case. Within one gNB, key handling is local — useful baseline before the inter-gNB flows.
FIGURE 16.7Xn Handover — Full Message Flow with Keys
UE source gNB target gNB AMF ① measurement report ② derive K_gNB*(horizontal/stored NH) ③ Handover Request ( K_gNB*, NCC ) over Xn ④ HO Request Ack ( RRC reconfig ) ⑤ RRCReconfiguration ( NCC ) ⑥ UE derives same K_gNB* ⑦ RRCReconfigurationComplete → on target gNB ⑧ Path Switch → AMF (next: fresh NH)
Purpose: the most common handover. The source prepares the target directly over Xn (fast), then a path switch to the AMF refreshes the NH for the next hop.
FIGURE 16.8Xn Path Switch — Refreshing the NH
target gNB AMF Path Switch Request (UE now here) Path Switch Ack ( FRESH NH, NCC+1 ) now the target holds a fresh NH the source never saw → the NEXT handover can be vertical = forward-secure again
Purpose: how forward security is periodically re-established. Even if a hop was horizontal, the path switch tops up the NH so the chain keeps moving beyond the source's reach.
FIGURE 16.9N2 Handover — Full Message Flow with Keys
source gNB source AMF target AMF target gNB ① Handover Required ② Forward Relocation (if AMF changes) ③ AMF derives K_gNB + NH ④ Handover Request ( keys, NCC ) ⑤ HO Command relayed to UE → UE re-keys, attaches to target used when there's no Xn between gNBs, or the AMF changes — the AMF (not the source gNB) computes the target keys
Purpose: the core-mediated handover. When Xn isn't available or the AMF changes, the AMF computes the keys — inherently providing a fresh NH and forward security.

16.3 Forward and Backward Security

FIGURE 16.10Forward Security Explained
gNB-1 compromised gNB-2keys safe gNB-3keys safe gNB-4keys safe FORWARD security: gNB-1 cannot compute the keys of the cells the UE moves to AFTER it (with vertical derivation)
Purpose: forward security defined. A compromised gNB can't follow the subscriber forward in time/space — the vertical NH derivation breaks the chain ahead of it.
FIGURE 16.11Backward Security Explained
gNB-1past keys safe gNB-2past keys safe gNB-3past keys safe gNB-4 compromised BACKWARD security: gNB-4 cannot compute the keys of cells the UE was in BEFORE — the one-way KDF protects the past too
Purpose: backward security defined. Compromising a current gNB doesn't retroactively expose the subscriber's earlier cells — the derivations are one-way in both directions.

16.4 Capability Transfer and Algorithm Change

FIGURE 16.12UE Security Capability Transfer at Handover
source gNBholds UE sec capabilities capabilities (in HO request) target gNBselects algorithms within them why it matterstarget must not pick an algorithmthe UE doesn't support — and mustnot be tricked into a weak one
Purpose: capabilities must travel with the UE. The target picks algorithms from the UE's real capability set — and the transfer must be protected so it can't be downgraded mid-handover.
FIGURE 16.13Algorithm Change at Handover
source: NEA2/NIA2UE's current AS algorithms handover target: NEA3/NIA3different supported algorithms → new AS keysalgorithm ID is a KDF input(Chapter 7) → keys re-derived
Purpose: algorithms can change cell to cell. Because the algorithm ID is a KDF input (Chapter 7), changing it re-derives the AS keys — keys are always bound to the algorithm in use.
FIGURE 16.14Compromised gNB — What Chaining Limits
gNB a compromised gNB CAN read traffic in ITS cell while the UE is there it CANNOT (with vertical derivation) reach the UE's past or future cells → key chaining CONTAINS the breach to one cell's tenure
Purpose: the realistic security promise. Chaining doesn't make a compromised gNB harmless in its own cell — but it stops the breach from spreading across the subscriber's journey.
FIGURE 16.15Handover Failure and Key Rollback
source keysstill valid HO fails target re-keynever completed UE re-establishes on source with source keys no corruptedkey state
Purpose: graceful failure. A failed handover doesn't leave the UE in a broken key state — it falls back to the still-valid source context.
FIGURE 16.16Handover Security Parameters — Quick Map
WHAT TO LOOK FOR IN A HANDOVER TRACE NCC valuein RRC reconfiguration → horizontal (same) vs vertical (incremented) K_gNB* derivationfrom current K_gNB (horizontal) or fresh NH (vertical) UE sec capabilitiestransferred source→target, protected against downgrade selected algorithmstarget's choice within UE capabilities → may re-derive AS keys
Purpose: the field reference. These are the exact parameters a security engineer reads in a handover capture to confirm the right (ideally vertical) key handling occurred.

16.5 The Practical Operator View

Common misconfiguration risks

16.6 Threats and Mitigations

ThreatVectorDefense
Source eavesdrops after movehorizontal-only derivationvertical derivation, NH refresh
Handover key interceptionunprotected Xn/N2IPsec on Xn/N2 (Ch 14–15)
Algorithm downgrade at HOtampered capability transferprotected capability transfer
Breach spread across cellscompromised gNBone-way key chaining (forward+backward)
Key state corruptionhandover failurerollback to source context

16.7 Terminology, Example, Checklist

TermMeaning
NH / NCCNext-hop key / next-hop chaining counter
K_gNB*The new K_gNB derived for the target cell
horizontal / verticalDerivation from current K_gNB / from fresh NH (forward-secure)
forward / backward securityCompromised gNB can't reach future / past cells
path switchPost-Xn-handover step that refreshes the NH from the AMF

Real network example. A drive-test analysis on a dense urban cluster found that handovers between two vendors' gNBs were always using horizontal key derivation — the NCC never incremented across the boundary. The cause: the path-switch NH refresh wasn't being applied correctly in the multi-vendor Xn relationship, so no fresh NH was ever available, forcing horizontal derivation every time. Functionally everything worked; security-wise, forward security was never re-established along that route, meaning a compromise of one gNB could chain forward to the next. Fix: correct the path-switch handling so the AMF's fresh NH reached the target, restoring vertical derivations. Handovers can succeed perfectly while silently never refreshing forward security — only a trace of the NCC reveals it.

Chapter Summary

? Review Questions

  1. Why is a handover a cryptographic event, and what is the security goal regarding the source gNB?
  2. Distinguish horizontal and vertical derivation and which provides forward security.
  3. Walk the Xn handover key flow and explain the role of the path switch.
  4. When and why is N2 handover used instead of Xn, and how does it affect keys?
  5. Define forward and backward security with a compromised-gNB example of each.
  6. Why must UE capability transfer be protected at handover?
  7. A trace shows NCC never incrementing across a boundary. What's wrong and what's the security impact?
  8. What happens to keys when a handover fails?
🧪 Mini lab — read the NCC

In a lab with mobility (or from a real handover capture): (1) Trigger/capture an Xn handover and find the RRC reconfiguration carrying the NCC. (2) Note whether NCC incremented (vertical) or stayed (horizontal). (3) Find the subsequent path switch and confirm a fresh NH is returned. (4) Reflect: if you observed only horizontal derivations across a route, what forward-security property is missing, and what is the attacker scenario it enables? (5) Bonus: change neighbor-gNB algorithm support and observe how a handover re-derives AS keys for the new algorithm. You've now learned to audit mobility security from the one field that reveals it — the NCC.