@@ -24,7 +24,7 @@ def initialize
24
24
'Description' => %q{
25
25
This module attempts to authenticate to different DLink HTTP management services.
26
26
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.
28
28
It is possible that this module also works with other models.
29
29
} ,
30
30
'Author' => [
@@ -75,40 +75,16 @@ def do_login(user='admin', pass='')
75
75
if result == :success
76
76
print_good ( "#{ target_url } - Successful login '#{ user } ' : '#{ pass } '" )
77
77
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
-
101
78
report_auth_info (
102
79
:host => rhost ,
103
80
:port => rport ,
104
81
:sname => ( ssl ? 'https' : 'http' ) ,
105
82
:user => user ,
106
83
:pass => pass ,
107
- :proof => "WEBAPP=\" Generic \" , PROOF=#{ response . to_s } " ,
84
+ :proof => "WEBAPP=\" Dlink Management Interface \" , PROOF=#{ response . to_s } " ,
108
85
:active => true
109
86
)
110
87
111
- return :abort if ( [ any_user , any_pass ] . include? :success )
112
88
return :next_user
113
89
else
114
90
vprint_error ( "#{ target_url } - Failed to login as '#{ user } '" )
@@ -129,6 +105,10 @@ def do_http_login(user,pass)
129
105
"CAPTCHA" => ""
130
106
}
131
107
} )
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
+
132
112
return response
133
113
rescue ::Rex ::ConnectionError
134
114
vprint_error ( "#{ target_url } - Failed to connect to the web server" )
0 commit comments