appneta / tcpreplay

Pcap editing and replay tools for *NIX and Windows - Users please download source from
http://tcpreplay.appneta.com/wiki/installation.html#downloads
1.16k stars 268 forks source link

[Bug] Reachable assertion in get_layer4_v6 #717

Closed kdsjZh closed 1 year ago

kdsjZh commented 2 years ago

You are opening a bug report against the Tcpreplay project: we use GitHub Issues for tracking bug reports and feature requests.

If you have a question about how to use Tcpreplay, you are at the wrong site. You can ask a question on the tcpreplay-users mailing list or on Stack Overflow with [tcpreplay] tag. General help is available here.

If you have a build issue, consider downloading the latest release

Otherwise, to report a bug, please fill out the reproduction steps (below) and delete these introductory paragraphs. Thanks!

Describe the bug The assertion assert(ip6_hdr); in get_layer4_v6() at common/get.c is reachable when the user uses tcprewrite to open a crafted pcap file.

To Reproduce Steps to reproduce the behavior:

  1. export CC=clang && export CFLAGS="-fsanitize=address -g"
  2. ./autogen.sh && ./configure --disable-shared --disable-local-libopts && make clean && make -j8
  3. src/tcprewrite -o /dev/null -i POC output:
    Warning: tcprewrite/crash.0 was captured using a snaplen of 96 bytes.  This may mean you have truncated packets.
    tcprewrite: get.c:599: void *get_layer4_v6(const ipv6_hdr_t *, const int): Assertion `ip6_hdr' failed.
    Aborted

    Expected behavior Program reports assertion failure and is terminated.

Screenshots image

System (please complete the following information):

Credit Han Zheng NCNIPC of China Hexhive

kdsjZh commented 2 years ago

POC1.zip

fklassen commented 1 year ago

Fixed in PR #739. Added test for null pointer.