NAS Authentication Error (ngKSI already in use) & (Synch Failure)


Hi Team @wilson30139 ,

While integrating free5gc core with qct RAN, we encountered Authentication Failure errors during UE registration process, resulting in InitialContextSetupFailure (Unsuccessful UE registration). In the attached pcap file, the following errors can be seen;
5GMM Cause: ngKSI already in use
5GMM Cause: Synch Failure

At the AMF side, the error “NAS message is ciphered, but MAC verification failed” can also be seen in the attached AMF log file.

We are stuck at this point and unable to proceed with our project. Any assistance/support from your side would be highly appreicated.

Note: The IP address of AMF is & The IP address of qct RAN is For this integration project, the docker-compose example of free5gc version 3.3.0 is used.

Thanks in advance!

free5gcRobustel.pcap (36.6 KB) log_amf.txt (158.4 KB)

I would like to know what kind of UE you are using, I think there is something wrong with the settings on the UE.
I’ve seen the pcap you gave me and actually the last authentication was there, so there should be no problem with registration.
And ngKSI already in use, mainly related to the data stored in UE.messageImage_1706087478388|690x75

Hello @tim1207,

we tried with two different UEs - ASUS Zenfone 8 & Robustel R5020. Could you please indicate where UE settings could possibly be incorrect? Since both of these end devices worked fine with other core networks. Could it be possibily an issue with the integrity or ciphering algo? or something else. Your support would be highly appreciated.

I am also attaching the pcap file for Zenfone testing here.
free5GcoreZenfone 1.pcap (50.1 KB)

Thanks in advance!

Hi, @tim1207, @wilson30139, @free5GC Team
I’m also facing the same issue, my project is to integrate with Amarisoft. And I have 2 one plus mobile + Amarisoft Test sim card. In amarisoft the sim algo was: “XOR” and free5gc follows milenage algo.

Me and my Prof. was going through Milenage authentication calculator and we noticed that half of the autn number is correct which was showing in Amarisoft webgui and half the number was wrong.

You can follow my issue: Authentication Request, Authentication failure(Mac failure), Authentication reject

Thank you

Hi @free5GC Team, @tim1207,

We also observed an strange behavior in the pcap file. AMF must send an “InitialUEContextSetupRequest”, after reception of NAS “SecurityModeCommand” to establish the AS Security both on RAN and UE side. but we see “UEContextReleaseCommand” instead of “InitialContextSetupRequest”.

I have checked your packet(free5GcoreZenfone 1.pcap) and saw that illegal UE caused the registration to be rejected. The cause of illegal UE ay be caused by multiple PLMN.
You may need to first confirm whether there is a conflict between the free5gc PLMN and the UE PLMN.
In addition, the problem with AMF InitialUEContextSetupRequest may be caused by the registration rejection. Therefore, if the problem still occurs after solving illegal UE , please feel free to ask again.

since there haven’t any replies from you, the admin decides to close this topic.
If you have any further questions about this topic, please message the admin or create another topic.