Skip to content

Commit 2b4d6eb

Browse files
author
m-1-k-3
committed
feedback included, server header check
1 parent aa981cc commit 2b4d6eb

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

modules/auxiliary/scanner/http/dlink_dir_300b_600b_815_http_login.rb

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def initialize
2424
'Description' => %q{
2525
This module attempts to authenticate to different DLink HTTP management services.
2626
Tested devices: D-Link DIR-300 Hardware revision B, D-Link DIR-600 Hardware revision B,
27-
D-Link DIR-815 Hardware revision A and DIR-645 Hardware revision A.
27+
D-Link DIR-815 Hardware revision A and DIR-645 Hardware revision A.
2828
It is possible that this module also works with other models.
2929
},
3030
'Author' => [
@@ -75,40 +75,16 @@ def do_login(user='admin', pass='')
7575
if result == :success
7676
print_good("#{target_url} - Successful login '#{user}' : '#{pass}'")
7777

78-
any_user = false
79-
any_pass = false
80-
81-
vprint_status("#{target_url} - Trying random username with password:'#{pass}'")
82-
any_user = determine_result(do_http_login(Rex::Text.rand_text_alpha(8), pass))
83-
84-
vprint_status("#{target_url} - Trying username:'#{user}' with random password")
85-
any_pass = determine_result(do_http_login(user, Rex::Text.rand_text_alpha(8)))
86-
87-
if any_user == :success
88-
user = "anyuser"
89-
print_status("#{target_url} - Any username with password '#{pass}' is allowed")
90-
else
91-
print_status("#{target_url} - Random usernames are not allowed.")
92-
end
93-
94-
if any_pass == :success
95-
pass = "anypass"
96-
print_status("#{target_url} - Any password with username '#{user}' is allowed")
97-
else
98-
print_status("#{target_url} - Random passwords are not allowed.")
99-
end
100-
10178
report_auth_info(
10279
:host => rhost,
10380
:port => rport,
10481
:sname => (ssl ? 'https' : 'http'),
10582
:user => user,
10683
:pass => pass,
107-
:proof => "WEBAPP=\"Generic\", PROOF=#{response.to_s}",
84+
:proof => "WEBAPP=\"Dlink Management Interface\", PROOF=#{response.to_s}",
10885
:active => true
10986
)
11087

111-
return :abort if ([any_user,any_pass].include? :success)
11288
return :next_user
11389
else
11490
vprint_error("#{target_url} - Failed to login as '#{user}'")
@@ -129,6 +105,10 @@ def do_http_login(user,pass)
129105
"CAPTCHA" => ""
130106
}
131107
})
108+
return if response.nil?
109+
return if (response.headers['Server'].nil? or response.headers['Server'] !~ /Linux,\ HTTP\/1.1,\ DIR-.*Ver\ .*/)
110+
return if (response.code == 404)
111+
132112
return response
133113
rescue ::Rex::ConnectionError
134114
vprint_error("#{target_url} - Failed to connect to the web server")

0 commit comments

Comments
 (0)