-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
Order of the EAP AKA' attributes #592
Comments
Without considering the performance, I debugged the code with a fast and simple method. I added a With limited debugging info from free5gc, it took me a long time to find out the issue. The issue is with the
Take a look on
Which is slightly different from the code. As a result, the MK and also the K_AUT will be wrong. Since MAC is calculated by K_AUT, the MAC will not be the same as the expected correct one. After changing it to However, there is still other problems regarding the EAP challenge response. The Wireshark turned out that it had no actual contents in it. I am still working on the src code. Will keep updating. |
For reference, I put my first debugging issue here. I am using the latest free5gc against the UERANSIM with EAP-AKA'. There are two issues until now.
I guess the intention for this step is to see if there are 16bytes of RAND, AUTN, and MAC without the reserved 0 and get rid of these 0s at the return step, but the logic seems to be strange. The logic of |
I debugged a new issue today. The UERANSIM can now run perfectly with free5gc. The new issue is with the AT_RES. Let's see the code of
The code concat the length of the AT_RES in bytes and the value of AT_RES as the final AT_RES. However, according to RFC 4187:
The length should be in bit length instead of byte length. Add |
Hello @Z0827, I know it's been a long time since you opened that issue here but I'm willing to try to solve it. I have a working Free5GC instance and UERANSIM works like a charm with 5G-AKA authentication. However, EAP-AKA' isn't working and while trying to find a solution online I found this issue here. I read your comments above and made some of the changes suggested (as it's possible to see here), but I couldn't figure it out how to translate the suggestions you made on your first message to the code
More specifically on how to record the parameters on the vector.
Could you please help me out? Thanks in advance, |
* remove spurious length check when fetching attributes, such as in getRand(), getMac() etc. * fix the AT_RES length (it's in bits, not bytes) * fix reordering of attributes and MAC computation issues * fix SUPI input to the master key (remove the supi type prefix) * use kAusf computation for eap-aka' rather than the 5g-aka one Inspired in large part by the issues and solutions reported in aligungr#592
Hello, I didn't get notified that this issue was mentioned, that's why it took so long for me to note that progress was made. I could test the new UERANSIM nightly from commit For future reference, if you already have UERANSIM running on a previous nightly version or the stable version, follow the steps below to get EAP fixed:
Done, enjoy. So, @Z0827 or @aligungr IMO this issue should be closed as it was resolved by #700 Regards, |
I am using free5gc with EAP-AKA'. The UERANSIM can not verify the AT_MAC, so I debugged it.
It seems like the class EapAttributes is represented by a structure
std::array<std::optional<OctetString>, 256> attributes{};
, where the index denotes the attribute's type. With this data structure, let us go through theEncodeEapPdu
.In this function, the EAP object is encoded into OctetString. However, the order of the attributes is encoded in a way that ordered by their attribute indexes. For example, if the EAP object possesses AT_RAND(1), AT_AUTN(2), AT_KDF(24), AT_KDF_INPUT(23), and AT_MAC(11), they must be ordered as AT_RAND(1), AT_AUTN(2), AT_MAC(11), AT_KDF_INPUT(23), AT_KDF(24).
We then look at the function which calculates the expected AT_MAC
In this manner, the
OctetString input
is assembled with ordered attributes, and thus the result of SHA is the result of an ordered OctetString.However, stated by RFC 4187, this may cause issues.
In fact, it did cause issues for me. The free5gc would not encode attributes in an ordered way, and thus the AT_MAC check failed.
The text was updated successfully, but these errors were encountered: