Skip to content
Memory corruption Disclosed report Intermediate CVE-2017-12985

CVE-2017-12985: The IPv6 parser in tcpdump before 4.9.2 has a buffer over-read in ip6_print()

The IPv6 parser in tcpdump before 4.9.2 has a buffer over-read in ip6_print(). A crafted packet capture file can trigger a heap-buffer-overflow read, crashing the program.

geeknik Follow

Originally disclosed on HackerOne

High 7.3 View original
  • Fixed in 3 months
  • Paid in 3 months
  • Disclosed after 2.1 years

Reported to the devs on 4 February 2017. Tcpdump 4.9.2 released on 8 September 2017. Patch: https://github.com/the-tcpdump-group/tcpdump/commit/66df248b49095c261138b5a5e34d341a6bf9ac7f

The IPv6 parser in tcpdump before 4.9.2 has a buffer over-read in print-ip6.c.

./tcpdump -nr test003
reading from file test003, link-type IPV6 (Raw IPv6)
=================================================================
==31276==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60400000e000 at pc 0x000000578cd5 bp 0x7ffe8e397cd0 sp 0x7ffe8e397cc8
READ of size 1 at 0x60400000e000 thread T0
    #0 0x578cd4 in ip6_print /root/tcpdump/./print-ip6.c:348:4
    #1 0x576fdc in ipN_print /root/tcpdump/./print-ip.c:700:3
    #2 0x626677 in raw_if_print /root/tcpdump/./print-raw.c:42:2
    #3 0x4de3c9 in pretty_print_packet /root/tcpdump/./print.c:339:18
    #4 0x4ccb0b in print_packet /root/tcpdump/./tcpdump.c:2555:2
    #5 0x775960 in pcap_offline_read /root/libpcap/./savefile.c:527:4
    #6 0x6a3f3c in pcap_loop /root/libpcap/./pcap.c:1623:8
    #7 0x4c8f1e in main /root/tcpdump/./tcpdump.c:2058:12
    #8 0x7efcfe253b44 in __libc_start_main /build/glibc-qK83Be/glibc-2.19/csu/libc-start.c:287
    #9 0x4c419c in _start (/root/tcpdump/tcpdump+0x4c419c)

0x60400000e000 is located 0 bytes to the right of 48-byte region [0x60400000dfd0,0x60400000e000)
allocated by thread T0 here:
    #0 0x4a6b1b in malloc (/root/tcpdump/tcpdump+0x4a6b1b)
    #1 0x7772b3 in pcap_check_header /root/libpcap/./sf-pcap.c:401:14
    #2 0x774fc2 in pcap_fopen_offline_with_tstamp_precision /root/libpcap/./savefile.c:400:7
    #3 0x774d54 in pcap_open_offline_with_tstamp_precision /root/libpcap/./savefile.c:307:6

SUMMARY: AddressSanitizer: heap-buffer-overflow /root/tcpdump/./print-ip6.c:348 ip6_print

The original report as published on HackerOne, by geeknik. 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 IPv6 parser does not properly validate the packet length before reading, causing an out-of-bounds read.

Impact

An attacker could cause a denial of service (crash) by triggering the out-of-bounds read.

What the attacker needed

Victim opens a crafted packet capture file

The fix

The issue was fixed in tcpdump 4.9.2.

How it was found

  1. Run tcpdump with the -nr options on a crafted file named test003.
  2. The program reads the file and triggers a heap-buffer-overflow in ip6_print.

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 reads network packets. A bug in how it reads IPv6 packets can make it read past the end of a memory buffer, which can crash the program when you open a malicious packet capture file.

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 geeknik

View all

79 more disclosed reports, 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.