@@ -137,6 +137,33 @@ def try_glassfish_2(credential)
137
137
end
138
138
139
139
140
+ # Tries to login to Glassfish version 9
141
+ #
142
+ # @param credential [Metasploit::Framework::Credential] The credential object
143
+ # @return [Hash]
144
+ # * :status [Metasploit::Model::Login::Status]
145
+ # * :proof [String] the HTTP response body
146
+ def try_glassfish_9 ( credential )
147
+ res = try_login ( credential )
148
+ if res && res . code == 302
149
+ opts = {
150
+ 'uri' => '/applications/upload.jsf' ,
151
+ 'method' => 'GET' ,
152
+ 'headers' => {
153
+ 'Cookie' => "JSESSIONID=#{ self . jsession } "
154
+ }
155
+ }
156
+
157
+ res = send_request ( opts )
158
+ if res && res . code . to_i == 302 && res . headers [ 'Location' ] . to_s !~ /loginError\. jsf$/
159
+ return { :status => Metasploit ::Model ::Login ::Status ::SUCCESSFUL , :proof => res . body }
160
+ end
161
+ end
162
+
163
+ { :status => Metasploit ::Model ::Login ::Status ::INCORRECT , :proof => res . body }
164
+ end
165
+
166
+
140
167
# Tries to login to Glassfish version 3 or 4 (as of now it's the latest)
141
168
#
142
169
# @param (see #try_glassfish_2)
@@ -176,12 +203,15 @@ def attempt_login(credential)
176
203
177
204
begin
178
205
case self . version
179
- when /^[29] \. x$/
206
+ when /^2 \. x$/
180
207
status = try_glassfish_2 ( credential )
181
208
result_opts . merge! ( status )
182
209
when /^[34]\. /
183
210
status = try_glassfish_3 ( credential )
184
211
result_opts . merge! ( status )
212
+ when /^9\. x$/
213
+ status = try_glassfish_9 ( credential )
214
+ result_opts . merge! ( status )
185
215
end
186
216
rescue ::EOFError , Errno ::ECONNRESET , Rex ::ConnectionError , OpenSSL ::SSL ::SSLError , ::Timeout ::Error => e
187
217
result_opts . merge! ( status : Metasploit ::Model ::Login ::Status ::UNABLE_TO_CONNECT , proof : e )
@@ -191,7 +221,7 @@ def attempt_login(credential)
191
221
end
192
222
193
223
#
194
- # Extract the target's glassfish version from the HTTP Server header
224
+ # Extract the target's glassfish version from the HTTP Server Sun Java System Application Server 9.1header
195
225
# (ex: Sun Java System Application Server 9.x)
196
226
#
197
227
# @param banner [String] `Server` header from a Glassfish service response
0 commit comments