<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Internet Explorer漏洞分析(五)——CVE-2016-0199

          共 3912字,需瀏覽 8分鐘

           ·

          2021-04-24 09:15

          Internet Explorer漏洞分析(五)——CVE-2016-0199

          1.本文一共1233個(gè)字26張圖預(yù)計(jì)閱讀時(shí)間13分鐘2.本文作者erfze 屬于Gcow安全團(tuán)隊(duì)復(fù)眼小組未經(jīng)過(guò)許可禁止轉(zhuǎn)載3.本篇文章是CVE-2016-0199漏洞的分析入手詳細(xì)的闡述漏洞的成因4.本篇文章十分適合漏洞安全研究人員進(jìn)行交流學(xué)習(xí)5.若文章中存在說(shuō)得不清楚或者錯(cuò)誤的地方歡迎師傅到公眾號(hào)后臺(tái)留言中指出感激不盡

          0x01 漏洞信息

          0x01.1 漏洞簡(jiǎn)述

          ?編號(hào):CVE-2016-0199?類(lèi)型:類(lèi)型混淆(Type Confusion)?漏洞影響:遠(yuǎn)程代碼執(zhí)行(RCE)/拒絕服務(wù)攻擊 (DoS)?CVSS 2.0:9.3

          mshtml.dll組件在將CElement—>CAttributeCollection—>CAttrArray—>Attribute.nodeValue復(fù)制到CAttribute—>Variant時(shí),并未對(duì)其進(jìn)行校驗(yàn),以致類(lèi)型混淆,進(jìn)而可造成任意代碼執(zhí)行。

          0x01.2 漏洞影響

          Microsoft Internet Explorer 9 through 11

          0x01.3 修復(fù)方案

          [MS16-063]https://docs.microsoft.com/en-us/security-updates/securitybulletins/2016/ms16-063

          0x02 漏洞分析

          0x02.1 分析環(huán)境

          ?OS版本:Windows 7 Service Pack 1 x86?Internet Explorer版本:9.0.8112.16421?mshtml.dll版本:9.0.8112.16684?jscript9.dll版本:9.0.8112.16684

          0x02.2 詳細(xì)分析

          分析用POC來(lái)自[exploit-db]https://www.exploit-db.com/exploits/39994:

          <!DOCTYPE html><metahttp-equiv="X-UA-Compatible"content="IE=7"><script>  oElement = document.createElement("IMG");var oAttr = document.createAttribute("loop");  oAttr.nodeValue = oElement;  oElement.loop =0x41424344;// Set original value data to 44 43 42 41  oElement.setAttributeNode(oAttr);// Replace oElement with original value data  oElement.removeAttributeNode(oAttr);CollectGarbage();// Use original value data as address 0x41424344 of a vftable</script>

          document.createElement("IMG");語(yǔ)句對(duì)應(yīng)實(shí)現(xiàn)為mshtml!CDocument::createElement,其執(zhí)行流如下:

          e4f657496e024a0d51085913ddd81687.webp

          圖片1

          首先分配堆塊用于存儲(chǔ)CImgElement對(duì)象:

          71e6b47628bc098437b697f0e19dcb1e.webp

          圖片2

          之后由CElement::CElement完成初始化操作:

          9ad511ea71e41b96a995e0d2ca0de0b1.webp

          圖片3

          完成CImgElement對(duì)象創(chuàng)建:

          1d7f6194c895df6ad8762f5a7f9920bf.webp

          圖片4

          634891f1e529a60fc6bf610a94c9d0c5.webp

          圖片5

          var oAttr = document.createAttribute("loop");語(yǔ)句對(duì)應(yīng)實(shí)現(xiàn)為mshtml!CDocument::createAttribute,其執(zhí)行流如下:

          fc6dc9f98bd9fa3bd538dfc691e9464a.webp

          圖片6

          分配堆塊用于存儲(chǔ)CAttribute對(duì)象,之后由CAttribute::CAttribute完成初始化操作:

          b9640e8e31e9efd88a9fc4d4dd7eed02.webp

          圖片7

          CAttribute對(duì)象偏移0x24處存儲(chǔ)屬性名:

          aa77898c129b5fdd6f7b7db0ff06ae0f.webp

          圖片8

          eaea41fe2db5429f7525b92e6feb2b24.webp

          圖片9

          oAttr.nodeValue = oElement;語(yǔ)句對(duì)應(yīng)實(shí)現(xiàn)為mshtml!CAttribute::put_nodeValue,其調(diào)用CAttribute::PutNodeValueVariantHelper完成功能。首先是復(fù)制VARIANT類(lèi)型對(duì)象(存儲(chǔ)nodeValue值)至偏移0x28處:

          e27aad7b1f9faef5cd5346c0fefff078.webp

          圖片10

          之后判斷該CAttribute對(duì)象是否為T(mén)racked Object,如果不是則將其設(shè)為Root Object,并加入CRootTracker中(感興趣的讀者可自行分析CTrackerHelper::SetAsRootCRootTracker::AddRoot函數(shù),此部分與GC機(jī)制有關(guān),不在此展開(kāi)):

          748cdea1400b33c84ac97e8a98118a13.webp

          圖片11

          CAttribute對(duì)象偏移0x5C處用于判斷其是否為Root Object:

          e311cc7c6b18e559d984244b31ae2654.webp

          圖片12

          oElement.loop = 0x41424344;語(yǔ)句設(shè)定CElement對(duì)象屬性,其屬性使用數(shù)組存儲(chǔ),對(duì)應(yīng)實(shí)現(xiàn)為CAttrArray::Set。該函數(shù)首先判斷CElement對(duì)象偏移0x10處是否置值,若無(wú)則分配內(nèi)存并將返回值寫(xiě)入該處:

          圖片13

          CImplAry::InsertIndirect函數(shù)中對(duì)CAttributeCollection(CElement?offset 0x10)偏移0x04處值與0x00處值進(jìn)行比較以檢查是否需要調(diào)整Attribute Array存儲(chǔ)空間:

          bfaab24ce7930c272a6fc7532b6ca1c3.webp

          圖片14

          由于是首次設(shè)定CElement對(duì)象屬性,并未開(kāi)辟Attribute Array空間,故調(diào)用HeapAlloc進(jìn)行分配,具體可分析CImplAry::EnsureSizeWorker函數(shù),完成后內(nèi)存如下:

          b6d6c3fe8bf202657fd519211055a814.webp

          圖片15

          共4個(gè)元素(0x10>>2),每個(gè)元素占用內(nèi)存空間為0x10。完成屬性賦值,并將Attribute Array當(dāng)前元素?cái)?shù)量加1:

          853142e58e637a3842f482e88b9926a3.webp

          圖片16

          CElement對(duì)象部分結(jié)構(gòu)含義如下:

          +0x10CAttributeCollection+0x00The total size of the AttributeArray<<2+0x04Number of Attributes+0x08CAttrArray+0x0c+0x14CTreeNode

          oElement.setAttributeNode(oAttr);語(yǔ)句對(duì)應(yīng)實(shí)現(xiàn)為mshtml!CElement::setAttributeNode,其調(diào)用CElement::VersionedSetAttributeNode完成功能。首先是執(zhí)行MSHTML!CAttribute::PrivateQueryInterface+0x920函數(shù),該函數(shù)會(huì)對(duì)esp+30h+var_14處內(nèi)存置值,此值會(huì)決定后續(xù)執(zhí)行CAttrArray::Set函數(shù)orCAttrArray::SetAt函數(shù):

          bc92a768e4bdef6523687f67f0786233.webp

          圖片17

          之后執(zhí)行CAttribute::SetElement函數(shù),對(duì)CAttribute對(duì)象偏移0x3c處及偏移0x08處進(jìn)行置值,具體流程可自行跟進(jìn)分析:

          c0993beda08aad9fd7160a37869b2ad3.webp

          圖片18

          b639a34148e2f05794fcbdb80d50b968.webp

          圖片19

          CAttrArray::Set函數(shù)執(zhí)行完成:

          4339215498679548f17300c52ad8bdc1.webp

          圖片20

          CAttribute對(duì)象部分結(jié)構(gòu)含義如下:

          +0x24AttributeName(Pointer to BSTR)、+0x28Variant(Save the nodeValue)+0x3cCElement+0x5CIsRootObject

          oElement.removeAttributeNode(oAttr);語(yǔ)句對(duì)應(yīng)實(shí)現(xiàn)為mshtml!CElement::VersionedRemoveAttributeNode。漏洞發(fā)生在將CElement—>CAttributeCollection—>CAttrArray—>Attribute.nodeValue復(fù)制到CAttribute—>Variant(0x28)時(shí),并未對(duì)其進(jìn)行校驗(yàn),以致類(lèi)型混淆。正常情形下:

          <!DOCTYPE html><metahttp-equiv="X-UA-Compatible"content="IE=7"><script>  oElement1 = document.createElement("IMG");var oAttr1 = document.createAttribute("loop1");  oAttr1.nodeValue =0x41424344;  oElement1.setAttributeNode(oAttr1);  oElement1.removeAttributeNode(oAttr1);CollectGarbage();</script>

          其執(zhí)行流如下:

          c91a293ce0c6d5f321b99ede5a39e01b.webp

          圖片21

          bddf463b2c75801de93239d3f873d68c.webp

          圖片22

          b459b56e70032827761c4b8e81f13462.webp

          圖片23

          而在POC情形下,其執(zhí)行流:

          a077ae4329488f4d690acb251c81b855.webp

          圖片24

          6796e98b6292e50abfc72dfeea21d173.webp

          圖片25

          如此一來(lái),CAttribute::EnumerateTrackedObjects傳遞參數(shù)給jscript9!ScriptEngine::EnumerateTrackingClient,其在mov ecx, [eax]時(shí)便會(huì)發(fā)生訪問(wèn)錯(cuò)誤:

          3715a41c1d5cd70f05b551788f69aea1.webp

          圖片26

          0x03 參閱鏈接

          ?[對(duì)CVE-2016-0199的簡(jiǎn)單分析]https://bbs.pediy.com/thread-212058.htm?[CVE-2016-0199 漏洞分析]https://www.jianshu.com/p/38001618bc2d


          瀏覽 61
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  91人妻人人操人人爽 | 波多野结衣三区 | 狠久久| 亚洲性爱在线观看 | 可以看黄片在线看 |