{"id":1553,"date":"2017-04-01T15:44:46","date_gmt":"2017-04-01T13:44:46","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=1553"},"modified":"2017-04-10T09:07:58","modified_gmt":"2017-04-10T07:07:58","slug":"libtiff-divide-by-zero-in-jpegsetupencode-tiff_jpeg-c","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2017\/04\/01\/libtiff-divide-by-zero-in-jpegsetupencode-tiff_jpeg-c\/","title":{"rendered":"libtiff: divide-by-zero in JPEGSetupEncode (tiff_jpeg.c)"},"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 crafted tiff can crash the library.<\/p>\n<p>The complete ASan output:<\/p>\n<pre><font size=\"2\"># tiffcp -i $FILE \/tmp\/out\r\n==28692==ERROR: AddressSanitizer: FPE on unknown address 0x7f03239af35b (pc 0x7f03239af35b bp 0x7ffc7923f730 sp 0x7ffc7923f600 T0)                                                                                                                                             \r\n    #0 0x7f03239af35a in JPEGSetupEncode \/tmp\/portage\/media-libs\/tiff-4.0.7\/work\/tiff-4.0.7\/libtiff\/tif_jpeg.c:1687:26                                                                                                                                                         \r\n    #1 0x7f0323a00312 in TIFFWriteEncodedTile \/tmp\/portage\/media-libs\/tiff-4.0.7\/work\/tiff-4.0.7\/libtiff\/tif_write.c:446:8                                                                                                                                                     \r\n    #2 0x510f06 in writeBufferToContigTiles \/tmp\/portage\/media-libs\/tiff-4.0.7\/work\/tiff-4.0.7\/tools\/tiffcp.c:1539:8                                                                                                                                                           \r\n    #3 0x50f1ce in cpImage \/tmp\/portage\/media-libs\/tiff-4.0.7\/work\/tiff-4.0.7\/tools\/tiffcp.c:1236:14                                                                                                                                                                           \r\n    #4 0x50dc1b in cpContigTiles2ContigTiles \/tmp\/portage\/media-libs\/tiff-4.0.7\/work\/tiff-4.0.7\/tools\/tiffcp.c:1673:9                                                                                                                                                          \r\n    #5 0x50c5b6 in tiffcp \/tmp\/portage\/media-libs\/tiff-4.0.7\/work\/tiff-4.0.7\/tools\/tiffcp.c:815:15                                                                                                                                                                             \r\n    #6 0x50c5b6 in main \/tmp\/portage\/media-libs\/tiff-4.0.7\/work\/tiff-4.0.7\/tools\/tiffcp.c:304                                                                                                                                                                                  \r\n    #7 0x7f0322a4661f in __libc_start_main \/var\/tmp\/portage\/sys-libs\/glibc-2.22-r4\/work\/glibc-2.22\/csu\/libc-start.c:289                                                                                                                                                        \r\n    #8 0x419f18 in _init (\/usr\/bin\/tiffcp+0x419f18)                                                                                                                                                                                                                            \r\n                                                                                                                                                                                                                                                                               \r\nAddressSanitizer can not provide additional info.                                                                                                                                                                                                                              \r\nSUMMARY: AddressSanitizer: FPE \/tmp\/portage\/media-libs\/tiff-4.0.7\/work\/tiff-4.0.7\/libtiff\/tif_jpeg.c:1687:26 in JPEGSetupEncode \r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n4.0.7<\/p>\n<p><strong>Fixed version:<\/strong><br \/>\nN\/A<\/p>\n<p><strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/vadz\/libtiff\/commit\/47f2fb61a3a64667bce1a8398a8fcb1b348ff122\">https:\/\/github.com\/vadz\/libtiff\/commit\/47f2fb61a3a64667bce1a8398a8fcb1b348ff122<\/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-7595<\/p>\n<p><strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00123-libtiff-fpe-JPEGSetupEncode\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00123-libtiff-fpe-JPEGSetupEncode<\/a><\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2017-01-04: bug 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 \/>\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=\"Vvvn3HzrfW\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2017\/04\/01\/libtiff-divide-by-zero-in-jpegsetupencode-tiff_jpeg-c\/\">libtiff: divide-by-zero in JPEGSetupEncode (tiff_jpeg.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\/2017\/04\/01\/libtiff-divide-by-zero-in-jpegsetupencode-tiff_jpeg-c\/embed\/#?secret=Vvvn3HzrfW\" data-secret=\"Vvvn3HzrfW\" width=\"600\" height=\"338\" title=\"&#8220;libtiff: divide-by-zero in JPEGSetupEncode (tiff_jpeg.c)&#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 crafted tiff can crash the library. The complete ASan output: # tiffcp -i $FILE \/tmp\/out ==28692==ERROR: &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2017\/04\/01\/libtiff-divide-by-zero-in-jpegsetupencode-tiff_jpeg-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-p3","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1553"}],"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=1553"}],"version-history":[{"count":4,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1553\/revisions"}],"predecessor-version":[{"id":1605,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1553\/revisions\/1605"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=1553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=1553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=1553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}