Skip to content
Memory corruption Disclosed report Advanced

WebRTC - Use After Free in in JsepSessionImpl::CheckNegotiationNeeded()

A use-after-free flaw existed in Firefox's WebRTC signalling code, in JsepSessionImpl::CheckNegotiationNeeded(). Opening a crafted page caused Firefox to read freed memory and crash.

Looben Yang Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 6 days
  • Paid in 43 days
  • Disclosed after 6 days

Created attachment 8933539 UAF_CheckNegotiationNeeded_PoC.html

Reproduction test case: UAF_CheckNegotiationNeeded_PoC.html

Steps to reproduce: 1. Open UAF_CheckNegotiationNeeded_PoC.html in Firefox browser. 2. Firefox crashes in JsepSessionImpl::CheckNegotiationNeeded() by accessing freed memory.

	(49a0.5fbc): Access violation - code c0000005 (!!! second chance !!!)
	eax=e5e5e5e5 ebx=1589df0c ecx=e5e5e5e5 edx=00000001 esi=e5e5e5e5 edi=1a9d0740
	eip=62fdbd20 esp=008fcf28 ebp=008fd2f8 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::JsepSessionImpl::CheckNegotiationNeeded+0x199:
	62fdbd20 8b06            mov     eax,dword ptr [esi]  ds:002b:e5e5e5e5=????????

Firefox version: 59.0a1 (2017-11-30) (32-bit) OS: Windows 10

Stack trace:

(49a0.5fbc): Access violation - code c0000005 (!!! second chance !!!)
eax=e5e5e5e5 ebx=1589df0c ecx=e5e5e5e5 edx=00000001 esi=e5e5e5e5 edi=1a9d0740
eip=62fdbd20 esp=008fcf28 ebp=008fd2f8 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::JsepSessionImpl::CheckNegotiationNeeded+0x199:
62fdbd20 8b06            mov     eax,dword ptr [esi]  ds:002b:e5e5e5e5=????????
5:216> !analyze -v
*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************

FAULTING_IP: 
xul!mozilla::JsepSessionImpl::CheckNegotiationNeeded+199 [z:\build\build\src\media\webrtc\signaling\src\jsep\jsepsessionimpl.cpp @ 2335]
62fdbd20 8b06            mov     eax,dword ptr [esi]

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 62fdbd20 (xul!mozilla::JsepSessionImpl::CheckNegotiationNeeded+0x00000199)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 00000000
   Parameter[1]: e5e5e5e5
Attempt to read from address e5e5e5e5

FAULTING_THREAD:  00005fbc

PROCESS_NAME:  firefox.exe

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

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

EXCEPTION_PARAMETER1:  00000000

EXCEPTION_PARAMETER2:  e5e5e5e5

READ_ADDRESS:  e5e5e5e5 

FOLLOWUP_IP: 
xul!mozilla::JsepSessionImpl::CheckNegotiationNeeded+199 [z:\build\build\src\media\webrtc\signaling\src\jsep\jsepsessionimpl.cpp @ 2335]
62fdbd20 8b06            mov     eax,dword ptr [esi]

NTGLOBALFLAG:  400

APPLICATION_VERIFIER_FLAGS:  0

APP:  firefox.exe

ANALYSIS_VERSION: 10.0.10240.9 x86fre

BUGCHECK_STR:  INVALID_POINTER_READ_FILL_PATTERN_e5e5e5e5

DEFAULT_BUCKET_ID:  INVALID_POINTER_READ_FILL_PATTERN_e5e5e5e5

LAST_CONTROL_TRANSFER:  from 63344c5f to 62fdbd20

STACK_TEXT:  
008fd2f8 63344c5f 00000000 008fd38c 1b814520 xul!mozilla::JsepSessionImpl::CheckNegotiationNeeded+0x199
008fd310 62521b65 08012800 008fd358 1f6a4c80 xul!mozilla::dom::PeerConnectionImplBinding::checkNegotiationNeeded+0x1e
008fd368 2db25eb1 08012800 00000000 008fd390 xul!mozilla::dom::GenericBindingMethod+0xec
WARNING: Frame IP not in any known module. Following frames may be wrong.
008fd3a4 2da52bd8 00004021 16ff7b20 ffffff8c 0x2db25eb1
008fd3ec 2da422d9 00001842 12a4c9d0 00000000 0x2da52bd8
008fd414 2da77300 00004021 09ed6c40 ffffff8c 0x2da422d9
008fd45c 2da006dd 00001c43 12a543d0 00000000 0x2da77300
008fd490 62524699 2da77190 00000001 008fd990 0x2da006dd
008fd748 6252454a 2da77190 08012800 00000000 xul!EnterJit+0x112
008fd764 629d6279 008fd89c 008fd89c 008fd89c xul!js::jit::MaybeEnterJit+0x54
008fd810 6231a0a3 08012800 008fd890 09ed7dc0 xul!js::RunScript+0x219
008fd8ac 6224eb32 00000000 6e1730c0 08012800 xul!js::InternalCallOrConstruct+0x1e3
008fd8cc 6224f9ad 008fda10 008fda20 008fda30 xul!js::Call+0x8b
008fd9dc 6333c2b9 008fda20 008fda10 008fda30 xul!JS::Call+0xf7
008fdb00 630117a2 008fdb38 00000000 008fdcb0 xul!mozilla::dom::PeerConnectionObserverJSImpl::OnSetRemoteDescriptionSuccess+0x11c
008fdc0c 6333e2be 1512e80c 08012800 00000000 xul!mozilla::PeerConnectionImpl::SetRemoteDescription+0x4a3
008fdc84 6335124c 00000001 008fdcc0 008fdcb0 xul!mozilla::PeerConnectionImpl::SetRemoteDescription+0x3a
008fdd58 62521b65 08012800 008fdda0 1f6a4c80 xul!mozilla::dom::PeerConnectionImplBinding::setRemoteDescription+0xb7
008fddb0 2db25eb1 08012800 00000002 008fddd8 xul!mozilla::dom::GenericBindingMethod+0xec
008fddfc 2da75297 00004821 1e670440 ffffff86 0x2db25eb1
008fde4c 2da006dd 00002c43 1650d020 00000002 0x2da75297
008fde90 62524699 2da75080 00000003 008fe3b8 0x2da006dd
008fe148 6252454a 2da75080 08012800 00000000 xul!EnterJit+0x112
008fe164 629d6279 008fe29c 008fe29c 008fe29c xul!js::jit::MaybeEnterJit+0x54
008fe210 6231a0a3 08012800 008fe290 008fe3c0 xul!js::RunScript+0x219
008fe2ac 6224eb32 00000000 08012800 080073e8 xul!js::InternalCallOrConstruct+0x1e3
008fe2cc 623573cb 008fe388 64f2cf98 008fe388 xul!js::Call+0x8b
008fe3d8 62356dff 008fe42c 008fe408 1638c1b8 xul!js::PromiseObject::create+0x575
008fe440 2da4ed41 08012800 00000001 008fe468 xul!PromiseConstructor+0xf4
008fe48c 2da7338f 00004821 12a15480 ffffff8c 0x2da4ed41
008fe4dc 2db25696 00005041 1650b6a0 00000000 0x2da7338f
008fe53c 2da006dd 00001c43 0a074520 00000001 0x2db25696
008fe570 62524699 2db25250 00000002 008fea28 0x2da006dd
008fe828 6252454a 2db25250 08012800 00000000 xul!EnterJit+0x112
008fe844 629d6279 008fe97c 008fe97c 008fe97c xul!js::jit::MaybeEnterJit+0x54
008fe8f0 6231a0a3 08012800 008fe970 008fea00 xul!js::RunScript+0x219
008fe98c 6224fcd3 00000000 08012800 008feaa0 xul!js::InternalCallOrConstruct+0x1e3
008fe9b0 62473294 08012800 08012800 008fea14 xul!InternalCall+0x73
008fea5c 624734d6 008feab4 008feaa0 008fea90 xul!AsyncFunctionResume+0x1ae
008fead0 62564ec5 008feaf4 008fed48 08012800 xul!AsyncFunctionPromiseReactionJob+0xb4
008febcc 62319ffd 08012800 00000000 008fed48 xul!PromiseReactionJob+0x37f
008fec6c 6224eb32 00000000 6e1730c0 08012800 xul!js::InternalCallOrConstruct+0x13d
008fec8c 6224f9ad 008fede0 64f2cf98 008fedf0 xul!js::Call+0x8b
008fed9c 62250744 64f2cf98 008fede0 008fedf0 xul!JS::Call+0xf7
008feed4 622f7bbe 15871c20 16d642e0 1a9ce850 xul!mozilla::PromiseJobRunnable::Run+0x125
008fef30 622280cf 008ff190 158f14c0 07b0e68c xul!mozilla::dom::Promise::PerformMicroTaskCheckpoint+0x83
008ff0b8 6238a069 158f14c0 02db04a0 008ff200 xul!nsGlobalWindowInner::RunTimeoutHandler+0x1fc
008ff1c8 624ae9f5 008ff218 158f14c0 02d970b0 xul!mozilla::dom::TimeoutManager::RunTimeout+0x2e0
008ff234 624aef2d 008ff268 62349bdc 158086c0 xul!mozilla::dom::TimeoutExecutor::MaybeExecute+0x9f
008ff23c 62349bdc 158086c0 008ff818 16d78440 xul!mozilla::dom::TimeoutExecutor::Run+0x11
008ff268 62349b7e 64712764 008ff2b4 62c90079 xul!mozilla::ThrottledEventQueue::Inner::ExecuteRunnable+0x57
008ff274 62c90079 16d64840 008ff818 02d37ca0 xul!mozilla::ThrottledEventQueue::Inner::Executor::Run+0xf
008ff2b4 622f6b09 16d78440 02d01230 02d01220 xul!mozilla::SchedulerGroup::Runnable::Run+0x4f
008ff824 6232b3f7 02d37ca0 00000000 008ff84f xul!nsThread::ProcessNextEvent+0x294
008ff850 62e37bfb 008ff9c8 008ff9c8 02d03040 xul!mozilla::ipc::MessagePump::Run+0x75
008ff86c 627760c9 008ff9c8 8ce35d3d 07b0ed30 xul!mozilla::ipc::MessagePumpForChildProcess::Run+0x58
008ff8a4 62776089 02d37ca0 00000002 02d03000 xul!MessageLoop::RunHandler+0x1f
008ff8c4 625ee58a 02d01220 008ff9c8 008ff8e4 xul!MessageLoop::Run+0x19
008ff8d4 625ee316 07b0ed30 02d01220 008ff8f8 xul!nsBaseAppShell::Run+0x34
008ff8e4 644a9b88 07b0ed30 02d01220 07b0ed30 xul!nsAppShell::Run+0x26
008ff8f8 62e37bb9 008ff9c8 02d01220 008ff940 xul!XRE_RunAppShell+0x2f
008ff908 627760c9 008ff9c8 8ce35cd9 00000013 xul!mozilla::ipc::MessagePumpForChildProcess::Run+0x16
008ff940 62776089 02d19800 00000001 008ff900 xul!MessageLoop::RunHandler+0x1f
008ff960 644a9a12 02d060f0 00000016 02d03040 xul!MessageLoop::Run+0x19
008ffa84 644ac767 008ffab0 008ffab8 002e93d3 xul!XRE_InitChildProcess+0x4bd
008ffa90 002e93d3 00000016 02d03040 008ffab0 xul!mozilla::BootstrapImpl::XRE_InitChildProcess+0x11
008ffab8 002e6558 02d03040 029f2b00 754580e8 firefox!content_process_main+0x74
008ffe10 002e5229 00000017 ffcefac0 029f3610 firefox!wmain+0x54f8
008ffe58 75808654 00603000 75808630 9caec81a firefox!__scrt_common_main_seh+0xf8
008ffe6c 77584a47 00603000 9e45a4f5 00000000 KERNEL32!BaseThreadInitThunk+0x24
008ffeb4 77584a17 ffffffff 775a9eb7 00000000 ntdll!__RtlUserThreadStart+0x2f
008ffec4 00000000 002e529f 00603000 00000000 ntdll!_RtlUserThreadStart+0x1b

FAULTING_SOURCE_LINE:  z:\build\build\src\media\webrtc\signaling\src\jsep\jsepsessionimpl.cpp

FAULTING_SOURCE_FILE:  z:\build\build\src\media\webrtc\signaling\src\jsep\jsepsessionimpl.cpp

FAULTING_SOURCE_LINE_NUMBER:  2335

SYMBOL_STACK_INDEX:  0

SYMBOL_NAME:  xul!mozilla::JsepSessionImpl::CheckNegotiationNeeded+199

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: xul

IMAGE_NAME:  xul.dll

DEBUG_FLR_IMAGE_TIMESTAMP:  5a209432

STACK_COMMAND:  ~216s ; kb

BUCKET_ID:  INVALID_POINTER_READ_FILL_PATTERN_e5e5e5e5_xul!mozilla::JsepSessionImpl::CheckNegotiationNeeded+199

PRIMARY_PROBLEM_CLASS:  INVALID_POINTER_READ_FILL_PATTERN_e5e5e5e5_xul!mozilla::JsepSessionImpl::CheckNegotiationNeeded+199

FAILURE_PROBLEM_CLASS:  INVALID_POINTER_READ_FILL_PATTERN_e5e5e5e5

FAILURE_EXCEPTION_CODE:  c0000005

FAILURE_IMAGE_NAME:  xul.dll

FAILURE_FUNCTION_NAME:  mozilla::JsepSessionImpl::CheckNegotiationNeeded

FAILURE_SYMBOL_NAME:  xul.dll!mozilla::JsepSessionImpl::CheckNegotiationNeeded

FAILURE_BUCKET_ID:  INVALID_POINTER_READ_FILL_PATTERN_e5e5e5e5_c0000005_xul.dll!mozilla::JsepSessionImpl::CheckNegotiationNeeded

ANALYSIS_SOURCE:  UM

FAILURE_ID_HASH_STRING:  um:invalid_pointer_read_fill_pattern_e5e5e5e5_c0000005_xul.dll!mozilla::jsepsessionimpl::checknegotiationneeded

FAILURE_ID_HASH:  {db194bc4-bad6-695b-bb0a-3c888ed6e184}

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.

How it worked

Root cause

Likely the negotiation-needed check in the WebRTC signalling session used a pointer to an object that had already been freed, so it read a freed-memory fill pattern.

What the attacker needed

Victim opens a crafted web page; Firefox with WebRTC enabled

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

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

WebRTC is the browser feature that lets web pages do real-time audio and video calls. A use-after-free happens when a program frees a chunk of memory but keeps using it, so it reads whatever is now there. Here a web page could trigger that in Firefox's call-handling code and crash the browser.

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.