@@ -14,7 +14,7 @@ class Glassfish < HTTP
14
14
15
15
# @!attribute [r] version
16
16
# @return [String] Glassfish version
17
- attr_reader :version
17
+ attr_accessor :version
18
18
19
19
# @!attribute jsession
20
20
# @return [String] Cookie session
@@ -137,6 +137,23 @@ 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
+
149
+ if res && res . code . to_i == 302 && res . headers [ 'Location' ] . to_s !~ /loginError\. jsf$/
150
+ return { :status => Metasploit ::Model ::Login ::Status ::SUCCESSFUL , :proof => res . body }
151
+ end
152
+
153
+ { :status => Metasploit ::Model ::Login ::Status ::INCORRECT , :proof => res . body }
154
+ end
155
+
156
+
140
157
# Tries to login to Glassfish version 3 or 4 (as of now it's the latest)
141
158
#
142
159
# @param (see #try_glassfish_2)
@@ -176,12 +193,15 @@ def attempt_login(credential)
176
193
177
194
begin
178
195
case self . version
179
- when /^[29] \. x$/
196
+ when /^2 \. x$/
180
197
status = try_glassfish_2 ( credential )
181
198
result_opts . merge! ( status )
182
199
when /^[34]\. /
183
200
status = try_glassfish_3 ( credential )
184
201
result_opts . merge! ( status )
202
+ when /^9\. x$/
203
+ status = try_glassfish_9 ( credential )
204
+ result_opts . merge! ( status )
185
205
end
186
206
rescue ::EOFError , Errno ::ECONNRESET , Rex ::ConnectionError , OpenSSL ::SSL ::SSLError , ::Timeout ::Error => e
187
207
result_opts . merge! ( status : Metasploit ::Model ::Login ::Status ::UNABLE_TO_CONNECT , proof : e )
@@ -190,8 +210,8 @@ def attempt_login(credential)
190
210
Result . new ( result_opts )
191
211
end
192
212
193
- #
194
- # Extract the target's glassfish version from the HTTP Server header
213
+
214
+ # Extract the target's glassfish version from the HTTP Server Sun Java System Application Server 9.1header
195
215
# (ex: Sun Java System Application Server 9.x)
196
216
#
197
217
# @param banner [String] `Server` header from a Glassfish service response
0 commit comments