{"id":752,"date":"2016-10-20T09:22:27","date_gmt":"2016-10-20T07:22:27","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=752"},"modified":"2016-12-01T16:07:39","modified_gmt":"2016-12-01T14:07:39","slug":"imagemagick-memory-allocation-failure-in-acquiremagickmemory-memory-c-incomplete-fix-for-cve-2016-8862","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2016\/10\/20\/imagemagick-memory-allocation-failure-in-acquiremagickmemory-memory-c-incomplete-fix-for-cve-2016-8862\/","title":{"rendered":"imagemagick: memory allocation failure in AcquireMagickMemory (memory.c) (incomplete fix for CVE-2016-8862)"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"http:\/\/www.imagemagick.org\/script\/index.php\">imagemagick<\/a> is a software suite to create, edit, compose, or convert bitmap images.<\/p>\n<p>Another round of fuzzing pointed out that the memory allocation failure I discovered is still reproducible in the 7.0.3.4 version.<br \/>\nAs usual, the upstream <a href=\"http:\/\/www.imagemagick.org\/script\/security-policy.php\">security policy<\/a> are enabled.<\/p>\n<p>The interesting part of the ASan stacktrace(not full because is a copy past of the one in the previous post):<\/p>\n<pre><font size=\"2\"># identify $FILE\r\n   #9 0x7f467fd11c67 in AcquireMagickMemory \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/MagickCore\/memory.c:460:10\r\n    #10 0x7f467fd11c67 in AcquireQuantumMemory \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/MagickCore\/memory.c:533\r\n    #11 0x7f4673379018 in ReadRLEImage \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/coders\/rle.c:267:36\r\n    #12 0x7f467faeca85 in ReadImage \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/MagickCore\/constitute.c:496:13\r\n    #13 0x7f467fff4def in ReadStream \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/MagickCore\/stream.c:1012:9\r\n    #14 0x7f467faeb69d in PingImage \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/MagickCore\/constitute.c:226:9\r\n    #15 0x7f467faebeae in PingImages \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/MagickCore\/constitute.c:326:10\r\n    #16 0x7f467f40f4da in IdentifyImageCommand \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/MagickWand\/identify.c:319:18\r\n    #17 0x7f467f48a844 in MagickCommandGenesis \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/MagickWand\/mogrify.c:183:14\r\n    #18 0x4f1fae in MagickMain \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/utilities\/magick.c:145:10\r\n    #19 0x4f1fae in main \/tmp\/portage\/media-gfx\/imagemagick-7.0.3.4\/work\/ImageMagick-7.0.3-4\/utilities\/magick.c:176\r\n    #20 0x7f467e35d61f in __libc_start_main \/var\/tmp\/portage\/sys-libs\/glibc-2.22-r4\/work\/glibc-2.22\/csu\/libc-start.c:289\r\n    #21 0x4192a8 in _init (\/usr\/bin\/magick+0x4192a8)\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n7.0.3.4<\/p>\n<p><strong>Fixed version:<\/strong><br \/>\n7.0.3.8<\/p>\n<p><strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/ImageMagick\/ImageMagick\/commit\/ab2c9d6a8dd6d71b161ec9cc57a588b116b52322\">https:\/\/github.com\/ImageMagick\/ImageMagick\/commit\/ab2c9d6a8dd6d71b161ec9cc57a588b116b52322<\/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-2016-8866<\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2016-10-13: bug re-discovered<br \/>\n2016-10-13: bug re-reported to upstream<br \/>\n2016-10-20: blog post about the issue<br \/>\n2016-10-21: CVE assigned<br \/>\n2016-11-21: upstream released a patch<br \/>\n2016-11-25: upstream released 7.0.3.8<\/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=\"vUwWqmTPgy\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2016\/10\/20\/imagemagick-memory-allocation-failure-in-acquiremagickmemory-memory-c-incomplete-fix-for-cve-2016-8862\/\">imagemagick: memory allocation failure in AcquireMagickMemory (memory.c) (incomplete fix for CVE-2016-8862)<\/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\/2016\/10\/20\/imagemagick-memory-allocation-failure-in-acquiremagickmemory-memory-c-incomplete-fix-for-cve-2016-8862\/embed\/#?secret=vUwWqmTPgy\" data-secret=\"vUwWqmTPgy\" width=\"600\" height=\"338\" title=\"&#8220;imagemagick: memory allocation failure in AcquireMagickMemory (memory.c) (incomplete fix for CVE-2016-8862)&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: imagemagick is a software suite to create, edit, compose, or convert bitmap images. Another round of fuzzing pointed out that the memory allocation failure I discovered is still reproducible in the 7.0.3.4 version. As usual, the upstream security policy &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2016\/10\/20\/imagemagick-memory-allocation-failure-in-acquiremagickmemory-memory-c-incomplete-fix-for-cve-2016-8862\/\">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-c8","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/752"}],"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=752"}],"version-history":[{"count":9,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/752\/revisions"}],"predecessor-version":[{"id":1007,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/752\/revisions\/1007"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}