{"id":1759,"date":"2017-05-07T20:08:08","date_gmt":"2017-05-07T18:08:08","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=1759"},"modified":"2017-05-09T09:58:15","modified_gmt":"2017-05-09T07:58:15","slug":"lrzip-divide-by-zero-in-bufreadget-libzpaq-h","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2017\/05\/07\/lrzip-divide-by-zero-in-bufreadget-libzpaq-h\/","title":{"rendered":"lrzip: divide-by-zero in bufRead::get (libzpaq.h)"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"https:\/\/github.com\/ckolivas\/lrzip\">lrzip<\/a> is a compression utility that excels at compressing large files.<\/p>\n<p>The complete ASan output of the issue:<\/p>\n<pre><font size=\"2\"># lrzip -t $FILE\r\nDecompressing...\r\nASAN:DEADLYSIGNAL\r\n=================================================================\r\n==8026==ERROR: AddressSanitizer: FPE on unknown address 0x0000005e7957 (pc 0x0000005e7957 bp 0x7fcdf9ba58d0 sp 0x7fcdf9ba5870 T1)\r\n    #0 0x5e7956 in bufRead::get() \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/libzpaq\/libzpaq.h:468:41\r\n    #1 0x5856f1 in libzpaq::Decompresser::findBlock(double*) \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/libzpaq\/libzpaq.cpp:1236:21\r\n    #2 0x55f79a in libzpaq::decompress(libzpaq::Reader*, libzpaq::Writer*) \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/libzpaq\/libzpaq.cpp:1363:12\r\n    #3 0x55f4e2 in zpaq_decompress \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/libzpaq\/libzpaq.h:538:2\r\n    #4 0x54b3a4 in zpaq_decompress_buf \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/stream.c:453:2\r\n    #5 0x54b3a4 in ucompthread \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/stream.c:1534\r\n    #6 0x7fd33c0594a3 in start_thread \/tmp\/portage\/sys-libs\/glibc-2.23-r3\/work\/glibc-2.23\/nptl\/pthread_create.c:333\r\n    #7 0x7fd33b38466c in clone \/tmp\/portage\/sys-libs\/glibc-2.23-r3\/work\/glibc-2.23\/misc\/..\/sysdeps\/unix\/sysv\/linux\/x86_64\/clone.S:109                                                                             \r\n                                                                                                                                                                                                                  \r\nAddressSanitizer can not provide additional info.                                                                                                                                                                 \r\nSUMMARY: AddressSanitizer: FPE \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/libzpaq\/libzpaq.h:468:41 in bufRead::get()                                                                                      \r\nThread T1 created by T0 here:                                                                                                                                                                                     \r\n    #0 0x42d49d in pthread_create \/tmp\/portage\/sys-devel\/llvm-3.9.1-r1\/work\/llvm-3.9.1.src\/projects\/compiler-rt\/lib\/asan\/asan_interceptors.cc:245                                                                 \r\n    #1 0x53e70f in create_pthread \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/stream.c:133:6                                                                                                               \r\n    #2 0x53e70f in fill_buffer \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/stream.c:1673                                                                                                                   \r\n    #3 0x53e70f in read_stream \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/stream.c:1755                                                                                                                   \r\n    #4 0x5303e3 in read_u8 \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/runzip.c:55:6                                                                                                                       \r\n    #5 0x5303e3 in read_header \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/runzip.c:144                                                                                                                    \r\n    #6 0x5303e3 in runzip_chunk \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/runzip.c:314                                                                                                                   \r\n    #7 0x5303e3 in runzip_fd \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/runzip.c:382                                                                                                                      \r\n    #8 0x519b41 in decompress_file \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/lrzip.c:826:6                                                                                                               \r\n    #9 0x511074 in main \/tmp\/portage\/app-arch\/lrzip-0.631\/work\/lrzip-0.631\/main.c:669:4                                                                                                                           \r\n    #10 0x7fd33b2bd78f in __libc_start_main \/tmp\/portage\/sys-libs\/glibc-2.23-r3\/work\/glibc-2.23\/csu\/..\/csu\/libc-start.c:289                                                                                       \r\n                                                                                                                                                                                                                  \r\n==8026==ABORTING\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n0.631<\/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-8842<\/p>\n<p><strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00228-lrzip-fpe-bufRead-get\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00228-lrzip-fpe-bufRead-get<\/a><\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2017-03-24: bug discovered and reported to upstream<br \/>\n2017-05-07: blog post about the issue<br \/>\n2017-05-08: 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><\/p>\n<blockquote data-secret=\"MqMToSWdy9\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2017\/05\/07\/lrzip-divide-by-zero-in-bufreadget-libzpaq-h\/\">lrzip: divide-by-zero in bufRead::get (libzpaq.h)<\/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\/2017\/05\/07\/lrzip-divide-by-zero-in-bufreadget-libzpaq-h\/embed\/#?secret=MqMToSWdy9\" data-secret=\"MqMToSWdy9\" width=\"600\" height=\"338\" title=\"&#8220;lrzip: divide-by-zero in bufRead::get (libzpaq.h)&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: lrzip is a compression utility that excels at compressing large files. The complete ASan output of the issue: # lrzip -t $FILE Decompressing&#8230; ASAN:DEADLYSIGNAL ================================================================= ==8026==ERROR: AddressSanitizer: FPE on unknown address 0x0000005e7957 (pc 0x0000005e7957 bp 0x7fcdf9ba58d0 sp 0x7fcdf9ba5870 T1) &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2017\/05\/07\/lrzip-divide-by-zero-in-bufreadget-libzpaq-h\/\">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-sn","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1759"}],"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=1759"}],"version-history":[{"count":7,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1759\/revisions"}],"predecessor-version":[{"id":1794,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1759\/revisions\/1794"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=1759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=1759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=1759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}