Closed Matir closed 6 years ago
Thanks for the comprehensive bug report, saved a lot of back and forth.
The assertion is definitely inappropriate. In BT 4.2 and lower, maximum advertising length was 48 bytes. The smart behavior is to truncate and move along as in PCAP. For equivalent behavior, this code path should truncate.
However, as of BT 5.0 advertising packets can be up to 255 bytes. Therefore the correct fix is to allow full length packets. Expect a fix shortly.
Try the long_packet branch of libbtbb and see if your captures look correct.
Sorry for the delay -- that branch definitely does allow capturing longer advertisements (seeing 53 octets), so it looks like it fixes this issue.
Would you be willing to share the ubertooth-btle output and a sample PcapNG with the long advertising packet? I haven't seen one in the wild and would like to make sure the rest of the toolchain supports it correctly. Totally understand if you can't share.
Sent directly to the email from which you committed the fix into libbtbb. Didn't want to post on Github.
On Sun, May 27, 2018 at 11:11 AM Mike Ryan notifications@github.com wrote:
Would you be willing to share the ubertooth-btle output and a sample PcapNG with the long advertising packet? I haven't seen one in the wild and would like to make sure the rest of the toolchain supports it correctly. Totally understand if you can't share.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/greatscottgadgets/ubertooth/issues/311#issuecomment-392351983, or mute the thread https://github.com/notifications/unsubscribe-auth/AAxYAFaF8qtOAxue_RCzhGyK1d8DXfG-ks5t2uxmgaJpZM4UPGmf .
-- David Tomaschik https://systemoverlord.com david@systemoverlord.com 7FD5 8D9A 196D CEEE AD67 1F94 F4D7 A791 5DEA 789B
Received and verified that the packet in question was the victim of bitflips, including the length field in the LL header. The assert behavior in libbtbb was not correct, so I will still merge the fix into libbtbb master. Thanks for reporting!
It's not clear to me if this is an ubertooth or libbtbb bug, but I decided to report it here. Sorry if it's wrong. (Since it only happens with the
le_phy
branch here, I decided it's more likely either a firmware or tool bug inubertooth
thanlibbtbb
.)Steps to reproduce
le_phy
branch.ubertooth-btle -rwatch_conn6.pcap -A37 -f -tE0:A0:30:C5:E8:58
Reproducible 100% with the device I'm testing against (and whatever else is in the area on BLE). The assert only occurs when writing to a pcap-ng file, writing to legacy pcap formats seems fine.
Expected behaviour
ubertooth-btle should not crash and should capture packets.
Actual behaviour
ubertooth-btle asserts and dumps core with message:
ubertooth-btle: /home/david/tmp/ble/libbtbb/lib/src/pcapng-bt.c:440: assemble_pcapng_le_packet: Assertion 'caplen <= LE_MAX_PAYLOAD' failed.
Version information
Operating system: Linux human 4.14.0-3-amd64 #1 SMP Debian 4.14.17-1 (2018-02-14) x86_64 GNU/Linux
Ubertooth tools version (ubertooth-rx -V): libubertooth 1.0 (git-84e3d01), libbtbb 1.0 (git-1b6084d)
libbtbb version: git-1b6084d
Ubertooth firmware version (ubertooth-util -v): ubertooth git-84e3d01 (david@human) Sat May 26 15:45:10 PDT 2018
Output
Backtrace and debugging data:
The raw lell_packet struct as passed into
lell_pcapng_append_packet
:And the contents of
pkt->symbols
in a hopefully useful format:In the case of PCAP files, it seems to be truncated instead of the assert on pcapng. Again, not sure if this is a bug in libbtbb or in ubertooth-btle, since ubertooth-btle is passing the data in and it's being handled by libbtbb.
I can provide a core file directly as needed, but would rather not attach one to GitHub. Also happy to try to provide as much debug info as I can and/or try patches.