{"id":648,"date":"2016-10-04T09:58:18","date_gmt":"2016-10-04T07:58:18","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=648"},"modified":"2016-12-01T15:54:47","modified_gmt":"2016-12-01T13:54:47","slug":"libdwarf-heap-based-buffer-overflow-in-_dwarf_get_abbrev_for_code-dwarf_util-c","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2016\/10\/04\/libdwarf-heap-based-buffer-overflow-in-_dwarf_get_abbrev_for_code-dwarf_util-c\/","title":{"rendered":"libdwarf: heap-based buffer overflow in _dwarf_get_abbrev_for_code (dwarf_util.c)"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"https:\/\/www.prevanders.net\/dwarf.html\">libdwarf<\/a> is a library to consume and produce DWARF debug information.<\/p>\n<p>A fuzzing revealed an out bounds read,<\/p>\n<p>The complete ASan output:<\/p>\n<pre><font size=\"2\"># dwarfdump $FILE\r\n==30323==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x611000005a00 at pc 0x000000606e87 bp 0x7ffe35e5e5b0 sp 0x7ffe35e5e5a8\r\nREAD of size 1 at 0x611000005a00 thread T0\r\n    #0 0x606e86 in _dwarf_get_abbrev_for_code \/tmp\/dwarf-20161001\/libdwarf\/dwarf_util.c:624:43\r\n    #1 0x576086 in dwarf_siblingof_b \/tmp\/dwarf-20161001\/libdwarf\/dwarf_die_deliv.c:1628:12\r\n    #2 0x517e73 in print_die_and_children_internal \/tmp\/dwarf-20161001\/dwarfdump\/print_die.c:1163:17\r\n    #3 0x517c6b in print_die_and_children_internal \/tmp\/dwarf-20161001\/dwarfdump\/print_die.c:1142:13\r\n    #4 0x5147cc in print_die_and_children \/tmp\/dwarf-20161001\/dwarfdump\/print_die.c:921:5\r\n    #5 0x5147cc in print_one_die_section \/tmp\/dwarf-20161001\/dwarfdump\/print_die.c:831\r\n    #6 0x512262 in print_infos \/tmp\/dwarf-20161001\/dwarfdump\/print_die.c:371:16\r\n    #7 0x4faaea in process_one_file \/tmp\/dwarf-20161001\/dwarfdump\/dwarfdump.c:1371:9\r\n    #8 0x4faaea in main \/tmp\/dwarf-20161001\/dwarfdump\/dwarfdump.c:654\r\n    #9 0x7f5912c2361f in __libc_start_main \/var\/tmp\/portage\/sys-libs\/glibc-2.22-r4\/work\/glibc-2.22\/csu\/libc-start.c:289\r\n    #10 0x419588 in _start (\/usr\/bin\/dwarfdump-asan+0x419588)\r\n\r\n0x611000005a00 is located 0 bytes to the right of 256-byte region [0x611000005900,0x611000005a00)\r\nallocated by thread T0 here:\r\n    #0 0x4c0ad8 in malloc \/var\/tmp\/portage\/sys-devel\/llvm-3.8.1-r2\/work\/llvm-3.8.1.src\/projects\/compiler-rt\/lib\/asan\/asan_malloc_linux.cc:52\r\n    #1 0x7f5913cfd206 in __libelf_set_rawdata_wrlock \/tmp\/portage\/dev-libs\/elfutils-0.166\/work\/elfutils-0.166\/libelf\/elf_getdata.c:318\r\n\r\nSUMMARY: AddressSanitizer: heap-buffer-overflow \/tmp\/dwarf-20161001\/libdwarf\/dwarf_util.c:624:43 in _dwarf_get_abbrev_for_code\r\nShadow bytes around the buggy address:\r\n  0x0c227fff8af0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd\r\n  0x0c227fff8b00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd\r\n  0x0c227fff8b10: fd fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n  0x0c227fff8b20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0c227fff8b30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n=&gt;0x0c227fff8b40:[fa]fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00\r\n  0x0c227fff8b50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0c227fff8b60: 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n  0x0c227fff8b70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0c227fff8b80: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa\r\n  0x0c227fff8b90: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00\r\nShadow byte legend (one shadow byte represents 8 application bytes):\r\n  Addressable:           00\r\n  Partially addressable: 01 02 03 04 05 06 07 \r\n  Heap left redzone:       fa\r\n  Heap right redzone:      fb\r\n  Freed heap region:       fd\r\n  Stack left redzone:      f1\r\n  Stack mid redzone:       f2\r\n  Stack right redzone:     f3\r\n  Stack partial redzone:   f4\r\n  Stack after return:      f5\r\n  Stack use after scope:   f8\r\n  Global redzone:          f9\r\n  Global init order:       f6\r\n  Poisoned by user:        f7\r\n  Container overflow:      fc\r\n  Array cookie:            ac\r\n  Intra object redzone:    bb\r\n  ASan internal:           fe\r\n  Left alloca redzone:     ca\r\n  Right alloca redzone:    cb\r\n==30323==ABORTING\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n20161001 and past<\/p>\n<p><strong>Fixed version:<\/strong><br \/>\n20161124<\/p>\n<p><strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/sourceforge.net\/p\/libdwarf\/code\/ci\/268c1f18d1d28612af3b72d7c670076b1b88e51c\/tree\/libdwarf\/dwarf_util.c?diff=0b28b923c3bd9827d1d904feed2abadde4fa5de2\">https:\/\/sourceforge.net\/p\/libdwarf\/code\/ci\/268c1f18d1d28612af3b72d7c670076b1b88e51c\/tree\/libdwarf\/dwarf_util.c?diff=0b28b923c3bd9827d1d904feed2abadde4fa5de2<\/a><\/p>\n<p><strong>Credit:<\/strong><br \/>\nThis bug was discovered by Agostino Sarubbo of Gentoo.<\/p>\n<p><strong>CVE:<\/strong><br \/>\nCVE-2016-8680<\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2016-10-03: bug discovered<br \/>\n2016-10-03: bug reported privately to upstream<br \/>\n2016-10-03: upstream released a patch<br \/>\n2016-10-04: blog post about the issue<br \/>\n2016-10-16: CVE Assigned<br \/>\n2016-11-24: upstream released 20161124<\/p>\n<p><strong>Note:<\/strong><br \/>\nThis bug was found with <a href=\"http:\/\/lcamtuf.coredump.cx\/afl\">American Fuzzy Lop<\/a>.<\/p>\n<p><strong>Permalink:<\/strong><\/p>\n<blockquote data-secret=\"6DpCkx0iXW\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2016\/10\/04\/libdwarf-heap-based-buffer-overflow-in-_dwarf_get_abbrev_for_code-dwarf_util-c\/\">libdwarf: heap-based buffer overflow in _dwarf_get_abbrev_for_code (dwarf_util.c)<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/blogs.gentoo.org\/ago\/2016\/10\/04\/libdwarf-heap-based-buffer-overflow-in-_dwarf_get_abbrev_for_code-dwarf_util-c\/embed\/#?secret=6DpCkx0iXW\" data-secret=\"6DpCkx0iXW\" width=\"600\" height=\"338\" title=\"&#8220;libdwarf: heap-based buffer overflow in _dwarf_get_abbrev_for_code (dwarf_util.c)&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: libdwarf is a library to consume and produce DWARF debug information. A fuzzing revealed an out bounds read, The complete ASan output: # dwarfdump $FILE ==30323==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x611000005a00 at pc 0x000000606e87 bp 0x7ffe35e5e5b0 sp 0x7ffe35e5e5a8 READ &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2016\/10\/04\/libdwarf-heap-based-buffer-overflow-in-_dwarf_get_abbrev_for_code-dwarf_util-c\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":140,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[12,10],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2EaBc-as","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/648"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/users\/140"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/comments?post=648"}],"version-history":[{"count":6,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/648\/revisions"}],"predecessor-version":[{"id":993,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/648\/revisions\/993"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}