{"id":2219,"date":"2017-09-14T12:35:19","date_gmt":"2017-09-14T10:35:19","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=2219"},"modified":"2017-09-22T09:07:42","modified_gmt":"2017-09-22T07:07:42","slug":"bento4-null-pointer-dereference-in-ap4_atomsettype-ap4atom-h","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2017\/09\/14\/bento4-null-pointer-dereference-in-ap4_atomsettype-ap4atom-h\/","title":{"rendered":"bento4: NULL pointer dereference in AP4_Atom::SetType (Ap4Atom.h)"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"https:\/\/www.bento4.com\/\">bento4<\/a> is a fast, modern, open source C++ toolkit for all your MP4 and MPEG DASH media format needs.<\/p>\n<p>The complete ASan output of the issue:<\/p>\n<pre><font size=\"2\"># mp42aac $FILE out.aac\r\nASAN:DEADLYSIGNAL\r\n=================================================================\r\n==23307==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x0000005c9865 bp 0x7fffd01b90d0 sp 0x7fffd01b9020 T0)\r\n==23307==The signal is caused by a WRITE memory access.\r\n==23307==Hint: address points to the zero page.\r\n    #0 0x5c9864 in AP4_Atom::SetType(unsigned int) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4Atom.h:247:52\r\n    #1 0x5c9864 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned int, unsigned int, unsigned long long, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:499\r\n    #2 0x5c7fbd in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned long long&amp;, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:220:14\r\n    #3 0x60c29f in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&amp;, AP4_ByteStream&amp;, unsigned long long) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:193:12\r\n    #4 0x575855 in AP4_SampleEntry::Read(AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4SampleEntry.cpp:115:9\r\n    #5 0x57d624 in AP4_VisualSampleEntry::AP4_VisualSampleEntry(unsigned int, unsigned int, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4SampleEntry.cpp:742:5\r\n    #6 0x57d624 in AP4_AvcSampleEntry::AP4_AvcSampleEntry(unsigned int, unsigned int, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4SampleEntry.cpp:994\r\n    #7 0x5cbf58 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned int, unsigned int, unsigned long long, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:305:24\r\n    #8 0x5c7fbd in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned long long&amp;, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:220:14\r\n    #9 0x586a2c in AP4_StsdAtom::AP4_StsdAtom(unsigned int, unsigned char, unsigned int, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4StsdAtom.cpp:100:13\r\n    #10 0x58566f in AP4_StsdAtom::Create(unsigned int, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4StsdAtom.cpp:56:16\r\n    #11 0x5ca71c in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned int, unsigned int, unsigned long long, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:422:20\r\n    #12 0x5c7fbd in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned long long&amp;, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:220:14\r\n    #13 0x60c29f in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&amp;, AP4_ByteStream&amp;, unsigned long long) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:193:12\r\n    #14 0x60b1d2 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:138:5\r\n    #15 0x60b1d2 in AP4_ContainerAtom::Create(unsigned int, unsigned long long, bool, bool, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:87\r\n    #16 0x5ca44c in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned int, unsigned int, unsigned long long, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:751:20\r\n    #17 0x5c7fbd in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned long long&amp;, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:220:14\r\n    #18 0x60c561 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&amp;, AP4_ByteStream&amp;, unsigned long long) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:193:12\r\n    #19 0x60b1d2 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:138:5\r\n    #20 0x60b1d2 in AP4_ContainerAtom::Create(unsigned int, unsigned long long, bool, bool, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:87\r\n    #21 0x5ca44c in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned int, unsigned int, unsigned long long, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:751:20\r\n    #22 0x5c7fbd in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned long long&amp;, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:220:14\r\n    #23 0x60c561 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&amp;, AP4_ByteStream&amp;, unsigned long long) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:193:12\r\n    #24 0x60b1d2 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:138:5\r\n    #25 0x60b1d2 in AP4_ContainerAtom::Create(unsigned int, unsigned long long, bool, bool, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:87\r\n    #26 0x5ca44c in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned int, unsigned int, unsigned long long, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:751:20\r\n    #27 0x5c7fbd in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned long long&amp;, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:220:14\r\n    #28 0x60c561 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&amp;, AP4_ByteStream&amp;, unsigned long long) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:193:12\r\n    #29 0x60c099 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:138:5\r\n    #30 0x58e6ed in AP4_TrakAtom::AP4_TrakAtom(unsigned int, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4TrakAtom.cpp:165:5\r\n    #31 0x5c8e3b in AP4_TrakAtom::Create(unsigned int, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4TrakAtom.h:58:20\r\n    #32 0x5c8e3b in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned int, unsigned int, unsigned long long, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:377\r\n    #33 0x5c7fbd in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned long long&amp;, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:220:14\r\n    #34 0x60c561 in AP4_ContainerAtom::ReadChildren(AP4_AtomFactory&amp;, AP4_ByteStream&amp;, unsigned long long) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:193:12\r\n    #35 0x60c099 in AP4_ContainerAtom::AP4_ContainerAtom(unsigned int, unsigned long long, bool, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4ContainerAtom.cpp:138:5\r\n    #36 0x5521b0 in AP4_MoovAtom::AP4_MoovAtom(unsigned int, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4MoovAtom.cpp:79:5\r\n    #37 0x5cad1d in AP4_MoovAtom::Create(unsigned int, AP4_ByteStream&amp;, AP4_AtomFactory&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4MoovAtom.h:56:20\r\n    #38 0x5cad1d in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned int, unsigned int, unsigned long long, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:357\r\n    #39 0x5c7fbd in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, unsigned long long&amp;, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:220:14\r\n    #40 0x5c75c0 in AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream&amp;, AP4_Atom*&amp;) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4AtomFactory.cpp:150:12\r\n    #41 0x54ea2c in AP4_File::ParseStream(AP4_ByteStream&amp;, AP4_AtomFactory&amp;, bool) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4File.cpp:104:12\r\n    #42 0x54f0fa in AP4_File::AP4_File(AP4_ByteStream&amp;, bool) \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4File.cpp:78:5\r\n    #43 0x542552 in main \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Apps\/Mp42Aac\/Mp42Aac.cpp:242:32\r\n    #44 0x7f048a8bf680 in __libc_start_main \/var\/tmp\/portage\/sys-libs\/glibc-2.23-r4\/work\/glibc-2.23\/csu\/..\/csu\/libc-start.c:289\r\n    #45 0x44f3f8 in _start (\/usr\/bin\/mp42aac+0x44f3f8)\r\n\r\nAddressSanitizer can not provide additional info.\r\nSUMMARY: AddressSanitizer: SEGV \/tmp\/Bento4-1.5.0-617\/Source\/C++\/Core\/Ap4Atom.h:247:52 in AP4_Atom::SetType(unsigned int)\r\n==23307==ABORTING\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n1.5.0-617<\/p>\n<p><strong>Fixed version:<\/strong><br \/>\nN\/A<\/p>\n<p><strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/axiomatic-systems\/Bento4\/commit\/be7185faf7f52674028977dcf501c6039ff03aa5\">https:\/\/github.com\/axiomatic-systems\/Bento4\/commit\/be7185faf7f52674028977dcf501c6039ff03aa5<\/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-14638<\/p>\n<p><strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00336-bento4-NULLptr-AP4_Atom_SetType\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00336-bento4-NULLptr-AP4_Atom_SetType<\/a><\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2017-09-08: bug discovered and reported to upstream<br \/>\n2017-09-14: blog post about the issue<br \/>\n2017-09-21: 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>.<br \/>\nThis bug was identified with bare metal servers donated by <a href=\"https:\/\/www.packet.net\/\">Packet<\/a>. This work is also supported by the <a href=\"https:\/\/www.coreinfrastructure.org\">Core Infrastructure Initiative<\/a>.<\/p>\n<p><strong>Permalink:<\/strong><\/p>\n<blockquote data-secret=\"nPF88uHmzP\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2017\/09\/14\/bento4-null-pointer-dereference-in-ap4_atomsettype-ap4atom-h\/\">bento4: NULL pointer dereference in AP4_Atom::SetType (Ap4Atom.h)<\/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\/09\/14\/bento4-null-pointer-dereference-in-ap4_atomsettype-ap4atom-h\/embed\/#?secret=nPF88uHmzP\" data-secret=\"nPF88uHmzP\" width=\"600\" height=\"338\" title=\"&#8220;bento4: NULL pointer dereference in AP4_Atom::SetType (Ap4Atom.h)&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: bento4 is a fast, modern, open source C++ toolkit for all your MP4 and MPEG DASH media format needs. The complete ASan output of the issue: # mp42aac $FILE out.aac ASAN:DEADLYSIGNAL ================================================================= ==23307==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2017\/09\/14\/bento4-null-pointer-dereference-in-ap4_atomsettype-ap4atom-h\/\">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-zN","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/2219"}],"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=2219"}],"version-history":[{"count":5,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/2219\/revisions"}],"predecessor-version":[{"id":2287,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/2219\/revisions\/2287"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=2219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=2219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=2219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}