{"id":1665,"date":"2017-04-27T21:32:31","date_gmt":"2017-04-27T19:32:31","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=1665"},"modified":"2017-04-30T11:07:43","modified_gmt":"2017-04-30T09:07:43","slug":"imageworsener-memory-allocation-failure-in-my_mallocfn-imagew-cmd-c","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2017\/04\/27\/imageworsener-memory-allocation-failure-in-my_mallocfn-imagew-cmd-c\/","title":{"rendered":"imageworsener: memory allocation failure in my_mallocfn (imagew-cmd.c)"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"https:\/\/github.com\/jsummers\/imageworsener\">imageworsener<\/a> is a utility for image scaling and processing.<\/p>\n<p>There is a memory allocation failure, I will show the interesting ASan output,<\/p>\n<pre><font size=\"2\"># imagew $FILE \/tmp\/out -outfmt bmp\r\n    #8 0x551fc0 in my_mallocfn \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-cmd.c:794:9\r\n    #9 0x7f37f140c9ae in iw_malloc_ex \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-util.c:48:8\r\n    #10 0x7f37f140cdec in iw_malloc_large \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-util.c:77:9\r\n    #11 0x7f37f136d66c in bmpr_read_uncompressed \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-bmp.c:665:32\r\n    #12 0x7f37f134ce64 in iwbmp_read_bits \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-bmp.c:910:7\r\n    #13 0x7f37f134ce64 in iw_read_bmp_file \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-bmp.c:980\r\n    #14 0x7f37f1349f94 in iw_read_file_by_fmt \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-allfmts.c:66:12\r\n    #15 0x519304 in iwcmd_run \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-cmd.c:1191:6\r\n    #16 0x515326 in iwcmd_main \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-cmd.c:3018:7\r\n    #17 0x515326 in main \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-cmd.c:3067\r\n    #18 0x7f37f035178f in __libc_start_main \/tmp\/portage\/sys-libs\/glibc-2.23-r3\/work\/glibc-2.23\/csu\/..\/csu\/libc-start.c:289\r\n    #19 0x41b028 in _init (\/usr\/bin\/imagew+0x41b028)\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n1.3.0<\/p>\n<p><strong>Fixed version:<\/strong><br \/>\n1.3.1<\/p>\n<p><strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/jsummers\/imageworsener\/commit\/86564051db45b466e5f667111ce00b5eeedc8fb6\">https:\/\/github.com\/jsummers\/imageworsener\/commit\/86564051db45b466e5f667111ce00b5eeedc8fb6<\/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-8327<\/p>\n<p><strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00276-imageworsener-memallocfailure\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00276-imageworsener-memallocfailure<\/a><\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2017-04-13: bug discovered and reported to upstream<br \/>\n2017-04-12: upstream released a patch for another issue that fixes this issue too<br \/>\n2017-04-27: blog post about the issue<br \/>\n2017-04-29: 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=\"8dPdS8yHyT\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2017\/04\/27\/imageworsener-memory-allocation-failure-in-my_mallocfn-imagew-cmd-c\/\">imageworsener: memory allocation failure in my_mallocfn (imagew-cmd.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\/27\/imageworsener-memory-allocation-failure-in-my_mallocfn-imagew-cmd-c\/embed\/#?secret=8dPdS8yHyT\" data-secret=\"8dPdS8yHyT\" width=\"600\" height=\"338\" title=\"&#8220;imageworsener: memory allocation failure in my_mallocfn (imagew-cmd.c)&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: imageworsener is a utility for image scaling and processing. There is a memory allocation failure, I will show the interesting ASan output, # imagew $FILE \/tmp\/out -outfmt bmp #8 0x551fc0 in my_mallocfn \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-cmd.c:794:9 #9 0x7f37f140c9ae in iw_malloc_ex \/tmp\/portage\/media-gfx\/imageworsener-1.3.0\/work\/imageworsener-1.3.0\/src\/imagew-util.c:48:8 #10 &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2017\/04\/27\/imageworsener-memory-allocation-failure-in-my_mallocfn-imagew-cmd-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-qR","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1665"}],"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=1665"}],"version-history":[{"count":6,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1665\/revisions"}],"predecessor-version":[{"id":1710,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1665\/revisions\/1710"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=1665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=1665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=1665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}