Skip to content
Memory corruption Disclosed report

Heap buffer overflow in libstagefright (tx3g tag in mp4)

laf.intel Follow

Originally disclosed on Mozilla

  • Fixed in 13 hours
  • Paid in 33 days
  • Disclosed after 13 hours
Text
Created attachment 8592744
PoC of overflow

The MPEG4Extractor::parseChunk() (MPEG4Extractor.cpp) does not check for integer overflows when handling 'tx3g' tags which leads to a heap buffer overflow.

When 'chunk_size' is large (e.g. 0xffffffff) and 'size' is set a integer overflow can occur. This causes the allocation of a buffer which is smaller than 'size' (https://dxr.mozilla.org/mozilla-central/source/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp#1846). When memcpy is called the overflow occurs (https://dxr.mozilla.org/mozilla-central/source/media/libstagefright/frameworks/av/media/libstagefright/MPEG4Extractor.cpp#1849)

Attached is a PoC which will cause the said integer overflow and then overwrite data on the heap. Firefox does not necessarily crash on the first try. Reopen/reload the file multiple times untill the overflow overwrites some datastructure on the heap. Tested on mozilla-central build for Android on a Nexus 5.

The original report as published on Mozilla's Bugzilla, by laf.intel. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A high-severity memory corruption bug in Audio/Video. Mozilla made it public on 16 April 2015.

About Memory corruption

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by laf.intel

View all

3 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.