Files
metasploit-gs/modules/auxiliary/scanner/http/docker_version.rb
T

58 lines
1.8 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report
2018-07-11 16:52:16 -04:00
def initialize(info = {})
super(update_info(info,
'Name' => 'Docker Server Version Scanner',
2018-07-11 01:27:10 -04:00
'Description' => %q{
2018-07-12 02:56:47 -05:00
This module attempts to identify the version of a Docker Server running on a
2018-07-11 01:27:10 -04:00
host. If you wish to see all the information available, set VERBOSE to true.
},
2018-07-11 00:03:26 -04:00
'Author' => [ 'Agora-Security' ],
'License' => MSF_LICENSE
2018-07-11 17:04:31 -04:00
))
register_options(
[
2018-07-11 00:41:55 -04:00
Opt::RPORT(2375)
])
end
def run_host(ip)
res = send_request_cgi({
2018-07-12 02:56:47 -05:00
'uri' => '/version',
2018-07-10 23:53:13 -04:00
'method' => 'GET'})
2018-07-10 23:56:05 -04:00
if res.nil? || res.code != 200
print_error("[Docker Version] failed to identify version")
return
end
2018-07-10 23:56:05 -04:00
result = res.get_json_document
2018-07-11 00:41:55 -04:00
print_status("Identifying Docker Server Version on #{peer}")
print_good("[Docker Server] Version: #{result['Version']}")
2018-07-11 00:41:55 -04:00
print_status ("All info: #{result.to_s}") if datastore['VERBOSE']
2018-07-11 00:47:43 -04:00
report_note(
:host => ip,
2018-07-12 02:56:47 -05:00
:port => rport,
2018-07-11 00:47:43 -04:00
:proto => 'tcp',
:ntype => 'docker_version',
2018-07-11 17:22:48 -04:00
:data => result['Version'],
:info => "Docker Server v.#{result['Version']}"
)
print_status("Saving host information.")
report_host(
:host => ip,
:arch => result['Arch'],
:detected_arch => result['Arch'],
:os_family => result['Os'],
:info => "Docker Server v.#{result['Version']} Kernel Version: #{result['KernelVersion']}"
2018-07-11 00:47:43 -04:00
)
end
end