Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication Failure - ngKSI already in use #307

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ashithacdac
Copy link
Contributor

Issue:
Authentication failure with cause ngKSI already in use

Troubleshoot:
Identified the root cause: the core includes the same ngKSI value from the Registration Request
in the Authentication request

Fix:
Updated the ngKSI value after the 5G AKA procedure

Supporting Data:
Authentication_fail_ngksi_already_in_use.zip

@gab-arrobo gab-arrobo force-pushed the ngksi-already-in-use branch 2 times, most recently from c019095 to fe5da79 Compare September 28, 2024 06:22
gmm/handler.go Outdated
@@ -1558,6 +1558,16 @@ func AuthenticationProcedure(ue *context.AmfUe, accessType models.AccessType) (b
ue.AuthenticationCtx = response
ue.ABBA = []uint8{0x00, 0x00} // set ABBA value as described at TS 33.501 Annex A.7.1

if ue.NgKsi.Tsc == models.ScType_NATIVE && ue.NgKsi.Ksi != 7 {
// As per the Specification 24.501 - 5.4.1.3.2 Authentication initiation by the network
if ue.NgKsi.Ksi < 6 { // ksi is range from 0 to 6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ue.NgKsi.Ksi = (ue.NgKsi.Ksi +1) % 7

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorporated the suggested changes.

@@ -1558,6 +1558,12 @@ func AuthenticationProcedure(ue *context.AmfUe, accessType models.AccessType) (b
ue.AuthenticationCtx = response
ue.ABBA = []uint8{0x00, 0x00} // set ABBA value as described at TS 33.501 Annex A.7.1

if ue.NgKsi.Tsc == models.ScType_NATIVE && ue.NgKsi.Ksi != 7 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ue.NgKsi.Tsc == models.ScType_NATIVE && ue.NgKsi.Ksi != 7 {
if ue.NgKsi.Tsc == models.ScType_NATIVE {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ue.NgKsi.Ksi will never be 7.

Copy link
Contributor

@gab-arrobo gab-arrobo Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Ajay's comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would appreciate clarification on the statement regarding Key lifetimes in the specification 33.501 section 6.2.3.3 which states 'In case the UE does not have a valid KAMF, an ngKSI with value "111" shall be sent by the UE to the network, which can initiate (re)authentication procedure to get a new KAMF based on a successful primary authentication.'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would appreciate clarification on the statement regarding Key lifetimes in the specification 33.501 section 6.2.3.3 which states 'In case the UE does not have a valid KAMF, an ngKSI with value "111" shall be sent by the UE to the network, which can initiate (re)authentication procedure to get a new KAMF based on a successful primary authentication.'

@thakurajayL what are yout thoughts about this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read the section you mentioned. It just says that if UE sends 111 then it just means UE does not have Kamf and its requesting new keys. In my opinion its perfectly fine to remove the != 7 check in the above code and let the keys rotate from 0 to 6.

// As per the Specification 24.501 - 5.4.1.3.2 Authentication initiation by the network
ue.NgKsi.Ksi = (ue.NgKsi.Ksi + 1) % 7
}
ue.GmmLog.Info("ngKSI after 5G-AKA: ", ue.NgKsi.Ksi)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ue.GmmLog.Info("ngKSI after 5G-AKA: ", ue.NgKsi.Ksi)
ue.GmmLog.Infoln("ngKSI after 5G-AKA:", ue.NgKsi.Ksi)

@@ -1558,6 +1558,12 @@ func AuthenticationProcedure(ue *context.AmfUe, accessType models.AccessType) (b
ue.AuthenticationCtx = response
ue.ABBA = []uint8{0x00, 0x00} // set ABBA value as described at TS 33.501 Annex A.7.1

if ue.NgKsi.Tsc == models.ScType_NATIVE && ue.NgKsi.Ksi != 7 {
Copy link
Contributor

@gab-arrobo gab-arrobo Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Ajay's comment

@@ -1558,6 +1558,12 @@ func AuthenticationProcedure(ue *context.AmfUe, accessType models.AccessType) (b
ue.AuthenticationCtx = response
ue.ABBA = []uint8{0x00, 0x00} // set ABBA value as described at TS 33.501 Annex A.7.1

if ue.NgKsi.Tsc == models.ScType_NATIVE && ue.NgKsi.Ksi != 7 {
// As per the Specification 24.501 - 5.4.1.3.2 Authentication initiation by the network
Copy link
Contributor

@gab-arrobo gab-arrobo Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, should not it be 33.501 the correct document to reference?

Suggested change
// As per the Specification 24.501 - 5.4.1.3.2 Authentication initiation by the network
// As per the Specification 33.501 - 6.2.3.2 Key identification

@thakurajayL thakurajayL self-assigned this Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants