FoxIO-LLC / ja4

JA4+ is a suite of network fingerprinting standards
https://foxio.io
Other
774 stars 65 forks source link

Wireshark plugin segfaults Wireshark test suite #102

Closed Boolean263 closed 1 month ago

Boolean263 commented 1 month ago

This plugin causes two unexpected test failures in Wireshark's test suite, due to a pointer which can be used uninitialized causing a segmentation fault. Patch incoming.

To reproduce:

  1. Manually follow the steps of wireshark/build-scripts/linux_build.sh 4.2.0, but removing the -DBUILD_wireshark=off from the CMake command line, to build Wireshark 4.2.0 with the ja4 plugin
  2. Notice this warning during the build process:
    /.../wireshark-4.2.0/plugins/epan/ja4/packet-ja4.c: In function ‘dissect_ja4’:
    /.../wireshark-4.2.0/plugins/epan/ja4/packet-ja4.c:1113:86: warning: ‘packet_time’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  3. From the wireshark-4.2.0/build directory, run cmake --build . --target test-programs
  4. From the same directory, run python3 -m pytest . -k 'not sharkd'
  5. Observe the failed test cases (my results are here: test-output-4.2.0.txt)
  6. remove run/plugins/4.2/epan/ja4.so and repeat step 4, to see that the removal of the JA4 plugin causes the test suite to pass

(Step 4 needs -k 'not sharkd' because some sharkd-related test appears to hard-code a list of expected plugins, and fails when ja4 appears in the result.)