{"id":1554,"date":"2017-04-01T16:01:33","date_gmt":"2017-04-01T14:01:33","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=1554"},"modified":"2017-05-24T12:04:22","modified_gmt":"2017-05-24T10:04:22","slug":"libtiff-multiple-ubsan-crashes","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2017\/04\/01\/libtiff-multiple-ubsan-crashes\/","title":{"rendered":"libtiff: multiple UBSAN crashes"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"http:\/\/libtiff.maptools.org\">Libtiff<\/a> is a software that provides support for the Tag Image File Format (TIFF), a widely used format for storing image data.<\/p>\n<p>A fuzz with the undefined behavior sanitizer revealed some crashes.<\/p>\n<pre><font size=\"2\"># tiffcp -i $FILE \/tmp\/foo\r\nruntime error: value 5.84589e+199 is outside the range of representable values\r\nof type 'float'\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n4.0.7<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/vadz\/libtiff\/commit\/3144e57770c1e4d26520d8abee750f8ac8b75490\">https:\/\/github.com\/vadz\/libtiff\/commit\/3144e57770c1e4d26520d8abee750f8ac8b75490<\/a><br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00113-libtiff-outside-float\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00113-libtiff-outside-float<\/a><br \/>\n<strong>CVE:<\/strong><br \/>\nCVE-2017-7596<\/p>\n<p>##################################################<\/p>\n<pre><font size=\"2\"># tiffcp -i $FILE \/tmp\/foo\r\ntif_dirread.c:2409:12: runtime error: value -4.779e+161 is outside the range of\r\nrepresentable values of type 'float'\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n4.0.7<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/vadz\/libtiff\/commit\/3144e57770c1e4d26520d8abee750f8ac8b75490\">https:\/\/github.com\/vadz\/libtiff\/commit\/3144e57770c1e4d26520d8abee750f8ac8b75490<\/a><br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00114-libtiff-outside-float-tif_dirread\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00114-libtiff-outside-float-tif_dirread<\/a><br \/>\n<strong>CVE:<\/strong><br \/>\nCVE-2017-7597<\/p>\n<p>##################################################<\/p>\n<pre><font size=\"2\"># tiffcp -i $FILE \/tmp\/foo\r\ntif_dirread.c:2878:24: runtime error: division by zero\r\ntif_dirread.c:2906:33: runtime error: division by zero\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n4.0.7<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/vadz\/libtiff\/commit\/3cfd62d77c2a7e147a05bd678524c345fa9c2bb8\">https:\/\/github.com\/vadz\/libtiff\/commit\/3cfd62d77c2a7e147a05bd678524c345fa9c2bb8<\/a><br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00115-libtiff-fpe-tif_dirread\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00115-libtiff-fpe-tif_dirread<\/a><br \/>\n<strong>CVE:<\/strong><br \/>\nCVE-2017-7598<\/p>\n<p>##################################################<\/p>\n<pre><font size=\"2\"># tiffcp -i $FILE \/tmp\/foo\r\nruntime error: value 65280 is outside the range of representable values of type 'short'\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n4.0.7<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/vadz\/libtiff\/commit\/3144e57770c1e4d26520d8abee750f8ac8b75490\">https:\/\/github.com\/vadz\/libtiff\/commit\/3144e57770c1e4d26520d8abee750f8ac8b75490<\/a><br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00117-libtiff-outside-short-tif_dirwrite\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00117-libtiff-outside-short-tif_dirwrite<\/a><br \/>\n<strong>CVE:<\/strong><br \/>\nCVE-2017-7599<\/p>\n<p>##################################################<\/p>\n<pre><font size=\"2\"># tiffcp -i $FILE \/tmp\/foo\r\nruntime error: value -115 is outside the range of representable values of type 'unsigned char'\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n4.0.7<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/vadz\/libtiff\/commit\/3144e57770c1e4d26520d8abee750f8ac8b75490\">https:\/\/github.com\/vadz\/libtiff\/commit\/3144e57770c1e4d26520d8abee750f8ac8b75490<\/a><br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00118-libtiff-outside-unsigned-char-tif_dirwrite\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00118-libtiff-outside-unsigned-char-tif_dirwrite<\/a><br \/>\n<strong>CVE:<\/strong><br \/>\nCVE-2017-7600<\/p>\n<p>##################################################<\/p>\n<pre><font size=\"2\"># tiffcp -i $FILE \/tmp\/foo\r\nruntime error: shift exponent 136 is too large for 64-bit type 'long'\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n4.0.7<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/vadz\/libtiff\/commit\/0a76a8c765c7b8327c59646284fa78c3c27e5490\">https:\/\/github.com\/vadz\/libtiff\/commit\/0a76a8c765c7b8327c59646284fa78c3c27e5490<\/a><br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00119-libtiff-shift-long-tif_jpeg\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00119-libtiff-shift-long-tif_jpeg<\/a><br \/>\n<strong>CVE:<\/strong><br \/>\nCVE-2017-7601<\/p>\n<p>##################################################<\/p>\n<pre><font size=\"2\"># tiffcp -i $FILE \/tmp\/foo\r\nruntime error: signed integer overflow: 9223372036452122640 + 85899345928\r\ncannot be represented in type 'long'\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n4.0.7<br \/>\n<strong>Fixed version:<\/strong><br \/>\nN\/A<br \/>\n<strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/vadz\/libtiff\/commit\/66e7bd59520996740e4df5495a830b42fae48bc4\">https:\/\/github.com\/vadz\/libtiff\/commit\/66e7bd59520996740e4df5495a830b42fae48bc4<\/a><br \/>\n<strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00121-libtiff-signintoverflow-tif_read\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00121-libtiff-signintoverflow-tif_read<\/a><br \/>\n<strong>CVE:<\/strong><br \/>\nCVE-2017-7602<\/p>\n<p>##################################################<\/p>\n<p><strong>Credit:<\/strong><br \/>\nThese bugs were discovered by Agostino Sarubbo of Gentoo.<\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2017-01-01: bugs discovered and reported to upstream<br \/>\n2017-01-11: upstream released a patch<br \/>\n2017-04-01: blog post about the issue<br \/>\n2017-04-09: 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=\"hcV5B9Lxmd\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2017\/04\/01\/libtiff-multiple-ubsan-crashes\/\">libtiff: multiple UBSAN crashes<\/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\/04\/01\/libtiff-multiple-ubsan-crashes\/embed\/#?secret=hcV5B9Lxmd\" data-secret=\"hcV5B9Lxmd\" width=\"600\" height=\"338\" title=\"&#8220;libtiff: multiple UBSAN crashes&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: Libtiff is a software that provides support for the Tag Image File Format (TIFF), a widely used format for storing image data. A fuzz with the undefined behavior sanitizer revealed some crashes. # tiffcp -i $FILE \/tmp\/foo runtime error: &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2017\/04\/01\/libtiff-multiple-ubsan-crashes\/\">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-p4","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1554"}],"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=1554"}],"version-history":[{"count":6,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1554\/revisions"}],"predecessor-version":[{"id":1848,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1554\/revisions\/1848"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=1554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=1554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=1554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}