P1sec / pycrate

A Python library to ease the development of encoders and decoders for various protocols and file formats; contains ASN.1 and CSN.1 compilers.
GNU Lesser General Public License v2.1
380 stars 130 forks source link

5G NAS UE policy protocol TS 24.501_UEPOL UEPolSectionMgmtSubresult uses length in octets instead of number of results #251

Open maddenj-ie opened 7 months ago

maddenj-ie commented 7 months ago

UEPolSectionMgmtSubresult has a length field which it sets to the length in octets of the results plus the length of the plmnId field rather than the number of results.

https://github.com/P1sec/pycrate/blob/1824d90cd4815ccdf4070e76338009aa1a1e8097/pycrate_mobile/TS24501_UEPOL.py#L149

https://github.com/P1sec/pycrate/blob/1824d90cd4815ccdf4070e76338009aa1a1e8097/pycrate_mobile/TS24501_UEPOL.py#L156

From TS 24501 D.6.3

Number of results (octet d) This field contains the binary encoding of number of results included in the UE policy section management subresult.

The 'Len' field should be a Uint8 and set to the number of elements in the sequence of UePolResult.

The field name of 'Len' may also be worth reviewing ;-)

I'm happy to assist with testing.

Thanks.

mitshell commented 4 months ago

Thanks for uncovering this bug. A new repository has been setup, including new fixes. This repo will keep being maintained : https://github.com/pycrate-org/pycrate. It includes fixes for this specific 5G NAS module. Moreover, it will ease collaborative support !

If you checkout the last 0.7.1 version, this bug should be solved.