File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
modules/exploits/linux/http Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ def check_image(image_id)
61
61
'method' => 'GET' ,
62
62
'uri' => normalize_uri ( 'images' , 'json' )
63
63
)
64
- return unless res . code == 200 and res . body . include? image_id
64
+ return unless res and res . code == 200 and res . body . include? image_id
65
65
66
66
res
67
67
end
@@ -129,14 +129,24 @@ def check
129
129
'uri' => normalize_uri ( 'containers' , 'json' ) ,
130
130
'headers' => { 'Accept' => 'application/json' }
131
131
)
132
- return Exploit ::CheckCode ::Vulnerable if res . code == 200 and res . headers [ 'Server' ] . include? 'Docker'
132
+
133
+ if res . nil?
134
+ print_error ( 'Failed to connect to the target' )
135
+ return Exploit ::CheckCode ::Unknown
136
+ end
137
+
138
+ if res and res . code == 200 and res . headers [ 'Server' ] . include? 'Docker'
139
+ return Exploit ::CheckCode ::Vulnerable
140
+ end
133
141
134
142
Exploit ::CheckCode ::Safe
135
143
end
136
144
137
145
def exploit
138
146
# check if target is vulnerable
139
- fail_with ( Failure ::Unknown , 'Failed to connect to the targeturi' ) if check . nil?
147
+ unless check == Exploit ::CheckCode ::Appears
148
+ fail_with ( Failure ::Unknown , 'Failed to connect to the target' )
149
+ end
140
150
141
151
# check if image is not available, pull it or fail out
142
152
image_id = datastore [ 'DOCKERIMAGE' ]
You can’t perform that action at this time.
0 commit comments