{"id":1238,"date":"2017-02-09T15:38:56","date_gmt":"2017-02-09T13:38:56","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=1238"},"modified":"2017-02-14T11:31:59","modified_gmt":"2017-02-14T09:31:59","slug":"zziplib-out-of-bounds-read-in-zzip_mem_entry_new-memdisk-c","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2017\/02\/09\/zziplib-out-of-bounds-read-in-zzip_mem_entry_new-memdisk-c\/","title":{"rendered":"zziplib: out of bounds read in zzip_mem_entry_new (memdisk.c)"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"http:\/\/zziplib.sourceforge.net\/\">zziplib<\/a> is an intentionally lightweight library that offers the ability to easily extract data from files archived in a single zip file.<\/p>\n<p>A fuzz on it discovered an out of bounds read.<\/p>\n<p>The complete ASan output:<\/p>\n<pre><font size=\"2\"># unzzipcat-mem $FILE\r\n==7934==ERROR: AddressSanitizer: unknown-crash on address 0x7f439a704000 at pc 0x0000004bb815 bp 0x7fff911ebe30 sp 0x7fff911eb5e0\r\nREAD of size 59396 at 0x7f439a704000 thread T0\r\n    #0 0x4bb814 in __asan_memcpy \/tmp\/portage\/sys-devel\/llvm-3.9.0-r1\/work\/llvm-3.9.0.src\/projects\/compiler-rt\/lib\/asan\/asan_interceptors.cc:413\r\n    #1 0x7f439a3da299 in zzip_mem_entry_new \/tmp\/portage\/dev-libs\/zziplib-0.13.62-r1\/work\/zziplib-0.13.62\/zzip\/memdisk.c:210:13\r\n    #2 0x7f439a3da299 in zzip_mem_disk_load \/tmp\/portage\/dev-libs\/zziplib-0.13.62-r1\/work\/zziplib-0.13.62\/zzip\/memdisk.c:137\r\n    #3 0x7f439a3d98b7 in zzip_mem_disk_open \/tmp\/portage\/dev-libs\/zziplib-0.13.62-r1\/work\/zziplib-0.13.62\/zzip\/memdisk.c:89:5\r\n    #4 0x50982d in main \/tmp\/portage\/dev-libs\/zziplib-0.13.62-r1\/work\/zziplib-0.13.62\/bins\/unzzipcat-mem.c:82:12\r\n    #5 0x7f439951961f in __libc_start_main \/var\/tmp\/portage\/sys-libs\/glibc-2.22-r4\/work\/glibc-2.22\/csu\/libc-start.c:289\r\n    #6 0x419748 in _init (\/usr\/bin\/unzzipcat-mem+0x419748)\r\n\r\nAddressSanitizer can not describe address in more detail (wild memory access suspected).\r\nSUMMARY: AddressSanitizer: unknown-crash \/tmp\/portage\/sys-devel\/llvm-3.9.0-r1\/work\/llvm-3.9.0.src\/projects\/compiler-rt\/lib\/asan\/asan_interceptors.cc:413 in __asan_memcpy\r\nShadow bytes around the buggy address:\r\n  0x0fe8f34d87b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0fe8f34d87c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0fe8f34d87d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0fe8f34d87e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0fe8f34d87f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n=&gt;0x0fe8f34d8800:[fe]fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe\r\n  0x0fe8f34d8810: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe\r\n  0x0fe8f34d8820: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe\r\n  0x0fe8f34d8830: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe\r\n  0x0fe8f34d8840: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe\r\n  0x0fe8f34d8850: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe\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==7934==ABORTING\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n0.13.62<\/p>\n<p><strong>Fixed version:<\/strong><br \/>\nN\/A<\/p>\n<p><strong>Commit fix:<\/strong><br \/>\nN\/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-2017-5978<\/p>\n<p><strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00156-zziplib-oobread-zzip_mem_entry_new\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00156-zziplib-oobread-zzip_mem_entry_new<\/a><\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2017-01-17: bug discovered and poked upstream<br \/>\n2017-02-09: blog post about the issue<br \/>\n2017-02-13: CVE assigned<\/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><br \/>\nhttps:\/\/blogs.gentoo.org\/ago\/2017\/02\/09\/zziplib-out-of-bounds-read-in-zzip_mem_entry_new-memdisk-c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: zziplib is an intentionally lightweight library that offers the ability to easily extract data from files archived in a single zip file. A fuzz on it discovered an out of bounds read. The complete ASan output: # unzzipcat-mem $FILE &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2017\/02\/09\/zziplib-out-of-bounds-read-in-zzip_mem_entry_new-memdisk-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-jY","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1238"}],"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=1238"}],"version-history":[{"count":4,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1238\/revisions"}],"predecessor-version":[{"id":1341,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1238\/revisions\/1341"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=1238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=1238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=1238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}