-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heap overflow in get_next_packet() #484
Comments
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-17582 was assigned for this issue |
I don't think the analysis is correct. This has nothing to do with null destination pointer ( IMHO the actual problem here is a buffer overflow on read because of unrealistic value of After all, it does not make much sense to replay packets if we only have leading parts of them. We might perhaps fill the missing part with zeros or random content but that would mostly result in incorrect checksums. |
I agree with @mkubecek in that the original analysis is incorrect. There is a check for the condition where That said, there can be additional checks for cases where By adding checks to all calls to |
* Check for packets that are larger than 262144 bytes * Check for capture lengths that are greater than packet length Example of a corrupt PCAP file ... sudo src/tcpreplay -i ens33 --unique-ip -t --loop 4 get_next_paket_01 safe_pcap_next ERROR: Invalid packet length in send_packets.c:get_next_packet() line 1054: 8388670 is greater than maximum 262144
…packet Bug #484 CVE-2018-17582 Check for corrupt PCAP files
fixed in PR #491 |
Also added check for packet size > cap len, although this may be never be hit since #484
* Enhancement_#493_codacy_fixes: (26 commits) Enhancement #493 - fixes for Codacy identified issues Bug #486 Enforce max snaplen rather than doing realloc Bug #486 CVE-2018-17974 realloc memory if packet size increases Bug #484 CVE-2018-17582 Check for corrupt PCAP files 4.3 - revert travis updates from merge Remove dead code resolve possible null pointer dereference travis-ci: add autogen package Bug #461 build warnings (#462) #412 fix gcc 6.3 compiler warning #421 fix ms to ns conversion Bug #423 remove commented code Bug #423 Remove limit for tcpprep -S Bug #398 Rewrite of tcpdump.c (#457) Bug #402 memset dlt radiotap get 80211 (#454) #404 fix check_list return values (#453) #406 fix zero-length IP headers #416 apply STDIN restore to all programs #416 fix compile issue introduced by downstream PR #416 update CHANGELOG [ci skip] ...
* Bug #486 CVE-2018-17974 realloc memory if packet size increases Also added check for packet size > cap len, although this may be never be hit since #484 * Bug #486 Enforce max snaplen rather than doing realloc * increase MAX_SNAPLEN from 65535 to 262144 * increase MAXPACKET from 65549 to 262158 * exit on buffer overflow for adding VLAN tag (as opposed to realloc)
Getting the following error message when attempting to reproduce bug: tcpreplay -i ens33 --unique-ip -t --loop 4 fast_edit_package_02 safe_pcap_next ERROR: Invalid packet length in send_packets.c:get_next_packet() line 1054: packet length 28 is less than capture length 60
* 4.3: (22 commits) Bug #418 don't ignore 2nd packet timing Bug #411 allow TAP on all platforms Bug #174 ensure --with-testnic does not affect replay Bug #406 change packet length to network order Bug #413 fix manpage typos Bug #485 Heap overflow fixed in #484 Enhancement_#482 update CHANGELOG/CREDITS Enhancement_#482 test Makefile merge error fixup Enhancement_#482 test Makefile cleanup Bug #489 free after memcpy Bug #488 heap overflow csum replace4 (#496) Bug #486 CVE-2018-17974 realloc memory if packet size increases (#492) Enhancement #493 - fixes for Codacy identified issues Bug #486 Enforce max snaplen rather than doing realloc Bug #486 CVE-2018-17974 realloc memory if packet size increases Bug #484 CVE-2018-17582 Check for corrupt PCAP files 4.3 - revert travis updates from merge Simplify plugin Makefiles allow out-of-tree build Remove dead code ...
…ging * 4.3: (36 commits) Enhancement #506 disable C99 and fix warnings (#507) Bug #418 don't ignore 2nd packet timing Bug #411 allow TAP on all platforms Bug #174 ensure --with-testnic does not affect replay Bug #406 change packet length to network order Bug #413 fix manpage typos Bug #485 Heap overflow fixed in #484 Enhancement_#482 update CHANGELOG/CREDITS Enhancement_#482 test Makefile merge error fixup Enhancement_#482 test Makefile cleanup Bug #489 free after memcpy Bug #488 heap overflow csum replace4 (#496) Bug #486 CVE-2018-17974 realloc memory if packet size increases (#492) Enhancement #493 - fixes for Codacy identified issues Bug #486 Enforce max snaplen rather than doing realloc Bug #486 CVE-2018-17974 realloc memory if packet size increases Bug #484 CVE-2018-17582 Check for corrupt PCAP files 4.3 - revert travis updates from merge Simplify plugin Makefiles allow out-of-tree build ...
tcpreplay contains a heap-based buffer overflow vulnerability. The
get_next_packet()
function in thesend_packets.c
file uses thememcpy()
function to copy sequences from the source bufferpktdata
to the destination(*prev_packet)->pktdata
. However, there are no checks in place to ensure thatdst
is a non-zero value. An attacker can exploit this vulnerability by submitting a malicious file that exploits this issue. This will result in a Denial of Service (DoS) and potentially Information Exposure when the application attempts to process the file.Affected version:
4.3 branch
Command:
sudo tcpreplay -i eno1 -t -K --loop 4 --unique-ip $POC
Debugging
ASAN output
Valgrind report
Please check if you are able to reproduce the issue via the Reproducer file
The text was updated successfully, but these errors were encountered: