5G NAS - Security Mode Command Explained

Security Mode Command is the NAS message the network sends when it is ready to switch the UE into the selected NAS security state. It usually appears after successful authentication and before the registration procedure moves on to Registration Accept.

For beginners, the simple meaning is: the network is telling the UE which NAS security settings to start using.
For engineers, this message is the key transition from successful identity and authentication handling into protected NAS signaling.

What is Security Mode Command in simple terms?

The UE has already reached the point where the network trusts it enough to continue. Now the AMF tells the UE which NAS security algorithms to use so later signaling can be protected.

Why Security Mode Command matters

This message matters because it is where security policy becomes active. If the selected algorithms or key set context are wrong, the whole procedure can fail even though earlier authentication looked fine.

It also helps engineers separate:

  • authentication success
  • NAS security activation
  • later registration acceptance

Where Security Mode Command appears in the call flow

UE                              gNB / AMF
|<-- Authentication Request -----|
|--- Authentication Response ---->|
|<-- Security Mode Command ------|
|--- Security Mode Complete ----->|
|<-- Registration Accept --------|

It usually appears during initial registration, but it can also appear in other 5GMM procedures that require security activation or refresh.

Transport characteristics

  • Direction: AMF to UE
  • Interface: N1
  • Transport on access side: commonly via DL Information Transfer
  • Security expectation: this message is itself the point where NAS security activation becomes explicit, so the security header treatment matters in trace analysis

What Security Mode Command means operationally

Operationally, Security Mode Command tells engineers that the core network has already completed the identity and authentication path well enough to choose a NAS security state.

The first practical checks are:

  • which NAS integrity and ciphering algorithms were selected
  • whether ngKSI matches the expected key context
  • whether the UE returns Security Mode Complete or Security Mode Reject

Important Information Elements

IEWhy it matters
Selected NAS security algorithmsDefines the integrity and ciphering algorithms the UE must activate.
ngKSIIdentifies which NAS key set context is being used.
Replayed UE security capabilitiesLets you validate that the network selected security based on the expected UE capabilities.
IMEISV requestIndicates whether the UE must later provide IMEISV as part of the security-controlled procedure.

Example message dump

Security Mode Command
  Extended Protocol Discriminator: 5G Mobility Management
  Security Header Type: Integrity protected and ciphered with new 5G NAS security context
  Message Type: Security Mode Command
  Selected NAS security algorithms
    Ciphering algorithm: 128-5G-EA1
    Integrity algorithm: 128-5G-IA1
  ngKSI: 3
  Replayed UE security capabilities
    5G-EA: ea0 ea1
    5G-IA: ia1 ia2
  IMEISV Request: Not requested

How to read this dump

  • Start with the selected ciphering and integrity algorithms.
  • Then check ngKSI to understand which key context the AMF expects the UE to use.
  • After that, compare the replayed UE capabilities with what the UE declared earlier in the procedure.
  • Finally, correlate the command with Security Mode Complete or Security Mode Reject.

What to check in logs

  • verify that authentication already completed before this message appears
  • inspect the selected NAS algorithms carefully
  • check whether ngKSI is the expected one for the current procedure branch
  • compare replayed UE capabilities against earlier registration contents
  • correlate the message with the next NAS outcome, especially Security Mode Complete, Security Mode Reject, or an unexpected stall

FAQ

What does Security Mode Command do in 5G NAS?

It tells the UE which NAS ciphering and integrity algorithms to activate so the procedure can continue securely.

Is NAS Security Mode Command the same as RRC Security Mode Command?

No. NAS Security Mode Command is sent between the AMF and UE over NAS, while the RRC version is an access-stratum message between the gNB and UE.

What usually comes after Security Mode Command?

The usual next message is Security Mode Complete, followed by later registration or service messages such as Registration Accept.

Summary

Security Mode Command is the NAS message the AMF sends to activate the selected NAS security algorithms and move the 5GMM procedure into a protected signaling state.