Invalid cast in nsSVGSVGElement::GetCurrentViewElement
- Fixed in 3 days
- Paid in 3 months
- Disclosed after 3 days
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.
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.