3.1. Security Threat Modeling
This section defines the scope, attacker assumptions, and attack objectives for NGAP procedures between the gNB and AMF. Based on these elements, we derive multiple state-based attack scenarios.
Scope. The analysis focuses on NGAP messages transmitted from the gNB to the AMF and the corresponding NGAP processing logic of the AMF. We examine whether the AMF validates message structures and values, UE identifiers, connection states, and UE contexts. We then compare the observed processing outcomes with the expected behavior defined in the specifications. The radio interface, user-plane protocols, direct mutation of NAS messages, and denial-of-service attacks based on high-volume traffic are outside the scope of this study.
Attacker assumptions. The attacker is assumed to control a gNB-side entity with N2 access to the AMF and sufficient gNB-level protocol functionality to establish an SCTP connection and execute normal NGAP procedures. This threat model does not assume an arbitrary unauthenticated remote attacker. The attacker can establish an NG connection, a UE-associated logical NG connection, and a UE context through normal procedures, and can subsequently mutate IEs, UE identifiers, and security-related information or transmit messages that are not permitted in the current connection state. However, the attacker has no direct access to the internal code, memory, or database of the AMF.
Attack objectives. The attack objective is to cause the AMF to process a mutated NGAP message without performing the validation or producing the response required by the specifications. Such behavior may violate the consistency between UE identifiers and connection states, trigger subsequent procedures without the required UE context or preceding procedures, or incorporate security-related information without comparing it with the existing context.
3.1.1. Definition of the AMF State Model
The validity of an NGAP message depends not only on the message itself but also on the connection state in which it is received. A state model that represents AMF connection states is therefore required to derive state-based attack scenarios.
The 3GPP specifications do not explicitly define a standalone state model for AMF NGAP connection states. TS 24.501 defines 5G mobility-management states from the UE perspective, whereas TS 38.413 specifies NGAP procedures and their execution conditions [
1,
17]. We therefore derive the AMF state model by analyzing the dependencies among UE-associated NGAP procedures defined in TS 38.413. The resulting state model is presented in
Figure 2.
TS 38.413 classifies NGAP procedures as UE-associated or non-UE-associated [
1]. Non-UE-associated procedures do not depend on a specific UE context, whereas UE-associated procedures rely on connections and UE contexts established through preceding procedures. We therefore analyze the relationships between preceding and subsequent procedures from the perspective of UE-associated procedures.
The analysis shows that UE-associated procedures rely on three sequential layers: the NG connection, the UE-associated logical NG connection, and the UE context. Completion of the NG Setup procedure establishes the NG connection between the gNB and AMF. The Initial UE Message then establishes a UE-associated logical NG connection, and completion of the Initial Context Setup procedure establishes the UE context. Most UE-associated procedures are executed only after these layers have been established.
Based on these dependencies, we define the initial state as S0, the NG-connected state as S1, the UE-associated logical NG connection state as S2, and the UE-context-established state as S3. The states are sequentially dependent, such that each state beyond S0 requires the successful completion of the procedures associated with the preceding state.
The purpose of this abstraction is not merely to represent the progression of NGAP procedures. Each state captures the connection and UE-context conditions that determine whether a particular NGAP procedure is valid in that state, and is therefore used as a state-dependent verification condition when constructing attack scenarios.
Procedures executed after UE context establishment are further divided into general UE-associated procedures and handover-related procedures. Procedures such as PDU Session Resource Setup are executed while retaining the UE-context-established state. By contrast, Handover Preparation creates a separate procedural state that must exist before subsequent handover messages, including Handover Cancel and Handover Notify, can be processed. We therefore define the handover-in-progress state as S4.
The state model includes not only forward transitions established through normal UE-associated NGAP procedures but also transitions that release, reset, or terminate existing connection and procedural conditions. For example, UE Context Release removes the established UE context, NG Reset resets the affected UE-associated logical NG connections and related UE contexts through non-UE-associated signalling, and Handover Cancel terminates an ongoing handover procedure. These transitions allow the model to represent release, reset, and rollback behavior in addition to the forward progression from S0 to S4.
The state model is not intended to represent every internal AMF state or all possible abnormal recovery paths. Instead, it abstracts the connection, UE-context, and procedural conditions required to determine whether an NGAP message is valid in a given state. The model is subsequently used to identify the NGAP messages applicable to each state and to generate state-based attack scenarios by applying the defined mutation types.
Table 3 summarizes representative NGAP messages that can be transmitted in each state. These state-specific message sets characterize the states and provide the reference inputs used to generate mutated messages.
3.1.2. Derivation of Attack Scenarios
Attack scenarios are derived from the AMF state model, NGAP error-handling rules, and security requirements defined in the specifications. We first define the mutation types applicable to NGAP messages and combine them with the messages available in each connection state. The collected responses and processing logs are then compared with the expected behavior to evaluate compliance with the specifications and identify specification violations.
TS 38.413 [
1] classifies NGAP errors as Transfer Syntax Errors, Abstract Syntax Errors, and Logical Errors and specifies the required handling according to the error type and IE criticality. TS 33.501 [
3] defines protection and verification requirements for security-related information, including UE security capabilities. Based on these requirements, we define six mutation types: mandatory IE omission, syntactic mutation, semantic mutation, identifier mismatch, state violation, and security capability mutation.
Table 4 summarizes their application methods, specification bases, and expected AMF behaviors.
Mandatory IE omission and syntactic mutation violate structural validity. Semantic mutation and identifier mismatch violate procedural or UE-context consistency. A state violation does not modify the message itself; instead, it transmits the message in a connection state in which the procedure is not permitted. The required target state must therefore be established through preceding NGAP procedures. Security capability mutation modifies the received UE security capabilities to determine whether the AMF validates them against the previously stored values.
Each attack scenario explicitly combines a target connection state, an NGAP message applicable to that state, a mutation method, and a specification-defined expected behavior. In this construction, the connection state serves as part of the test condition rather than merely as a prerequisite for message transmission, allowing the same mutation principle to be evaluated under different connection and UE-context conditions. The representative scenarios shown in
Figure 3,
Figure 4 and
Figure 5 illustrate these state-dependent combinations. Each scenario is evaluated based on an error response, the execution of a subsequent procedure, or a change in the relevant AMF context.
This scenario verifies that UE security capabilities stored by the AMF cannot be arbitrarily changed during a subsequent NGAP procedure. A normal registration procedure is first executed to establish S3, during which the AMF stores the UE security capabilities. The UE Security Capabilities IE in a Path Switch Request is then replaced with values that are inconsistent with the capabilities previously stored for the UE.
The AMF must verify the received capabilities against the previously stored values and must not overwrite the stored security context with inconsistent values. If the AMF performs such an unverified update, the result is classified as a violation of the security requirements. This scenario is therefore evaluated by examining changes to the stored security capabilities rather than by observing whether an error response is returned. The complete procedure is illustrated in
Figure 3.
This scenario verifies whether the AMF confirms the existence of the required UE context before processing a UE-associated procedure. State S2 is first established, in which the NG connection and UE-associated logical NG connection exist, but the UE context has not yet been established.
A Handover Required message, which assumes an established UE context, is then transmitted. The AMF is expected to validate the UE identifiers and the current connection state and reject the procedure if the required UE context does not exist. If the AMF accepts the message without validating the context and proceeds with a subsequent message such as Handover Request, the result is classified as a state violation in which handover is initiated without the required context-establishment procedure. The scenario is evaluated using the returned error response and the presence of subsequent NGAP messages. The complete procedure is illustrated in
Figure 4.
This state-violation scenario verifies whether the AMF prevents an unrelated UE-associated procedure from being initiated while handover-related key derivation is in progress.
A Handover Required message is first transmitted to initiate the handover preparation procedure and establish S4. While the AMF is processing the handover procedure and deriving the required security keys, an unmodified Uplink NAS Transport message is transmitted through the same UE-associated logical NG connection.
The AMF is expected to reject or defer the Uplink NAS Transport message because that procedure is not permitted while the handover preparation procedure is in progress in S4. If the AMF accepts the message and initiates the NAS transport procedure concurrently with the ongoing handover procedure, the result is classified as a state-violation vulnerability. The outcome is determined by examining error responses, subsequent NGAP messages, and relevant processing logs. The complete procedure is illustrated in
Figure 5.
3.2. Security Verification Workflow
This section describes the stateful security verification workflow based on the attack scenarios derived in
Section 3.1.2. As shown in
Figure 6, the workflow consists of scenario selection, mutated-message generation and transmission, and response and log collection.
The verification tool determines whether the current connection state matches the state required by the selected scenario. If not, it follows the transition path defined in the state model and sequentially executes normal NGAP procedures until the target state is reached.
The tool verifies each transition using the AMF response and tracks the completed procedures and established connection information. If the required state cannot be reached, the mutated message is not transmitted, and the scenario is recorded as a state-establishment failure.
State-establishment procedures and mutated-message transmission are executed consecutively through the same gNB instance. This preserves the SCTP connection, UE context, and NGAP identifiers created during state establishment and ensures that the mutated message is processed in the intended connection state.
The selected NGAP message is generated and mutated according to the attack scenario. The mutated message is constructed using the NGAP message structures provided by UERANSIM, and the required IEs or field values are modified according to the selected mutation type. Message structures and IEs that are not mutation targets retain their valid values.
Depending on the scenario, the tool removes a mandatory IE, modifies an IE value, replaces an NGAP identifier, mutates the UE security capabilities, or transmits a message in a prohibited connection state. The resulting message is encoded using the existing ASN.1 PER encoding process and transmitted to the target AMF over the SCTP connection maintained during state establishment.
The verification tool collects NGAP responses and processing logs to determine how the AMF processes the mutated message. NGAP responses are captured in the test environment, whereas processing logs are collected separately from the target AMF. Responses are classified as an Error Indication, a procedure-specific failure message, a normal subsequent message, or no response. When an Error Indication or failure message is returned, the corresponding Cause and Criticality Diagnostics are also recorded. If a normal NGAP procedure continues after transmission of the mutated message, the subsequent messages and procedure information are recorded as well.
For some scenarios, the processing outcome cannot be determined from NGAP responses alone. The processing logs are therefore analyzed to confirm whether the message was processed and whether a subsequent procedure was executed. The collected responses and logs are used in the experimental analysis.