Skip to content
Memory corruption Disclosed report Advanced CVE-2016-9896

dom::Navigator::NotifyVRDisplaysUpdated UAF

A use-after-free occurs in Firefox when a page calls navigator.getVRDisplays and then removes the object element that hosts the calling document, leaving the navigator pointing at freed memory. An attacker could trigger a crash and potentially execute code by loading a crafted page with an embedded SVG document.

lipe Follow

Originally disclosed on Mozilla

  • Fixed in 19 days
  • Paid in 22 days
  • Disclosed after 19 days
Text
Created attachment 8807970
report.txt

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40
Build ID: 20160314222922

Steps to reproduce:

Saved an xml file containing only "<svg></svg>" to external.xml in the directory root together with the attached html, this external file is loaded inside the attached html with a object tag, the node containing it's own window reference by issuing a call to navigator.getVRDisplays followed by the tag removal causes the usage of the freed navigator.

Tested with a Nightly build 32bit version:

Name      Firefox
Version 	52.0a1
Build ID 	20161007030207

A more detailed windbg output is attached aswell.



Actual results:


(bf8.d60): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=e5e5e5d5 ebx=00000000 ecx=e5e5e5d5 edx=1506d5b4 esi=142eb2c8 edi=17c081f0
eip=687f9216 esp=003aecc8 ebp=003aecd4 iopl=0         nv up ei pl nz na po nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00210202
xul!nsGlobalWindow::UpdateVRDisplays+0x8:
687f9216 80795e00        cmp     byte ptr [ecx+5Eh],0       ds:002b:e5e5e633=??

The original report as published on Mozilla's Bugzilla, by lipe. 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

Impact

The crash is an access violation in the browser process, which could potentially be exploited for code execution, though the report only demonstrates a crash.

What the attacker needed

Victim loads a crafted page; page embeds an SVG document via object tag; VR display API available

How it was found

  1. Save an XML file containing only an empty SVG element as external.xml in the directory root.
  2. Place the attached HTML file in the same directory; it loads external.xml inside an object tag.
  3. In the embedded document, call navigator.getVRDisplays to obtain a window reference.
  4. Remove the object tag, which frees the navigator.
  5. Observe the access violation in the debugger output.

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.

When a web page is removed from the screen, the browser should clean up everything that page was using. Here the browser kept a pointer to a part of the page that had already been deleted, and then tried to use it again. That kind of mistake, called a use-after-free, can crash the browser and sometimes let an attacker run their own code.

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 lipe

View all

3 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.