Skip to content
Disclosed report

Invalid cast in nsSVGSVGElement::GetCurrentViewElement

Nils Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 3 days
  • Paid in 3 months
  • Disclosed after 3 days
Text
Created attachment 687566
testcase.svg (crashes firefox)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20121130 Firefox/20.0
Build ID: 20121130030747

Steps to reproduce:

Invalid cast in nsSVGSVGElement::GetCurrentViewElement

Description:
The code in nsSVGSVGElement::GetCurrentViewElement doesn't check whether the retrieved view element is a SVG element before casting it to nsSVGViewElement. By appending for example a HTML element with the tag name "view" to the SVG document with the same ID as the current view a crash can be triggered. The crash shows potentially exploitable behaviour.

Testcase is attached (crashes the browser)

Vulnerable Code:
nsSVGViewElement*
nsSVGSVGElement::GetCurrentViewElement() const
{
  if (mCurrentViewID) {
    nsIDocument* doc = GetCurrentDoc();
    if (doc) {
      Element *element = doc->GetElementById(*mCurrentViewID);
      if(element) {
      }
      if (element && element->Tag() == nsGkAtoms::view) {
        return static_cast<nsSVGViewElement*>(element);
      }
    }
  }
  return nullptr;
}

Tested and Affected Versions:
Firefox 20.0a1 (trunk)



reported by nils of vulndev ltd.

The original report as published on Mozilla's Bugzilla, by Nils. 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 security bug in SVG. Mozilla made it public on 6 December 2012.

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

More by Nils

View all

133 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.