Skip to content
Memory corruption Disclosed report Intermediate CVE-2018-16229

Tcpdump before 4.9.3 has a buffer over-read in print-dccp.c:dccp_print_option() (CVE-2018-16229)

Tcpdump before 4.9.3 has a buffer over-read in the DCCP option printer, triggered when parsing a crafted packet capture file. An attacker could cause tcpdump to read past the end of a heap buffer, which the report claims leads to information disclosure and remote file modification.

bugbasher Follow

Originally disclosed on HackerOne

Bounty$500 Critical 9.8 View original
  • Paid in 3 months
  • Disclosed after 4 months

Tcpdump before 4.9.3 has a buffer over-read in print-dccp.c:dccp_print_option(). This vulnerability was disclosed to the tpcdump maintainers and was fixed in version 4.9.3 and disclosed as CVE-2018-16229.

I was credited with finding and disclosing this vulnerability: https://www.tcpdump.org/public-cve-list.txt

CVE-2018-16229,tcpdump,dccp_options-oobr.pcap,"Ryan Ackroyd",2018/05/26,Y,211124b972e74f0da66bc8b16f181f78793e2f66,4.9.3,,

This vulnerability was discovered in version 4.9.2 after compiling tcpdump with Address Sanitizer (ASAN) and fuzzing tcpdump with mutated packets. This vulnerability can be remotely exploited over the network by an attacker with no interaction needed from the victim.

I have attached test-case "fuzzer06:id:000018,sig:11,src:007353,op:havoc,rep:16" as a Proof of Concept to this report.

This vulnerability can be triggered using the following command:

tcpdump -e -vvvv -H -u -nn -r fuzzer06:id:000018,sig:11,src:007353,op:havoc,rep:16

The above command shows the following output from ASAN which notes this vulnerability as being a "heap-buffer-overflow":

reading from file fuzzer06:id:000018,sig:11,src:007353,op:havoc,rep:16, link-type EN10MB (Ethernet)
17:59:25.816632 00:07:e9:bd:5d:1f > 00:14:22:59:55:51, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 65312, offset 0, flags [DF], proto DCCP (33), length 52)
    139.133.209.176.39420 > 139.133.209.65.5001: DCCP (CCVal 0, CsCov 0, cksum 0xaaf3 (incorrect -> 0x8bf3)) DCCP-Request (service=-189888898) seq 8 <nop, nop, nop, nop, change_l ack_ratio 2, change_r ccid 2, change_l ccid 2>
15:27:00.817006 00:14:22:59:55:51 > 00:07:e9:bd:5d:1f, ethertype IPv4 (0x0800), length 82: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto DCCP (33), length 68)
    139.133.209.65.5001 > 139.133.209.176.39420: DCCP (CCVal 0, CsCov 0, ) DCCP-Response (service=0) (ack=38464816766) seq 1960341146 <nop, nop, change_l ack_ratio 2, [|dccp]>
15:27:00.817125 00:07:e9:bd:00:1f > 00:14:22:59:55:51, ethertype IPv4 (0x0800), length 32582: (tos 0x0, ttl 64, id 65313, offset 0, flags [DF], proto DCCP (33), length 56)
=================================================================
==5790==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4a01bf4 at pc 0x080fd4b6 bp 0xfff8c088 sp 0xfff8c078
READ of size 4 at 0xf4a01bf4 thread T0
    #0 0x80fd4b5 in EXTRACT_32BITS extract.h:190
    #1 0x80fd4b5 in dccp_print_option print-dccp.c:633
    #2 0x80fd4b5 in dccp_print print-dccp.c:496
    #3 0x816e21a in ip_print_demux print-ip.c:391
    #4 0x816e21a in ip_print print-ip.c:673
    #5 0x8124f70 in ethertype_print print-ether.c:333
    #6 0x8126065 in ether_print print-ether.c:236
    #7 0x80844b4 in pretty_print_packet print.c:332
    #8 0x8065ce8 in print_packet tcpdump.c:2497
    #9 0x83fcb6a in pcap_offline_read savefile.c:527
    #10 0x8346bfe in pcap_loop pcap.c:890
    #11 0x805afb8 in main tcpdump.c:2000
    #12 0xf6fda636 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18636)
    #13 0x806226a  (/home/user/targets/builds33/tcpdump-4.9.2/tcpdump+0x806226a)

0xf4a01bf6 is located 0 bytes to the right of 70-byte region [0xf4a01bb0,0xf4a01bf6)
allocated by thread T0 here:
    #0 0xf720edee in malloc (/usr/lib32/libasan.so.2+0x96dee)
    #1 0x8400752 in pcap_check_header sf-pcap.c:401

SUMMARY: AddressSanitizer: heap-buffer-overflow extract.h:190 EXTRACT_32BITS
Shadow bytes around the buggy address:
  0x3e940320: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e940330: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e940340: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e940350: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e940360: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x3e940370: fa fa fa fa fa fa 00 00 00 00 00 00 00 00[06]fa
  0x3e940380: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e940390: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e9403a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e9403b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e9403c0: 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
==5790==ABORTING

More information about this vulnerability can be found in the following locations:

NVD: https://nvd.nist.gov/vuln/detail/CVE-2018-16229 CVE: https://www.cvedetails.com/cve/CVE-2018-16229/ MITRE: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-16229

Impact

This vulnerability leads to significant information disclosure and allows an attacker to remotely modify system files. An attacker is easily able to exploit this vulnerability remotely across a network without interaction from the victim.

CVSS v3.1 Severity and Metrics:

Base Score: 9.8 CRITICAL Vector: AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (V3.1 legend) Impact Score: 5.9 Exploitability Score: 3.9

Attack Vector (AV): Network Attack Complexity (AC): Low Privileges Required (PR): None User Interaction (UI): None Scope (S): Unchanged Confidentiality (C): High Integrity (I): High Availability (A): High

The original report as published on HackerOne, by bugbasher. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the DCCP option parser does not check that enough bytes remain in the packet before reading a 32-bit value from the option data.

Impact

The report claims the over-read leads to significant information disclosure and allows an attacker to remotely modify system files, though the ASAN trace itself only shows a four-byte out-of-bounds read.

What the attacker needed

Tcpdump before 4.9.3; victim processes a crafted capture file

The fix

It was fixed in tcpdump 4.9.3.

How it was found

  1. Compile tcpdump 4.9.2 with Address Sanitizer.
  2. Fuzz tcpdump with mutated packets to produce a crashing capture file.
  3. Run tcpdump against the capture file with verbose DCCP decoding enabled.
  4. Observe the Address Sanitizer heap-buffer-overflow report in dccp_print_option.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Tcpdump is a tool that reads network packets and prints what is inside them. A buffer over-read means the program reads past the end of a memory area it was given, which can crash it or leak nearby data. Here a malformed DCCP packet in a capture file makes tcpdump read four bytes beyond a heap buffer.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by bugbasher

View all

1 more disclosed report, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.