Skip to content

v4.6.2

Latest

Choose a tag to compare

@fklassen fklassen released this 26 Oct 02:04
v4.6.2
3b1d78b

Tcpreplay 4.6.2 is a bugfix release. It fixes six more issues found by the OSS-Fuzz fuzzing added in 4.6.1 — all in fragroute — along with a --pps regression that made -T select replay at full speed, and build fixes for musl, uClibc, cross compiling and macOS.

Highlights

  • Six OSS-Fuzz findings fixed, all in the fragroute module chain: two NULL dereferences, a wild read, a negative memmove() size, a leak, and double frees of a module's random-number handle. No new security advisories this cycle
  • --pps works with -T select again — a timespec-to-timeval conversion in select_sleep() was backwards, so the sleep was always zero and rate-limited replays ran at top speed. Present since 4.5.0
  • fragroute ip_opt and tcp_opt now actually add options — the packet buffer left no room for libdnet to grow the packet, so both silently did nothing
  • Builds on musl and uClibc, and --with-tcpdump / -DWITH_TCPDUMP now work when cross compiling

Continuous fuzzing: six issues found and fixed

Found by the OSS-Fuzz pipeline introduced in 4.6.1 (fuzz_fragroute). Two of them (545925319, 545818605) are follow-ups to 4.6.1 fixes for the same issue ids.

Finding Crash type Fix
ip_opt_apply() after a rebuilt packet no longer parses (576377476) Null dereference pkt_decorate() leaves pkt_ip NULL when the rebuilt IP header no longer fits (e.g. stacked ip_opt rules), and ip_checksum() dereferenced it
ip_tos_apply() on a packet that didn't fully parse (545925319) Wild read pkt_decorate() returns early with pkt_ip_data NULL on an overlong IP length or a fragment; the checksum length pkt_ip_data - pkt_eth_data was then a huge bogus value
mod_close() leaked every rule (545818605) Direct memory leak 4.6.1 wired up mod_close(), which unlinked each rule but never freed the struct rule from mod_open()
tcp_opt on a non-TCP or malformed packet (547161248) Negative-size-param libdnet's ip_add_option() reads th_off from whatever follows the IP header, so a UDP packet or random payload made its shift length negative. tcp_opt now checks for a valid TCP header first
ip_frag and tcp_seg double free (547186627, 547151403) Heap double free Both keep their rand_t in a static struct and freed it in open() and close() without clearing the pointer. The open() close was added in 4.6.1 (the leak fix), so this regressed in 4.6.1 only

Other fixes

  • fragroute: ip_opt and tcp_opt never added an option — pkt_buf_size was the packet's length rather than the allocation's, leaving no room for ip_add_option(). It now reserves room for IP and TCP options (#1163)
  • fragroute: a failed ip_opt/tcp_opt truncated the packet by one byte — the ssize_t error return was kept in a size_t and added to the packet end (#1159, #1162)
  • fragroute: tcp_opt wscale wrote an option length of 4 instead of 3 (#1164)
  • fragroute: tcp_chaff paws wrote its option past the end of the duplicate's buffer, a heap overflow on IPv4 and IPv6 (#1165)
  • fragroute: ip_chaff opt leaked the duplicate packet on IPv6, and tcp_chaff paws computed a negative length when th_off was below 5 (#1165, #1166)
  • fragroute: ip_chaff <ttl> set the IPv6 hop limit on the original packet instead of the duplicate (#1166)
  • build: look for fts_read() in libfts on musl and uClibc (#1153)
  • build: --with-tcpdump / -DWITH_TCPDUMP are trusted when cross compiling; --without-tcpdump and -DWITH_TCPDUMP=no/OFF skip the host lookup (#1152, #1167, #1168, #1169)
  • build: fix txring.h on musl, where <linux/if_ether.h> clashed with <netinet/if_ether.h> (#1154)
  • build: fix clang warnings on macOS — -Waddress-of-packed-member in the checksum helpers, RAND_MAX float conversion, and a libopts false positive (#1155)
  • community: CONTRIBUTING.md, CODE_OF_CONDUCT.md, issue forms and a PR template; LICENSE moved to the repo root (#1145, #1146, #1147, #1149)

Credits

Thanks to @gbritoda for reporting the --pps regression, to @GabrielGanne for the fix, and to @yegorich for the musl, uClibc and cross-compile build fixes. 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.2.tar.xz.asc tcpreplay-4.6.2.tar.xz

Full Changelog: v4.6.1...v4.6.2