I believe there was a bug in BLE packet reassembly. Current code assumed L2CAP_Hdr will be after HCI_ACL_Hdr in incoming packet fragments, but this is not true. In the next fragments there can be any data which only sometimes will be interpreted by scapy as L2CAP. According to Wireshark's dissector actual fragment data starts after HCI_ACL_Hdr which I extracted using HCI_ACL_Hdr:][1:].
Also both reassembly if statements can be pulled into the conditional immediately after them.
I believe there was a bug in BLE packet reassembly. Current code assumed
L2CAP_Hdr
will be afterHCI_ACL_Hdr
in incoming packet fragments, but this is not true. In the next fragments there can be any data which only sometimes will be interpreted byscapy
asL2CAP
. According to Wireshark's dissector actual fragment data starts afterHCI_ACL_Hdr
which I extracted usingHCI_ACL_Hdr:][1:]
.Also both reassembly
if
statements can be pulled into the conditional immediately after them.