Skip to content
Memory corruption Disclosed report Advanced

WebRtc - Memory corruption in nr_socket_sendto()

A memory corruption flaw in the nr_socket_sendto() function of Firefox's WebRTC networking code could be triggered by visiting a malicious page, causing the browser to crash by executing a corrupted address.

Looben Yang Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 8 days
  • Paid in 13 days
  • Disclosed after 8 days

Steps to reproduce:

  1. Run server side script nr_socket_sendto.js in Node.js (node nr_socket_sendto.js ).
  2. Enter http://localhost:12345 in Firefox browser.

(3. If it gets hang, restart Firefox and repeat step 2) 4. Firefox crashes by executing corrupted address in nr_socket_sendto():

OS: Windows 10 Firefox version: 51.0a1 (2016-08-01)

(3dbe0.3d434): Access violation - code c0000005 (first chance) First chance exceptions are reported before any exception handling. This exception may be expected and handled. eax=0762e808 ebx=26048318 ecx=26534aac edx=261bc010 esi=2604800c edi=0b77f3c0 eip=0762e808 esp=0b77f1f4 ebp=0b77f20c iopl=0 nv up ei pl nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010202 0762e808 ?? ???

0:011> !analyze -v


  •                                                                         *
    
  •                    Exception Analysis                                   *
    
  •                                                                         *
    

FAULTING_IP: +8b01e38c9f7f28a 0762e808 ?? ???

EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff) ExceptionAddress: 0762e808 ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 00000008 Parameter[1]: 0762e808 Attempt to execute non-executable address 0762e808

CONTEXT: 00000000 -- (.cxr 0x0;r) eax=0762e808 ebx=26048318 ecx=26534aac edx=261bc010 esi=2604800c edi=0b77f3c0 eip=0762e808 esp=0b77f1f4 ebp=0b77f20c iopl=0 nv up ei pl nz na po nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010202 0762e808 ?? ???

FAULTING_THREAD: 0003d434

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: 00000008

EXCEPTION_PARAMETER2: 0762e808

WRITE_ADDRESS: 0762e808

FOLLOWUP_IP: xul!nr_socket_sendto+20 [c:\builds\moz2_slave\m-cen-w32-ntly-000000000000000\build\src\media\mtransport\third_party\nicer\src\net\nr_socket.c @ 91] 11130d5d 83c414 add esp,14h

FAILED_INSTRUCTION_ADDRESS: +e 0762e808 ?? ???

NTGLOBALFLAG: 0

APPLICATION_VERIFIER_FLAGS: 0

APP: firefox.exe

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

IP_ON_HEAP: 0762e808 The fault address in not in any loaded module, please check your build's rebase log at <releasedir>\bin\build_logs\timebuild\ntrebase.log for module which may contain the address if it were loaded.

IP_IN_RESERVED_BLOCK: 762e808

BUGCHECK_STR: APPLICATION_FAULT_SOFTWARE_NX_FAULT_INVALID

PRIMARY_PROBLEM_CLASS: SOFTWARE_NX_FAULT_INVALID

DEFAULT_BUCKET_ID: SOFTWARE_NX_FAULT_INVALID

LAST_CONTROL_TRANSFER: from 11130d5d to 0762e808

STACK_TEXT:
WARNING: Frame IP not in any known module. Following frames may be wrong. 0b77f1f0 11130d5d 26151160 261bc010 00000064 0x762e808 0b77f20c 11132c28 00000064 00000000 2604809c xul!nr_socket_sendto+0x20 0b77f350 11132ebe 262764e8 0db1b0d8 0006ed70 xul!nr_stun_client_send_request+0x14a 0b77f36c 105c3aca 00000000 00000000 2604800c xul!nr_stun_client_timer_expired_cb+0xab 0b77f388 0fa36862 262764e8 26233740 1e6b2310 xul!mozilla::nrappkitTimerCallback::Notify+0x96 0b77f418 0fa366be 1e6b2310 02e0c348 02e08860 xul!nsTimerImpl::Fire+0x190 0b77f454 0f9e0d9f 1e6b2310 00000001 00000001 xul!nsTimerEvent::Run+0x41 0b77f4e4 0f9dfa2b 02e08860 00000001 0b77f4ff xul!nsThread::ProcessNextEvent+0x254 0b77f500 0f9e289b 02e0c34c 00000000 02e08860 xul!NS_ProcessNextEvent+0x16 0b77f6c4 0f9e0d9f 02e0c34c 02e73600 02ef5700 xul!mozilla::net::nsSocketTransportService::Run+0x27f 0b77f750 0f9dfa2b 02e08860 02ef5700 0b77f76b xul!nsThread::ProcessNextEvent+0x254 0b77f76c 0fc1f665 02e73600 02e73600 6b264140 xul!NS_ProcessNextEvent+0x16 0b77f78c 0fc1f59e 01e73600 2c75c159 02e73600 xul!mozilla::ipc::MessagePumpForNonMainThreads::Run+0x7f 0b77f7c4 0fc1f56d 02e08860 00000001 6b264100 xul!MessageLoop::RunHandler+0x20 0b77f7e4 0fc1fc28 02e0e350 02e0e350 02e18920 xul!MessageLoop::Run+0x19 0b77f80c 6b263465 02e0886c 072ee300 6b262ece xul!nsThread::ThreadFunc+0xb0 0b77f828 6b262edb 02e18920 0b77f870 6e7362a4 nss3!_PR_NativeRunThread+0xac 0b77f834 6e7362a4 02e18920 54a717aa 6e736250 nss3!pr_root+0xd 0b77f870 744238f4 072ee300 744238d0 4e963c62 ucrtbase!_crt_at_quick_exit+0x104 0b77f884 77935de3 072ee300 4d407891 00000000 KERNEL32!BaseThreadInitThunk+0x24 0b77f8cc 77935dae ffffffff 7795b7dc 00000000 ntdll!__RtlUserThreadStart+0x2f 0b77f8dc 00000000 6e736250 072ee300 00000000 ntdll!_RtlUserThreadStart+0x1b

STACK_COMMAND: .cxr 0x0 ; kb

FAULTING_SOURCE_LINE: c:\builds\moz2_slave\m-cen-w32-ntly-000000000000000\build\src\media\mtransport\third_party\nicer\src\net\nr_socket.c

FAULTING_SOURCE_FILE: c:\builds\moz2_slave\m-cen-w32-ntly-000000000000000\build\src\media\mtransport\third_party\nicer\src\net\nr_socket.c

FAULTING_SOURCE_LINE_NUMBER: 91

SYMBOL_STACK_INDEX: 1

SYMBOL_NAME: xul!nr_socket_sendto+20

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: xul

IMAGE_NAME: xul.dll

DEBUG_FLR_IMAGE_TIMESTAMP: 579f7f18

FAILURE_BUCKET_ID: SOFTWARE_NX_FAULT_INVALID_c0000005_xul.dll!nr_socket_sendto

BUCKET_ID: APPLICATION_FAULT_SOFTWARE_NX_FAULT_INVALID_BAD_IP_xul!nr_socket_sendto+20

ANALYSIS_SOURCE: UM

FAILURE_ID_HASH_STRING: um:software_nx_fault_invalid_c0000005_xul.dll!nr_socket_sendto

FAILURE_ID_HASH: {6d7d7398-8caf-7374-4f84-190f193f56a1}

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 a memory corruption bug in the nr_socket_sendto() function where a corrupted address is used as a function pointer, leading to an attempt to execute non-executable memory.

What the attacker needed

Victim visits a malicious page; Firefox version 51.0a1 (2016-08-01)

How it was found

  1. Run the provided server-side Node.js script.
  2. Open the local URL in Firefox.
  3. If Firefox hangs, restart it and repeat the previous step.
  4. Firefox crashes with an access violation in nr_socket_sendto().

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.

This report describes a bug in Firefox's WebRTC code, which handles real-time communication like video calls. A malicious webpage could make the browser try to run code from a bad memory address, which crashes the browser. The report only shows a crash, not a way to take over the computer.

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.