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
381 stars 132 forks source link

Incorrect idx to SecurityHeaderType used for 5GMMHeaderSec of 5GMMSecProtNASMessage. #117

Closed eric-guanwy closed 3 years ago

eric-guanwy commented 3 years ago

Hi there. In the code of the class FGMMSecProtNASMessage, which is defined in pycrate_mobile/TS24501_FGMM.py, a wrong array index to 'SecHdr' be used in function encrypt/decrypt while the right index be used in function mac_verify/mac_compute, the correct index should be self[0][2], but self[0][0], which actually point to the EPD(Extended Protocol Discriminator) be used right now. It'll cause an invalid value exception just like below.

image

Thanks.

p1-bmu commented 3 years ago

This is fixed in https://github.com/P1sec/pycrate/commit/6b8691bfec1ce16851176260a34920e9952e23d5 Thanks for reporting