mitshell / corenet

Minimal 3G and LTE / EPC core network
GNU General Public License v2.0
106 stars 35 forks source link

Wrong IE order in S1AP InitialContextSetupRequest message #8

Closed Jandbacker closed 5 years ago

Jandbacker commented 5 years ago

Hi, I want to first of all thank you for making this fantastic piece of SW available!

Current IE order (see attached file): Item 0: id-MME-UE-S1AP-ID Item 1: id-eNB-UE-S1AP-ID Item 2: id-E-RABToBeSetupListCtxtSUReq Item 3: id-uEaggregateMaximumBitrate Item 4: id-SecurityKey Item 5: id-GUMMEI-ID Item 6: id-UESecurityCapabilities

IE_order.pcap.zip

According to TS36.413 9.1.4.1 the order should be: Item 0: id-MME-UE-S1AP-ID Item 1: id-eNB-UE-S1AP-ID Item 2: id-uEaggregateMaximumBitrate Item 3: id-E-RABToBeSetupListCtxtSUReq Item 4: id-UESecurityCapabilities Item 5: id-SecurityKey Item 6: id-GUMMEI-ID

An Ericsson eNB is complaining about this by sending an InitialContextSetupFailure with cause 'abstract-syntax-error-falsely-constructed-message'

As stated in TS36.413 9.3.0: IEs shall be ordered (in an IE container) in the order they appear in object set definitions.

Thanks, Jan

mitshell commented 5 years ago

You are right. Currently, IEs are encoded in ascending order, according to there ID: https://github.com/P1sec/pycrate/blob/c28cb99741b2ee3ccbf90e959538f190a425d316/pycrate_corenet/ProcProto.py#L312 I'll check how to respect the ASN.1 IEs set definition order (even if an ASN.1 set is, by definition, unordered...).

mitshell commented 5 years ago

I just pushed the following branch of pycrate: "ran_asn_ies_ord". I could not test it with any working RNC / eNB yet. Could you test it and tell me if it's working as expected ?

Jandbacker commented 5 years ago

I'll give it a go tonight. Thanks a lot!!

On 6/11/19 11:54 AM, mitshell wrote:

I just pushed the following branch of pycrate: "ran_asn_ies_ord". I could not test it with any working RNC / eNB yet. Could you test it and tell me if it's working as expected ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mitshell/corenet/issues/8?email_source=notifications&email_token=ACFASW7YZRHA57ELSRVPM5TPZ5Y6HA5CNFSM4HWG5ZCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXMS3MA#issuecomment-500772272, or mute the thread https://github.com/notifications/unsubscribe-auth/ACFASW2YHJSG4FLWQQRZA2TPZ5Y6HANCNFSM4HWG5ZCA.

Jandbacker commented 5 years ago

Works :)

enp12s0f1-ordered_IEs.pcap.zip

Thanks for fixing this so quickly!!

mitshell commented 5 years ago

Thanks a lot for your feedback ! I will merge the branch "ran_asn_ies_ord" into pycrate master soon.