{"id":783,"date":"2016-11-07T18:58:07","date_gmt":"2016-11-07T16:58:07","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=783"},"modified":"2017-04-29T15:45:17","modified_gmt":"2017-04-29T13:45:17","slug":"libming-listmp3-global-buffer-overflow-in-printmp3headers-listmp3-c","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2016\/11\/07\/libming-listmp3-global-buffer-overflow-in-printmp3headers-listmp3-c\/","title":{"rendered":"libming: listmp3: global-buffer-overflow in printMP3Headers (listmp3.c)"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"http:\/\/www.libming.org\">libming<\/a> is a Flash (SWF) output library. It can be used from PHP, Perl, Ruby, Python, C, C++, Java, and probably more on the way..<\/p>\n<p>A fuzzing revealed a global buffer overflow in listmp3. The bug does not reside in any shared object but if you have a web application that calls directly the listmp3 binary to parse untrusted mp3, then you are affected.<\/p>\n<p>The complete ASan output:<\/p>\n<pre><font size=\"2\"># listmp3 $FILE\r\n==29519==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000722e0c at pc 0x0000004f1a99 bp 0x7ffe42b1d7f0 sp 0x7ffe42b1d7e8\r\nREAD of size 4 at 0x000000722e0c thread T0\r\n    #0 0x4f1a98 in printMP3Headers \/var\/tmp\/portage\/media-libs\/ming-0.4.7\/work\/ming-0_4_7\/util\/listmp3.c:128:20\r\n    #1 0x4f1bee in main \/var\/tmp\/portage\/media-libs\/ming-0.4.7\/work\/ming-0_4_7\/util\/listmp3.c:191:3\r\n    #2 0x7fe262a4761f in __libc_start_main \/var\/tmp\/portage\/sys-libs\/glibc-2.22-r4\/work\/glibc-2.22\/csu\/libc-start.c:289\r\n    #3 0x418ae8 in getenv (\/usr\/bin\/listmp3+0x418ae8)\r\n\r\n0x000000722e0c is located 52 bytes to the left of global variable 'mp2_samplerate_table' defined in 'listmp3.c:44:5' (0x722e40) of size 12\r\n0x000000722e0c is located 0 bytes to the right of global variable 'mp1_samplerate_table' defined in 'listmp3.c:43:5' (0x722e00) of size 12\r\nSUMMARY: AddressSanitizer: global-buffer-overflow \/var\/tmp\/portage\/media-libs\/ming-0.4.7\/work\/ming-0_4_7\/util\/listmp3.c:128:20 in printMP3Headers\r\nShadow bytes around the buggy address:\r\n  0x0000800dc570: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0000800dc580: 00 00 00 00 00 00 00 00 00 00 00 04 f9 f9 f9 f9\r\n  0x0000800dc590: 00 00 00 00 00 00 00 04 f9 f9 f9 f9 00 00 00 00\r\n  0x0000800dc5a0: 00 00 00 04 f9 f9 f9 f9 00 00 00 00 00 00 00 04\r\n  0x0000800dc5b0: f9 f9 f9 f9 00 00 00 00 00 00 00 04 f9 f9 f9 f9\r\n=&gt;0x0000800dc5c0: 00[04]f9 f9 f9 f9 f9 f9 00 04 f9 f9 f9 f9 f9 f9\r\n  0x0000800dc5d0: 00 04 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00\r\n  0x0000800dc5e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0000800dc5f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0000800dc600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\n  0x0000800dc610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\r\nShadow byte legend (one shadow byte represents 8 application bytes):\r\n  Addressable:           00\r\n  Partially addressable: 01 02 03 04 05 06 07 \r\n  Heap left redzone:       fa\r\n  Heap right redzone:      fb\r\n  Freed heap region:       fd\r\n  Stack left redzone:      f1\r\n  Stack mid redzone:       f2                                                                                                                                                                                                                                                  \r\n  Stack right redzone:     f3                                                                                                                                                                                                                                                  \r\n  Stack partial redzone:   f4                                                                                                                                                                                                                                                  \r\n  Stack after return:      f5                                                                                                                                                                                                                                                  \r\n  Stack use after scope:   f8                                                                                                                                                                                                                                                  \r\n  Global redzone:          f9                                                                                                                                                                                                                                                  \r\n  Global init order:       f6                                                                                                                                                                                                                                                  \r\n  Poisoned by user:        f7                                                                                                                                                                                                                                                  \r\n  Container overflow:      fc                                                                                                                                                                                                                                                  \r\n  Array cookie:            ac                                                                                                                                                                                                                                                  \r\n  Intra object redzone:    bb                                                                                                                                                                                                                                                  \r\n  ASan internal:           fe                                                                                                                                                                                                                                                  \r\n  Left alloca redzone:     ca                                                                                                                                                                                                                                                  \r\n  Right alloca redzone:    cb                                                                                                                                                                                                                                                  \r\n==29519==ABORTING                                                                                                                                                                                                                                                              \r\nframe 1: MP25 layer 1, 8000 Hz, 0kbps, mono, length=0, protect off\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n0.4.7<\/p>\n<p><strong>Fixed version:<\/strong><br \/>\n0.4.8<\/p>\n<p><strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/libming\/libming\/commit\/19e7127e29122be571c87bfb90bca9581417d220\">https:\/\/github.com\/libming\/libming\/commit\/19e7127e29122be571c87bfb90bca9581417d220<\/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-9264<\/p>\n<p><strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00034-libming-globaloverflow-printMP3Headers\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00034-libming-globaloverflow-printMP3Headers<\/a><\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2016-08-13: bug discovered<br \/>\n2016-10-20: bug reported to upstream<br \/>\n2016-11-07: blog post about the issue<br \/>\n2016-11-10: CVE assigned<br \/>\n2017-01-30: upstream released a patch<br \/>\n2017-04-07: upstream released 0.4.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=\"N6erzjTfep\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2016\/11\/07\/libming-listmp3-global-buffer-overflow-in-printmp3headers-listmp3-c\/\">libming: listmp3: global-buffer-overflow in printMP3Headers (listmp3.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\/2016\/11\/07\/libming-listmp3-global-buffer-overflow-in-printmp3headers-listmp3-c\/embed\/#?secret=N6erzjTfep\" data-secret=\"N6erzjTfep\" width=\"600\" height=\"338\" title=\"&#8220;libming: listmp3: global-buffer-overflow in printMP3Headers (listmp3.c)&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: libming is a Flash (SWF) output library. It can be used from PHP, Perl, Ruby, Python, C, C++, Java, and probably more on the way.. A fuzzing revealed a global buffer overflow in listmp3. The bug does not reside &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2016\/11\/07\/libming-listmp3-global-buffer-overflow-in-printmp3headers-listmp3-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-cD","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/783"}],"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=783"}],"version-history":[{"count":8,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/783\/revisions"}],"predecessor-version":[{"id":1694,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/783\/revisions\/1694"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}