github appneta/tcpreplay v4.6.3

34 minutes ago

Tcpreplay 4.6.3 is a bugfix release. It fixes four more OSS-Fuzz findings in fragroute and a set of memory-safety bugs found by reviewing the code the fuzzers reach: tcpedit's header rewriting, flow statistics, the AF_XDP sender and tcprewrite --cachefile. It also fixes tcpreplay-edit decoding every capture as the output interface's link type, adds a musl CI job and an OSS-Fuzz target for tcpedit, and fixes building and running make test on big-endian and older platforms (verified on a big-endian PowerPC Debian guest).

Highlights

  • Four OSS-Fuzz findings fixed, all in fragroute: a signed overflow, a packet-queue leak that grew until it hit the fuzzer's memory limit (two reports), and a DNS lookup triggered by a hostname in a rules file
  • Memory-safety fixes across tcpedit, tcpreplay and tcprewrite, each reachable from a crafted pcap and the right options. The most serious: tcpreplay --xdp on a truncated capture read past it and transmitted heap contents on the wire (#1196)
  • tcpreplay-edit now decodes each capture with that capture's own link type, not the output interface's. Linux cooked (SLL), 802.11, raw IP and other non-Ethernet captures replayed onto an Ethernet interface were decoded as Ethernet, so --dlt and IP/port edits were skipped or misapplied (#1193)
  • New tcpedit fuzzer (#1173) and musl CI (#1172)
  • Older and big-endian platforms: builds with gcc older than 4.7 (#1214), no unaligned access on strict-alignment CPUs (#1213), and make test passes on big-endian hosts (#1194) and skips the nanosecond tests on libpcap older than 1.5 (#1215)
  • An ASan-checked regression test for every fix, run by CI's asan job

No new security advisories this cycle: these were found by OSS-Fuzz or by code review and fixed directly.

Continuous fuzzing: four issues found and fixed

Found by the OSS-Fuzz fuzz_fragroute target.

Finding Crash type Fix
timerntoa() in the print module (578324118) Integer overflow tv_sec * 1000000 was computed in time_t before widening; now done in uint64_t (#1175)
Packet queue never freed (579159805, 587231190) Out-of-memory fragroute_close() and fragroute_process() dropped queued packets without freeing them; with stacked ip_chaff/ip_frag rules the leak reached the fuzzer's 2.5 GB limit. Amplified by a 4.6.2 change that made each packet buffer larger (#1176)
Hostname in an ip_opt/ip6_opt rule (587772963) Abort (DNS lookup in sandbox) libdnet's addr_aton() falls back to gethostbyname(); addresses are now parsed as numeric only (#1177)

Memory-safety fixes from code review

Each was reproduced under AddressSanitizer on 4.6.2 with a crafted pcap and the listed options.

Area Options Fault PR
AF_XDP sender tcpreplay --xdp Copied the on-the-wire length, not the captured length: heap over-read, sent on the wire #1196
tcpreplay-edit --fixlen=pad, --enet-vlan=add Edited libpcap's own buffer in place and grew the packet past it #1182
tcpedit DLT_USER --dlt=user --user-dlink Grew a frame up to 233 bytes past MAXPACKET #1182
tcpedit checksums --fixcsum (IPv6) Checksummed the IPv6 payload length from the header, up to 64 KB past the capture #1180
tcpedit --fixlen, --mtu-trunc, --tcp-sequence, --seed/--pnat (IPv6) Wrote L4 header fields without checking the header was captured #1180
tcpedit portmap -r "-:80", -r "+:80", -r 0-65535:1,... NULL dereference on an empty range or list item; stack overflow freeing a large map #1183
tcpedit IPv6 remap --pnat/--srcipmap/--dstipmap with e.g. /33 Wrote up to ~240 bytes past the address; the remap was also wrong #1183
tcpedit --fuzz-seed --fuzz-seed Mutations ran past short payloads #1181
fragroute ip_opt, ip_chaff opt Negative memmove() size on an ip_len == 0 packet; oversized fragment overflowed the caller's buffer #1179
Flow statistics plain tcpreplay (on by default) 2-byte over-read on an IPv6 hop-by-hop header #1184
tcprewrite --cachefile Read past a cache file shorter than the capture #1184

Behavior changes

  • tcprewrite --cachefile stops with "Exceeded number of packets in cache file" when the capture has more packets than the cache covers, as tcpreplay already did (#1184)
  • tcpreplay-edit: --dualfile captures must share a link type to be edited, and a capture whose link type tcpedit has no plugin for is now an error, as in tcprewrite (#1193)
  • --user-dlink refuses (leaves unedited) a frame that would exceed MAXPACKET (#1182)

Other fixes

  • tcpedit: ARP --seed after a --dlt conversion located the ARP header with the input link type's L2 length, so the addresses were silently left unrandomized; the 802.11 SNAP header read is now bounded (#1191)
  • tcpedit: IPv6 prefixes that aren't a multiple of 8 bits now remap correctly with --pnat/--srcipmap/--dstipmap (#1183)
  • tcpedit: a portmap with an invalid entry after the first (80:81,+:82) is rejected instead of silently dropping that entry (#1183)
  • build: the libdnet include path is passed to tcpliveplay, examples/ and the fuzz/unit tests, so they build when libdnet isn't in a default path; --enable-asan works with clang (#1178)
  • test: the big-endian rewrite_dltraw and rewrite_nanosec golden files were little-endian copies, so make test failed them on big-endian hosts (#1194)
  • build: out-of-tree and CMake builds work with gcc older than 4.7, which lacks <stdnoreturn.h> (#1214)
  • fragroute, tcpedit: no more unaligned access to IPv4/IPv6 addresses, which could fault on strict-alignment CPUs (#1213)
  • test: make test skips the nanosecond tests with libpcap older than 1.5 instead of failing (#1215)
  • ci: the test workflow now runs on pull requests (#1198)
  • ci: musl (Alpine) build and test workflow (#1172)
  • fuzz: OSS-Fuzz target for tcpedit packet editing and portmap parsing (#1173)

Credits

Thanks to @yegorich for the musl CI workflow and to @arthurscchan for the tcpedit fuzz target. The fragroute fixes came from the OSS-Fuzz pipeline.

What's Changed

New Contributors

Verifying the download

The .tar.gz/.tar.xz tarballs are accompanied by detached PGP signatures (.asc), signed with the tcpreplay release key (tcpreplay@appneta.com, fingerprint 84E4FA215C934A7D97DC76D5E9E2149793BDE17E):

gpg --verify tcpreplay-4.6.3.tar.xz.asc tcpreplay-4.6.3.tar.xz

Full Changelog: v4.6.2...v4.6.3

Don't miss a new tcpreplay release

NewReleases is sending notifications on new releases.