原文地址:
前言
记录一下当使用Domain Fronting中使用https来上线时候的坑,因为查了半圈没有找到类似的资料,为啥非要https呢,因为node32对http的流量很敏感。
目标
-
使用Windows/beacon_https/reverse_https作为上线的payload
-
AWS的Cloudfront作为前置域名
准备工作
域名(example.com)
VPS(Centos)
cloudflare(只作域名解析,不添加任何其他功能,不加CDN,不加HTTPS)
HTTPS连通性
安装的apache是测试连通性,除此之外没有任何用处。
yum install httpd
systemctl start httpd
1. 增加apache配置文件
#/etc/httpd/conf.d/vhost.conf
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName example.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI}
</VirtualHost>
2. 设置https
运行脚本HTTPsC2DoneRight.sh生成对应需要的文件,比如letsencrypt、amazon.profile等文件,这个时候https会自动设置成功,测试如下:
curl http://example.com
curl https://example.com
这时候会生成https通信需要的证书文件,一般是通过自签名Letsencrypt申请下来的:
./letsencrypt-auto certonly --standalone -d 域名 --email 邮箱(可匿名)
openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out pkcs.p12 -name 域名 -passout pass:ABcd123456
keytool -importkeystore -deststorepass ABcd123456 -destkeypass ABcd123456 -destkeystore keystore.store -srckeystore pkcs.p12 -srcstoretype PKCS12 -srcstorepass ABcd123456 -alias 域名
生成的keystore是后面设置CS配置文件的时候使用。
设置CloudFront
标红的点特别注意,要改成这个样子,否则测试失败。更改之后发布,测试此时的CloudFront是否生效:
curl https://<example>.cloudfront.net
curl http://<example>.cloudfront.net
设置Profile
生成Profile,上面生成的amazon.profile测试上线失败。
cd && git clone https://github.com/bluscreenofjeff/Malleable-C2-Randomizer && cd Malleable-C2-Randomizer
python malleable-c2-randomizer.py -profile Sample Templates/Pandora.profile -notest
cp pandora_<random>.profile /root/cobaltstrike/httpsProfile/
修改profile
-
把amazon.profile的最后四行设置https的添加到pandora_.profile里面。
-
修改pandora_<random.profile里面的Host,改为aws申请下来的加速域名。
-
在profile文件最后新增配置:
https-certificate {
set keystore "keystore.store";
set password "1234565";
}
http-config {
set trust_x_forwarded_for "true";
}
设置CS
systemctl stop httpd //关闭apache
./teamserver <IP> <Pass> <path to pandora profile>
新建一个listener:
查看CS的WEBlog:
curl https://cloudfront.net/Hello
在weblog里面查看到对应的请求即设置成功。
以上转自:潇湘信安
送书福利:
本次共四本书免费赠送:
一等奖 2人:从实践中学习sqlmap数据库注入测试
本书共14章,分为3篇。第1篇“测试准备”,主要介绍sqlmap环境配置、指定目标、连接目标、探测注入漏洞及数据库类型等相关知识;第2篇“信息获取”,主要介绍如何基于sqlmap获取4种主流数据库信息(MySQL、MSSQL、Access和Oracle),以及如何手工获取数据库信息;第3篇“高级技术”,主要介绍sqlmap所使用的注入技术、访问后台数据库管理系统、优化注入、保存和输出数据、规避防火墙等相关内容。
为了感谢大家一直以来的关注与支持,会有四本书籍免费赠送。
规则如下:
1. 本文末点‘在看’,不需要转发朋友圈,点个‘在看’就可以。
2. 私聊文末公众号发送“抽奖”即可扫描参与抽奖,注意看是发送暗号“抽奖”。
3. 中奖者不满足条件1,视为放弃中奖资格。
4. 活动截止时间为4月8日 16:00点,到时候还要中奖者及时联系号主发送你的中奖核验二维码、收货地址、姓名、手机号以及想要的书籍,好给您发送书籍哦!24小时内未联系号主视为自动放弃!骗书行为出版社会永久拉黑!
先点“再看”,然后点击下方公众号私聊发送“抽奖” 即可马上扫描参与抽奖
原文始发于微信公众号(橘猫学安全):【文末赠书】Domain Fronting域前置隐藏HTTPS
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论