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 --xdpon a truncated capture read past it and transmitted heap contents on the wire (#1196) tcpreplay-editnow 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--dltand 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 testpasses 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
asanjob
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 --cachefilestops with "Exceeded number of packets in cache file" when the capture has more packets than the cache covers, astcpreplayalready did (#1184)tcpreplay-edit:--dualfilecaptures must share a link type to be edited, and a capture whose link type tcpedit has no plugin for is now an error, as intcprewrite(#1193)--user-dlinkrefuses (leaves unedited) a frame that would exceedMAXPACKET(#1182)
Other fixes
- tcpedit: ARP
--seedafter a--dltconversion 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-asanworks with clang (#1178) - test: the big-endian
rewrite_dltrawandrewrite_nanosecgolden files were little-endian copies, somake testfailed 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 testskips 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
- ci: add musl build and test workflow by @yegorich in #1172
- OSS-Fuzz: Add new fuzzer targets tcpedit operations by @arthurscchan in #1173
- fragroute: fix signed overflow in print's delay formatting by @tcpreplay-dev in #1175
- fragroute: free queued packets in fragroute_close() and between packets by @tcpreplay-dev in #1176
- fragroute: don't resolve hostnames in ip_opt/ip6_opt rules by @tcpreplay-dev in #1177
- build: fix libdnet include path and clang --enable-asan by @tcpreplay-dev in #1178
- fragroute: bound ip_add_option() inputs and getfragment() output by @tcpreplay-dev in #1179
- tcpedit: check L4 header lengths before reading or writing them by @tcpreplay-dev in #1180
- tcpedit: keep --fuzz-seed mutations inside the captured data by @tcpreplay-dev in #1181
- tcpedit: give every edit a MAXPACKET buffer by @tcpreplay-dev in #1182
- tcpedit: fix portmap parsing crashes and IPv6 prefix remapping by @tcpreplay-dev in #1183
- Bound flow_decode()'s IPv6 hop-by-hop read and tcprewrite's cache lookups by @tcpreplay-dev in #1184
- tcpedit: fix L2 offsets in ARP --seed and 802.11 protocol lookup by @tcpreplay-dev in #1191
- tcpreplay-edit: decode each capture with its own DLT by @tcpreplay-dev in #1193
- test: make the big-endian rewrite_dltraw and rewrite_nanosec goldens big-endian by @tcpreplay-dev in #1194
- 4.6.3: add CHANGELOG entry, CREDIT, bump version by @tcpreplay-dev in #1195
- AF_XDP: send only the captured bytes of a truncated packet by @fklassen in #1196
- ci: run the test workflow on pull requests by @fklassen in #1198
- Don't hand out unaligned pointers into packed structs (-Waddress-of-packed-member) by @tcpreplay-dev in #1213
- build: find libopts' <stdnoreturn.h> substitute on compilers without one by @tcpreplay-dev in #1214
- test: skip the nanosecond tests when libpcap lacks nanosecond support by @fklassen in #1215
New Contributors
- @arthurscchan made their first contribution in #1173
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