{"id":1094,"date":"2017-01-16T12:40:25","date_gmt":"2017-01-16T10:40:25","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=1094"},"modified":"2017-01-25T18:02:39","modified_gmt":"2017-01-25T16:02:39","slug":"jasper-multiple-crashes-with-ubsan","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2017\/01\/16\/jasper-multiple-crashes-with-ubsan\/","title":{"rendered":"jasper: multiple crashes with UBSAN"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"http:\/\/www.ece.uvic.ca\/~frodo\/jasper\/\">jasper<\/a> is an open-source initiative to provide a free software-based reference implementation of the codec specified in the JPEG-2000 Part-1 standard.<\/p>\n<p>With the undefined behavior sanitizer enabled, jasper crashes showing some left shift and some signed integer overflow.<\/p>\n<p><strong>Affected version \/ Tested on:<\/strong><br \/>\n1.900.17<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\nN\/A<br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00017-jasper-leftshift-jas_math_h\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00017-jasper-leftshift-jas_math_h<\/a><br \/>\n<strong>Relevant part of the stacktrace:<\/strong><\/p>\n<pre><font size=\"2\"># imginfo -f $FILE\r\n\/tmp\/portage\/media-libs\/jasper-1.900.17\/work\/jasper-1.900.17\/src\/libjasper\/include\/jasper\/jas_math.h:156:11: runtime error: left shift of negative value -185\r\n<\/font><\/pre>\n<p><strong>CVE:<\/strong><br \/>\nCVE-2017-5498<\/p>\n<p>#################################################<\/p>\n<p><strong>Affected version \/ Tested on:<\/strong><br \/>\n1.900.17<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\nN\/A<br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00018-jasper-signedintoverflow-jpc_dec_c\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00018-jasper-signedintoverflow-jpc_dec_c<\/a><br \/>\n<strong>Relevant part of the stacktrace:<\/strong><\/p>\n<pre><font size=\"2\"># imginfo -f $FILE\r\n\/tmp\/portage\/media-libs\/jasper-1.900.17\/work\/jasper-1.900.17\/src\/libjasper\/jpc\/jpc_dec.c:1838:9: runtime error: signed integer overflow: -64356352 * 6359082673847140352 cannot be represented in type 'long'<\/font><\/pre>\n<p><strong>CVE:<\/strong><br \/>\nCVE-2017-5499<\/p>\n<p>#################################################<\/p>\n<p><strong>Affected version \/ Tested on:<\/strong><br \/>\n1.900.17<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\nN\/A<br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00019-jasper-leftshift-jpc_dec_c\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00019-jasper-leftshift-jpc_dec_c<\/a><br \/>\n<strong>Relevant part of the stacktrace:<\/strong><\/p>\n<pre><font size=\"2\"># imginfo -f $FILE\r\n\/tmp\/portage\/media-libs\/jasper-1.900.17\/work\/jasper-1.900.17\/src\/libjasper\/jpc\/jpc_dec.c:1819:40: runtime error: shift exponent 117 is too large for 64-bit type 'jpc_fix_t' (aka 'long')\r\n<\/font><\/pre>\n<p><strong>CVE:<\/strong><br \/>\nCVE-2017-5500<\/p>\n<p>#################################################<\/p>\n<p><strong>Affected version \/ Tested on:<\/strong><br \/>\n1.900.17<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\nN\/A<br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00022-jasper-signedintoverflow-jpc_tsfb_c\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00022-jasper-signedintoverflow-jpc_tsfb_c<\/a><br \/>\n<strong>Relevant part of the stacktrace:<\/strong><\/p>\n<pre><font size=\"2\"># imginfo -f $FILE\r\n\/tmp\/portage\/media-libs\/jasper-1.900.17\/work\/jasper-1.900.17\/src\/libjasper\/jpc\/jpc_tsfb.c:233:35: runtime error: signed integer overflow: 2013306369 + 251691968 cannot be represented in type 'int'\r\n<\/font><\/pre>\n<p><strong>CVE:<\/strong><br \/>\nCVE-2017-5501<\/p>\n<p>#################################################<\/p>\n<p><strong>Affected version \/ Tested on:<\/strong><br \/>\n1.900.17<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\nN\/A<br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00030-jasper-leftshift-jp2_dec_c\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00030-jasper-leftshift-jp2_dec_c<\/a><br \/>\n<strong>Relevant part of the stacktrace:<\/strong><\/p>\n<pre><font size=\"2\"># imginfo -f $FILE\r\n\/tmp\/portage\/media-libs\/jasper-1.900.17\/work\/jasper-1.900.17\/src\/libjasper\/jp2\/jp2_dec.c:485:49: runtime error: left shift of negative value -26\r\n<\/font><\/pre>\n<p><strong>CVE:<\/strong><br \/>\nCVE-2017-5502<\/p>\n<p><strong>Credit:<\/strong><br \/>\nThese bugs were discovered by Agostino Sarubbo of Gentoo.<\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2016-10-28: bug discovered and reported to upstream<br \/>\n2017-01-16: blog post about the issues<br \/>\n2017-01-17: CVE assigned<\/p>\n<p><strong>Note:<\/strong><br \/>\nThese bugs were found with <a href=\"http:\/\/lcamtuf.coredump.cx\/afl\">American Fuzzy Lop<\/a>.<\/p>\n<p><strong>Permalink:<\/strong><\/p>\n<blockquote data-secret=\"H0gcetEjgY\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2017\/01\/16\/jasper-multiple-crashes-with-ubsan\/\">jasper: multiple crashes with UBSAN<\/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\/01\/16\/jasper-multiple-crashes-with-ubsan\/embed\/#?secret=H0gcetEjgY\" data-secret=\"H0gcetEjgY\" width=\"600\" height=\"338\" title=\"&#8220;jasper: multiple crashes with UBSAN&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: jasper is an open-source initiative to provide a free software-based reference implementation of the codec specified in the JPEG-2000 Part-1 standard. With the undefined behavior sanitizer enabled, jasper crashes showing some left shift and some signed integer overflow. Affected &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2017\/01\/16\/jasper-multiple-crashes-with-ubsan\/\">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-hE","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1094"}],"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=1094"}],"version-history":[{"count":8,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1094\/revisions"}],"predecessor-version":[{"id":1156,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1094\/revisions\/1156"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=1094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=1094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=1094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}