Skip to content
Memory corruption Disclosed report

Use After Free in nsQueryInterface::operator()

Looben Yang Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 13 days
  • Paid in 17 days
  • Disclosed after 13 days
Text
Using Notification in web workers can trigger a Use After Free in nsQueryInterface::operator():


First-chance exception at 0x5E50DD7D (xul.dll) in firefox.exe: 0xC0000005: Access violation reading location 0x5A5A5A5A.
Unhandled exception at 0x5E50DD7D (xul.dll) in firefox.exe: 0xC0000005: Access violation reading location 0x5A5A5A5A.


Firefox version: 43.0a1 (2015-08-13)

Call Stack:

>	xul.dll!nsQueryInterface::operator()(const nsID & aIID, void * * aAnswer) Line 14	C++
 	xul.dll!nsCOMPtr_base::assign_from_qi(const nsQueryInterface aQI, const nsID & aIID) Line 62	C++
 	xul.dll!mozilla::dom::Event::SetOwner(mozilla::dom::EventTarget * aOwner) Line 1189	C++
 	xul.dll!mozilla::dom::Event::ConstructorInit(mozilla::dom::EventTarget * aOwner, nsPresContext * aPresContext, mozilla::WidgetEvent * aEvent) Line 67	C++
 	xul.dll!mozilla::dom::Event::Event(mozilla::dom::EventTarget * aOwner, nsPresContext * aPresContext, mozilla::WidgetEvent * aEvent) Line 54	C++
 	xul.dll!NS_NewDOMEvent(nsIDOMEvent * * aInstancePtrResult, mozilla::dom::EventTarget * aOwner, nsPresContext * aPresContext, mozilla::WidgetEvent * aEvent) Line 1266	C++
 	xul.dll!mozilla::DOMEventTargetHelper::DispatchTrustedEvent(const nsAString_internal & aEventName) Line 267	C++
 	xul.dll!mozilla::dom::NotificationEventWorkerRunnable::WorkerRunInternal(JSContext * aCx, mozilla::dom::workers::WorkerPrivate * aWorkerPrivate) Line 409	C++
 	xul.dll!mozilla::dom::NotificationWorkerRunnable::WorkerRun(JSContext * aCx, mozilla::dom::workers::WorkerPrivate * aWorkerPrivate) Line 377	C++
 	xul.dll!mozilla::dom::workers::WorkerRunnable::Run() Line 363	C++
 	xul.dll!nsThread::ProcessNextEvent(bool aMayWait, bool * aResult) Line 864	C++
 	xul.dll!NS_ProcessNextEvent(nsIThread * aThread, bool aMayWait) Line 277	C++
 	xul.dll!mozilla::dom::workers::WorkerPrivate::DoRunLoop(JSContext * aCx) Line 5174	C++
 	xul.dll!`anonymous namespace'::WorkerThreadPrimaryRunnable::Run() Line 2877	C++
 	xul.dll!nsThread::ProcessNextEvent(bool aMayWait, bool * aResult) Line 864	C++
 	xul.dll!NS_ProcessNextEvent(nsIThread * aThread, bool aMayWait) Line 277	C++
 	xul.dll!mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate * aDelegate) Line 355	C++
 	xul.dll!MessageLoop::RunHandler() Line 228	C++
 	xul.dll!MessageLoop::Run() Line 202	C++
 	xul.dll!nsThread::ThreadFunc(void * aArg) Line 361	C++
 	nss3.dll!_PR_NativeRunThread(void * arg) Line 419	C
 	nss3.dll!pr_root(void * arg) Line 90	C
 	[External Code]	
 	[Frames below may be incorrect and/or missing, no symbols loaded for msvcr120.dll]	

Variables:

+		aAnswer	0x1c8cf9e4 {0x1c8cf9fc}	void * *
+		aIID	{m0=3908948519 m1=10202 m2=18158 ...}	const nsID &
+		mRawPtr	0x5a5a5a5a {...}	nsISupports *
+		this	0x0b411040 {mRawPtr=0x5a5a5a5a {...} }	nsQueryInterface *


Registers:
EAX = 5A5A5A5A EBX = 0B411040 ECX = 0B411040 EDX = 5FFADB78 ESI = 1C8CF9FC EDI = 0B411040 EIP = 5E50DD7D ESP = 1C8CF9CC EBP = 1C8CF9E8 EFL = 00010202 

0x5a5a5a5a = 00000000 


The address pattern 0x5a5a5a5a  indicates a Use After Free.

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 1 September 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.