Open mmguero opened 5 months ago
the bug does not appear to reproduce in my clang-compiled build-from-source images. I'm compiling my gcc image external to Malcolm to see if it reproduces there, which I assume it will because I don't know what would be different in that from the default packages.
Hmmm I'm having a difficult time reproducing it now outside of the Malcolm container, even building from source. Not sure why yet, I'll try to keep investigating.
It actually seems to go away if I remove other plugins that have nothing to do with bacnet. I'm thinking it's something memory related, but that it is a bug.
this parse_tag
function seems to be the issue, but I'm not sure about the input there that causes it yet.
Okay, if I install the other plugins and run it I get this error line:
1614578568.044456 error: string with embedded NUL: "\x00 ... \x00: 32776"
The length of that line is 124,927 bytes. The line of error output immediately before that is:
1614578546.628877 error: string with embedded NUL: "4.0\x00"
in both cases (in my instance where it crashes and instances where it doesn't. I'm pretty sure this is the input that's causing it to crash. Will this be enough information to address the bug and avoid the segfault?
I've attached bacnet_out.txt where you can see the error output on line 59.
zeek version 6.2.1 in Docker on Debian 12, with downloaded official Zeek .deb packages. Note that these are compiled with GCC (as are the plugins installed in the docker image), and I have not yet confirmed that the bug happens when compiled with clang, so if you are using some other docker images to test you may not encounter the bug. I'm reproducing it with this PCAP.
Note that in that image due to me setting some special capabilities on /opt/zeek/bin/zeek you'll run /opt/zeek/bin/zeek-offline but the binaries are identical.
I am trying to confirm if it only happens with GCC-compiled Zeek, and will post here when I know. I know there are some weird things in that BACnet traffic, maybe (see all the
error: string with embedded NUL: "SWITC\x0c\x00\x00\x09\x10\x1e"
-style errors) but either way it should handle them gracefully and not crash.