Skip to content
Memory corruption Disclosed report CVE-2016-2812

Service Worker - Buffer overflow in get()

Looben Yang Follow

Originally disclosed on Mozilla

  • Fixed in 3 days
  • Paid in 4 days
  • Disclosed after 3 days

Created attachment 8737721 BOF_Get_Repro.zip

Steps to reproduce:

(unzip BOF_Get_Repro.zip, keep BOF_Get_Repro.js, mainpage.html, svcworker0.js and svcworker2.js in the same folder)

  1. Run server side script BOF_Get_Repro.js in Node.js (node BOF_Get_Repro.js ).
  2. Enter http://localhost:12345 in Firefox asan build.
  3. Asan reports a buffer overflow in get().

Firefox version: 48.0a1 (2016-03-26)

================================================================= ==906==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7f0de0f9ea08 at pc 0x7f0dd8a7fe8e bp 0x7fff962b7550 sp 0x7fff962b7548 READ of size 8 at 0x7f0de0f9ea08 thread T0 #0 0x7f0dd8a7fe8d in get /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:261 #1 0x7f0dd8a7fe8d in operator[] /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:555 #2 0x7f0dd8a7fe8d in Done /builds/slave/m-cen-l64-asan-000000000000000/build/src/dom/workers/ServiceWorkerManager.cpp:320 #3 0x7f0dd8a7fe8d in Done /builds/slave/m-cen-l64-asan-000000000000000/build/src/dom/workers/ServiceWorkerManager.cpp:400 #4 0x7f0dd8a7fe8d in mozilla::dom::workers::ServiceWorkerInstallJob::ContinueAfterInstallEvent(bool) /builds/slave/m-cen-l64-asan-000000000000000/build/src/dom/workers/ServiceWorkerManager.cpp:1221 #5 0x7f0dd8ac07d8 in mozilla::dom::workers::ContinueLifecycleRunnable::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/dom/workers/ServiceWorkerManager.cpp:702 #6 0x7f0dd3113710 in nsThread::ProcessNextEvent(bool, bool*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/threads/nsThread.cpp:994 #7 0x7f0dd318ceba in NS_ProcessNextEvent(nsIThread*, bool) /builds/slave/m-cen-l64-asan-000000000000000/build/src/xpcom/glue/nsThreadUtils.cpp:297 #8 0x7f0dd3b37d99 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/glue/MessagePump.cpp:97 #9 0x7f0dd3a9df9c in RunInternal /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:234 #10 0x7f0dd3a9df9c in RunHandler /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:227 #11 0x7f0dd3a9df9c in MessageLoop::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/ipc/chromium/src/base/message_loop.cc:201 #12 0x7f0dd904a0c7 in nsBaseAppShell::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/widget/nsBaseAppShell.cpp:156 #13 0x7f0ddaee9698 in nsAppStartup::Run() /builds/slave/m-cen-l64-asan-000000000000000/build/src/toolkit/components/startup/nsAppStartup.cpp:281 #14 0x7f0ddafe7b4a in XREMain::XRE_mainRun() /builds/slave/m-cen-l64-asan-000000000000000/build/src/toolkit/xre/nsAppRunner.cpp:4342 #15 0x7f0ddafe8db6 in XREMain::XRE_main(int, char**, nsXREAppData const*) /builds/slave/m-cen-l64-asan-000000000000000/build/src/toolkit/xre/nsAppRunner.cpp:4439 #16 0x7f0ddafe9bfe in XRE_main /builds/slave/m-cen-l64-asan-000000000000000/build/src/toolkit/xre/nsAppRunner.cpp:4545 #17 0x48a793 in do_main /builds/slave/m-cen-l64-asan-000000000000000/build/src/browser/app/nsBrowserApp.cpp:220 #18 0x48a793 in main /builds/slave/m-cen-l64-asan-000000000000000/build/src/browser/app/nsBrowserApp.cpp:360 #19 0x7f0dec489ec4 (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4) #20 0x489bcc in _start (/home/parnell/FirefoxBuilds/firefox/firefox+0x489bcc)

0x7f0de0f9ea08 is located 0 bytes to the right of global variable 'nsTArrayHeader::sEmptyHdr' from '/builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/xpcom/build/Unified_cpp_xpcom_build1.cpp' (0x7f0de0f9ea00) of size 8 SUMMARY: AddressSanitizer: global-buffer-overflow /builds/slave/m-cen-l64-asan-000000000000000/build/src/obj-firefox/dist/include/mozilla/RefPtr.h:261 get Shadow bytes around the buggy address: 0x0fe23c1ebcf0: 00 f9 f9 f9 f9 f9 f9 f9 01 f9 f9 f9 f9 f9 f9 f9 0x0fe23c1ebd00: 01 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0fe23c1ebd10: 01 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0fe23c1ebd20: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0fe23c1ebd30: 04 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 =>0x0fe23c1ebd40: 00[f9]f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00 0x0fe23c1ebd50: 00 00 00 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0fe23c1ebd60: 01 f9 f9 f9 f9 f9 f9 f9 01 f9 f9 f9 f9 f9 f9 f9 0x0fe23c1ebd70: 01 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0fe23c1ebd80: 01 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0fe23c1ebd90: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb F==906==ABORTING

The original report as published on Mozilla's Bugzilla, by Looben Yang. 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 DOM: Service Workers. Mozilla made it public on 7 April 2016 as CVE-2016-2812.

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 Looben Yang

View all

50 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.