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

CVE-2017-13038 The PPP parser in tcpdump before 4.9.2 has a buffer over-read in print-ppp.c:handle_mlppp().

The PPP parser in tcpdump before 4.9.2 has a buffer over-read in the handle_mlppp function. An attacker could cause a crash or potentially read out-of-bounds memory by supplying a crafted packet capture file.

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 11 June 2017. Tcpdump 4.9.2 released on 8 September 2017. Patch: https://github.com/the-tcpdump-group/tcpdump/commit/7335163a6ef82d46ff18f3e6099a157747241629

The PPP parser in tcpdump before 4.9.2 has a buffer over-read in print-ppp.c:handle_mlppp().

./tcpdump -nr test003
reading from file test003, link-type PPP_ETHER (PPPoE)
=================================================================
==20519==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xb5d006f8 at pc 0x082c8c68 bp 0xbf80a208 sp 0xbf80a1fc
READ of size 2 at 0xb5d006f8 thread T0
    #0 0x82c8c67 in EXTRACT_16BITS /root/tcpdump-4.9.0/./extract.h:151:20
    #1 0x82c8c67 in handle_mlppp /root/tcpdump-4.9.0/./print-ppp.c:814
    #2 0x82c8c67 in handle_ppp /root/tcpdump-4.9.0/./print-ppp.c:1462
    #3 0x82c1f87 in ppp_print /root/tcpdump-4.9.0/./print-ppp.c:1566:2
    #4 0x82cb232 in pppoe_print /root/tcpdump-4.9.0/./print-pppoe.c:195:26
    #5 0x82ca729 in pppoe_if_print /root/tcpdump-4.9.0/./print-pppoe.c:90:10
    #6 0x8172ac8 in pretty_print_packet /root/tcpdump-4.9.0/./print.c:339:18
    #7 0x8160678 in print_packet /root/tcpdump-4.9.0/./tcpdump.c:2501:2
    #8 0x843e96b in pcap_offline_read /root/libpcap-1.8.1/./savefile.c:527:4
    #9 0x835973c in pcap_loop /root/libpcap-1.8.1/./pcap.c:890:8
    #10 0x815bd9c in main /root/tcpdump-4.9.0/./tcpdump.c:2004:12
    #11 0xb752f275 in __libc_start_main /build/glibc-4LXvX6/glibc-2.24/csu/../csu/libc-start.c:291
    #12 0x8064dc7 in _start (/root/tcpdump-4.9.0/tcpdump+0x8064dc7)

0xb5d006f9 is located 0 bytes to the right of 9-byte region [0xb5d006f0,0xb5d006f9)
allocated by thread T0 here:
    #0 0x811e994 in malloc (/root/tcpdump-4.9.0/tcpdump+0x811e994)
    #1 0x843fcdc in pcap_check_header /root/libpcap-1.8.1/./sf-pcap.c:401:14
    #2 0x843dc55 in pcap_fopen_offline_with_tstamp_precision /root/libpcap-1.8.1/./savefile.c:400:7
    #3 0x843da38 in pcap_open_offline_with_tstamp_precision /root/libpcap-1.8.1/./savefile.c:307:6

SUMMARY: AddressSanitizer: heap-buffer-overflow /root/tcpdump-4.9.0/./extract.h:151:20 in EXTRACT_16BITS

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 code reads a 16-bit value without first checking that the packet buffer contains enough bytes.

Impact

An attacker could cause a heap buffer over-read, leading to a crash.

What the attacker needed

Crafted packet capture file; victim runs tcpdump on the 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 capture file.
  2. The file is read and the PPP parser processes a packet.
  3. The handle_mlppp function attempts to read 16 bits at the end of the buffer.

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. A bug in how it reads certain PPP packets could make it read past the end of a buffer, which might crash the program or leak memory contents. This only happens when processing a malicious 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.