6
6
require 'msf/core'
7
7
require 'rex'
8
8
require 'metasploit/framework/credential_collection'
9
- require 'metasploit/framework/login_scanner/brocade_telnet '
9
+ require 'metasploit/framework/login_scanner/telnet '
10
10
11
11
class Metasploit4 < Msf ::Auxiliary
12
12
@@ -20,16 +20,14 @@ def initialize
20
20
super (
21
21
'Name' => 'Brocade Enable Login Check Scanner' ,
22
22
'Description' => %q{
23
- This module will test a Brocade network device for a privilged
24
- (Enable) login on a range of machines and report successful
25
- logins. If you have loaded a database plugin and connected
26
- to a database this module will record successful
27
- logins and hosts so you can track your access.
28
- This is not a login/telnet authentication. Config should NOT
29
- have 'enable telnet authentication' in it. This will test the
30
- config that contains 'aaa authentication enable default local'
31
- Tested against:
32
- ICX6450-24 SWver 07.4.00bT311
23
+ This module will test a range of Brocade network devices for a
24
+ privileged logins and report successes. The device authentication mode
25
+ must be set as 'aaa authentication enable default local'.
26
+ Telnet authentication, e.g. 'enable telnet authentication', should not
27
+ be enabled in the device configuration.
28
+
29
+ This module has been tested against the following devices:
30
+ ICX6450-24 SWver 07.4.00bT311,
33
31
FastIron WS 624 SWver 07.2.02fT7e1
34
32
} ,
35
33
'Author' => 'h00die <mike[at]shorebreaksecurity.com>' ,
@@ -48,25 +46,29 @@ def initialize
48
46
end
49
47
50
48
def get_username_from_config ( un_list , ip )
51
- [ "config" , "running-config" ] . each do |command |
49
+ [ "config" , "running-config" ] . each do |command |
52
50
print_status ( " Attempting username gathering from #{ command } on #{ ip } " )
53
- sock . puts ( "\r \n " ) #ensure the buffer is clear
51
+ sock . puts ( "\r \n " ) # ensure that the buffer is clear
54
52
config = sock . recv ( 1024 )
55
53
sock . puts ( "show #{ command } \r \n " )
54
+
55
+ # pull the entire config
56
56
while true do
57
- sock . puts ( " \r \n " ) #paging
57
+ sock . puts ( " \r \n " ) # paging
58
58
config << sock . recv ( 1024 )
59
- #there seems to be some buffering issues. so we want to match that we're back at a prompt, as well as received the 'end' of the config.
59
+ # Read until we are back at a prompt and have received the 'end' of
60
+ # the config.
60
61
break if config . match ( />$/ ) and config . match ( /end/ )
61
- end #pull the entire config
62
+ end
63
+
62
64
config . each_line do |un |
63
65
if un . match ( /^username/ )
64
66
found_username = un . split ( " " ) [ 1 ] . strip
65
67
un_list . push ( found_username )
66
68
print_status ( " Found: #{ found_username } @#{ ip } " )
67
- end #username match
68
- end #each line in config
69
- end #end config/running-config loop
69
+ end
70
+ end
71
+ end
70
72
end
71
73
72
74
attr_accessor :no_pass_prompt
@@ -99,7 +101,7 @@ def run_host(ip)
99
101
100
102
cred_collection = prepend_db_passwords ( cred_collection )
101
103
102
- scanner = Metasploit ::Framework ::LoginScanner ::Brocade_Telnet . new (
104
+ scanner = Metasploit ::Framework ::LoginScanner ::Telnet . new (
103
105
host : ip ,
104
106
port : rport ,
105
107
proxies : datastore [ 'PROXIES' ] ,
@@ -111,6 +113,7 @@ def run_host(ip)
111
113
send_delay : datastore [ 'TCP::send_delay' ] ,
112
114
banner_timeout : datastore [ 'TelnetBannerTimeout' ] ,
113
115
telnet_timeout : datastore [ 'TelnetTimeout' ] ,
116
+ pre_login : lambda { |s | raw_send ( "enable\r \n " , nsock = s . sock ) } ,
114
117
framework : framework ,
115
118
framework_module : self ,
116
119
)
@@ -121,6 +124,7 @@ def run_host(ip)
121
124
module_fullname : self . fullname ,
122
125
workspace_id : myworkspace_id
123
126
)
127
+
124
128
if result . success?
125
129
credential_core = create_credential ( credential_data )
126
130
credential_data [ :core ] = credential_core
@@ -132,7 +136,7 @@ def run_host(ip)
132
136
print_error ( "#{ ip } :#{ rport } - LOGIN FAILED: #{ result . credential } (#{ result . status } : #{ result . proof } )" )
133
137
end
134
138
end
135
- end #end un loop
139
+ end
136
140
end
137
141
138
142
def start_telnet_session ( host , port , user , pass , scanner )
0 commit comments