The vulnerability, GHSA-mc29-hmx6-856q, describes a race condition in Ella Core where a NAS Security Mode Command and an N2 handover procedure can run concurrently, leading to handover failure. This violates the rules specified in 3GPP TS 33.501 §6.9.5.1.
The root cause was the inadequate mechanism for tracking ongoing procedures. The system used a simple string flag (OnGoing) which could only represent a single ongoing procedure and lacked the logic to prevent conflicting procedures from starting.
The fix, identified in commit 0292160762472ddbae79c5017e997eb5ac545fbb, was to replace this simple flag with a more robust procedure.Registry. This new registry maintains a list of all active procedures for a User Equipment (UE) and, crucially, implements a conflict matrix (internal/amf/procedure/matrix.go). This matrix explicitly defines which procedures are mutually exclusive. Specifically, it blocks a SecurityMode procedure from starting if an N2Handover is active, and vice-versa.
The two key functions that were vulnerable are the ones that initiate these conflicting procedures:
-
gmm.securityMode (in internal/amf/nas/gmm/security_mode.go): This function initiates the Security Mode procedure. Before the patch, it did not check for an ongoing N2 handover. The patch added a call to ue.Procedures.Begin(..., procedure.SecurityMode) which consults the conflict matrix, preventing the procedure from starting if a conflict exists.
-
ngap.HandleHandoverRequired (in internal/amf/ngap/handle_handover_required.go): This function initiates the N2 handover procedure. Before the patch, it did not check for an ongoing Security Mode procedure. The patch added a call to amfUe.Procedures.Begin(..., procedure.N2Handover), which similarly prevents the handover if a conflicting procedure like Security Mode is active.
By exploiting the lack of locking between these two functions, an attacker could trigger the race condition, causing a denial of service for the handover procedure. The other modified files in the commit are related to integrating this new procedure registry and ensuring procedures are correctly started and stopped throughout the codebase.