Repository: the-tcpdump-group/tcpdump

Issue #559: CVE-2017-5483 Heap out of bounds read in v3msg_print()
Created: 2016-11-08T08:07:13Z
Heap out of bounds read in v3msg_print()
Tested on Git HEAD:  e2adb16
To reproduce: tcpdump -r oobr_v3msg_print.pcap

ASAN output:
==18266==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60600000f000 at pc 0x000000679249 bp 0x7ffcffbae230 sp 0x7ffcffbae228
READ of size 1 at 0x60600000f000 thread T0
    #0 0x679248 in v3msg_print XYZ/tcpdump/./print-snmp.c:1773:10
    #1 0x679248 in snmp_print XYZ/tcpdump/./print-snmp.c:1904
    #2 0x68ffdf in udp_print XYZ/tcpdump/./print-udp.c:566:4
    #3 0x58f360 in ip_print_demux XYZ/tcpdump/./print-ip.c:383:3
    #4 0x592006 in ip_print XYZ/tcpdump/./print-ip.c:648:3
    #5 0x566f7c in ethertype_print XYZ/tcpdump/./print-ether.c:325:10
    #6 0x566418 in ether_print XYZ/tcpdump/./print-ether.c:229:7
    #7 0x501b12 in pretty_print_packet XYZ/tcpdump/./print.c:339:18
    #8 0x4eebeb in print_packet XYZ/tcpdump/./tcpdump.c:2492:2
    #9 0x7adaf7 in pcap_offline_read XYZ/libpcap/./savefile.c:527:4
    #10 0x6b6f4c in pcap_loop XYZ/libpcap/./pcap.c:890:8
    #11 0x4ea1db in main XYZ/tcpdump/./tcpdump.c:1996:12
    #12 0x7fb6adc4c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #13 0x419ff8 in _start (/usr/local/sbin/tcpdump+0x419ff8)

0x60600000f000 is located 0 bytes to the right of 64-byte region [0x60600000efc0,0x60600000f000)
allocated by thread T0 here:
    #0 0x4b880c in malloc /home/development/llvm/3.9.0/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64:3
    #1 0x7af103 in pcap_check_header XYZ/libpcap/./sf-pcap.c:401:14
    #2 0x7acf22 in pcap_fopen_offline_with_tstamp_precision XYZ/libpcap/./savefile.c:400:7
    #3 0x7accaf in pcap_open_offline_with_tstamp_precision XYZ/libpcap/./savefile.c:307:6
    #4 0x7fb6adc4c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: heap-buffer-overflow XYZ/tcpdump/./print-snmp.c:1773:10 in v3msg_print
Shadow bytes around the buggy address:
  0x0c0c7fff9db0: 00 00 00 00 00 00 06 fa fa fa fa fa 00 00 00 00
  0x0c0c7fff9dc0: 00 00 06 fa fa fa fa fa 00 00 00 00 00 00 07 fa
  0x0c0c7fff9dd0: fa fa fa fa 00 00 00 00 00 00 07 fa fa fa fa fa
  0x0c0c7fff9de0: 00 00 00 00 00 00 07 fa fa fa fa fa fd fd fd fd
  0x0c0c7fff9df0: fd fd fd fd fa fa fa fa 00 00 00 00 00 00 00 00
=>0x0c0c7fff9e00:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9e50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==18266==ABORTING

Duplicate issue #566: Heap out of bounds read in community_print()
Created: 2016-11-08T08:37:36Z
Heap out of bounds read in community_print()
Tested on Git HEAD:  e2adb16
To reproduce: tcpdump -r oobr_community_print.pcap

ASAN output:
==32118==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60600000eff6 at pc 0x000000426002 bp 0x7ffdf4516390 sp 0x7ffdf4515b20
READ of size 4 at 0x60600000eff6 thread T0
    #0 0x426001 in __interceptor_strncmp /home/development/llvm/3.9.0/final/llvm.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:307:3
    #1 0x6773bf in community_print XYZ/tcpdump/./print-snmp.c:1603:6
    #2 0x6773bf in snmp_print XYZ/tcpdump/./print-snmp.c:1901
    #3 0x68ffdf in udp_print XYZ/tcpdump/./print-udp.c:566:4
    #4 0x58f360 in ip_print_demux XYZ/tcpdump/./print-ip.c:383:3
    #5 0x592006 in ip_print XYZ/tcpdump/./print-ip.c:648:3
    #6 0x566f7c in ethertype_print XYZ/tcpdump/./print-ether.c:325:10
    #7 0x566418 in ether_print XYZ/tcpdump/./print-ether.c:229:7
    #8 0x501b12 in pretty_print_packet XYZ/tcpdump/./print.c:339:18
    #9 0x4eebeb in print_packet XYZ/tcpdump/./tcpdump.c:2492:2
    #10 0x7adaf7 in pcap_offline_read XYZ/libpcap/./savefile.c:527:4
    #11 0x6b6f4c in pcap_loop XYZ/libpcap/./pcap.c:890:8
    #12 0x4ea1db in main XYZ/tcpdump/./tcpdump.c:1996:12
    #13 0x7f4ee003c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #14 0x419ff8 in _start (/usr/local/sbin/tcpdump+0x419ff8)

0x60600000eff6 is located 0 bytes to the right of 54-byte region [0x60600000efc0,0x60600000eff6)
allocated by thread T0 here:
    #0 0x4b880c in malloc /home/development/llvm/3.9.0/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64:3
    #1 0x7af103 in pcap_check_header XYZ/libpcap/./sf-pcap.c:401:14
    #2 0x7acf22 in pcap_fopen_offline_with_tstamp_precision XYZ/libpcap/./savefile.c:400:7
    #3 0x7accaf in pcap_open_offline_with_tstamp_precision XYZ/libpcap/./savefile.c:307:6
    #4 0x7f4ee003c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/development/llvm/3.9.0/final/llvm.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:307:3 in __interceptor_strncmp
Shadow bytes around the buggy address:
  0x0c0c7fff9da0: fa fa fa fa 00 00 00 00 00 00 04 fa fa fa fa fa
  0x0c0c7fff9db0: 00 00 00 00 00 00 06 fa fa fa fa fa 00 00 00 00
  0x0c0c7fff9dc0: 00 00 06 fa fa fa fa fa 00 00 00 00 00 00 07 fa
  0x0c0c7fff9dd0: fa fa fa fa 00 00 00 00 00 00 07 fa fa fa fa fa
  0x0c0c7fff9de0: 00 00 00 00 00 00 07 fa fa fa fa fa fd fd fd fd
=>0x0c0c7fff9df0: fd fd fd fd fa fa fa fa 00 00 00 00 00 00[06]fa
  0x0c0c7fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0c7fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==32118==ABORTING

Closing comment (2024-05-16T17:26:44Z): Duplicate of #559