https://static.jiayezz.com/f2/f84395a76cdf2c0ab2d5258fcecaad

0x00        介绍

这个后门可以导致某域名被劫持,劫持的域名是可以在远程服务器控制的,有后门的固件:

       

           DI_7001-15.07.15A1.trx
           DI_7001W-15.07.15A1.trx
           DI_7002-15.07.15A1.trx
           DI_7002W-15.07.15A1.trx
           DI_7008W-14.10.11A1.trx
           DI_7100-15.07.15A1.trx
           DI_7102-14.10.11A1.trx
           DI_7200-15.07.15A1.trx
           DI_8002-14.12.18A1.trx
           DI_8002W-14.12.18A1.trx
           DI_8003-14.12.18A1.trx
           DI_8004W-14.12.18A1.trx
           DI_8005W-15.06.17A1.trx
           DI_8100-15.06.17A1.trx
           DI_8200-15.06.17A1.trx
           DI_8300-15.06.17A1.trx
           DI_8400-15.06.17A1.trx
           DI_8500-15.06.17A1.trx
           DI_8600-15.06.17A1.trx

DI系类产品都是上网行为管理认证路由器,功能比较强大,大多数都是企业在使用,可以根据京东的评论数量来推算销量,受害者至少一万。只有DI系列的系统是使用WAYOS,根据网上的说法是WAYOS的产品和D-Link的产品有很多相似度,可以使用WAYOS系统山寨D-Link产品,DI系统四位数的,国外没有卖,可以肯定受害者都是国内的。


0x01  发现之旅

以前没有被发现,因为小伙伴大多数都是使用VPN上网,所以这样的劫持起不到作用。

这个是有公司某小伙伴发现的,当打开http://www.ip138.com

http://p1.qhimg.com/t011855a55f1be9da9e.jpg

查看curl 请求www.ip138.com结果,可以看到整个返回结果都被替换了

http://p7.qhimg.com/t01e0b306cb771eeac6.png

使用traceroute , 查看是不是DNS域名解析劫持,www.ip138.com 的正确IP是222.245.77.75

http://p7.qhimg.com/t01b6d0cba0bf8d5fb1.png

http://p5.qhimg.com/t01a5dd0d9808cb1f62.png

http://p5.qhimg.com/t0182408d4a24ec6812.png

看请求www.ip138.com 整个流程

http://p0.qhimg.com/t013fb7839986812a15.jpg

异常请求了:

http://diy.szrca.com:7070/adv/202.jsp?uid=DI-8005W_CWMSQ1F5000368&ip=192.168.0.253&mac=6C-0B-XX-XX-25-85&js=0&surl=www.ip138.com/

http://union.iphonediy.com:8282/vv.zz?type=210&uid=DI-8005W_CWMSQ1F5000368&ip=192.168.0.253&mac=6C-0B-XX-XX-25-85 

http://p9.qhimg.com/t014f924baeba22bc84.jpg

http://p7.qhimg.com/t01b6656bfcb048cbd5.jpg

uid : 是路由器固件版本, ip : 是本机IP, mac : 是MAC地址

surl : 被劫持的域名

http://sh.edhlw.com/img/hkx28i 跳转到目的地页面

http://p1.qhimg.com/t01a67f4cc349a14085.jpg

通过以上可以断定是路由器出来问题,因为连我的路由器版本都知道,一定是固件安装了后门,于是去官方下载固件来分析。


0x02  下载D-Link固件

官方下载DI-8500W固件

http://p8.qhimg.com/t01ae019c7f63708ce7.png

右键复制下载地址:http://support.dlink.com.cn/download.ashx?file=509

http://p4.qhimg.com/t018a4e12d359203585.png

可以看到file都是数字,很有规律,那样我们就可以分段批量下载所有固件:

wget http://support.dlink.com.cn/download.ashx?file={1..700}  

http://p7.qhimg.com/t01d06dd2be87f29699.png

下载所有固件是为了找到没有后门的旧版本固件,结果每个系列只有一个版本,令我太失望了。

http://p1.qhimg.com/t017d8adb922e86807b.jpg

所有固件度娘:http://pan.baidu.com/s/1i5wLO8H 密码3xpm


0x03  分析DI-8500W固件

使用binwalk 解压固件:binwalk -eM DI_8005W-15.06.17A1.trx

http://p6.qhimg.com/t01f98931f7c9e785c4.png

提取字符 :  strings * > strings.txt

http://p0.qhimg.com/t01d902576240bbd68d.png

根据之前提到的,有很多关键字可以用来搜索,比如surl:

http://diy.szrca.com:7070/adv/202.jsp?uid=DI-8005W_CWMSQ1F5000368&ip=192.168.0.253&mac=6C-0B-XX-XX-25-85&js=0&surl=www.ip138.com/

http://p7.qhimg.com/t01646b5e4ae3babb2c.png

至于要分析劫持原理,有几种劫持,可以下载度娘: http://pan.baidu.com/s/1i5wLO8H 密码3xpm 里的文件D-Link-firmwares/trx/binwalk_extracted_trx_all.tar.gz 把 nvram 拖进 IDA 分析,或者建一个Qemu MIPS 虚拟机运行试试。


0x04  幕后黑手:承希广告联盟? WAYOS ? D-Link ?

相关域名:

http://diy.szrca.com:7070  ip: 119.97.180.242

       http://union.iphonediy.com:8282  ip: 119.97.180.242

       http://union.51cy.org  ip: 42.96.190.205

       http://union.116wz.com     

http://sh.edhlw.com    ip:119.147.249.218

右键查看源码http://diy.szrca.com:7070

http://p8.qhimg.com/t015f0849b69d415a00.jpg

WAYOS信息

http://p6.qhimg.com/t01f85737a5df89e004.png

Whois 信息 :

                 whois szrca.com
                 Domain Name: szrca.com
                 Registry Domain ID: 2041192643_DOMAIN_COM-VRSN
                 Registrar WHOIS Server: whois.maff.com
                 Registrar URL: http://www.maff.com
                 Updated Date: 2016-07-09T10:42:48Z
                 Creation Date: 2016-07-09T02:51:36Z
                 Registrar Registration Expiration Date: 2017-07-09T02:51:36Z
                 Registrar: Flappy Domain, Inc
                 Registrar IANA ID: 1872
                 Registrar Abuse Contact Email: abuse@maff.com
                 Registrar Abuse Contact Phone: +86.5925990220
                 Domain Status: clientTransferProhibited                                                 https://icann.org/epp#clientTransferProhibited 
                 Registry Registrant ID: 
                 Registrant Name: wenben zhou
                 Registrant Street: yuehualu11hao
                 Registrant City: xiamen
                 Registrant State/Province: fujian
                 Registrant Postal Code: 366155
                 Registrant Country: China
                 Registrant Phone: +86.13566778899
                 Registrant Phone Ext: 
                 Registrant Fax: 
                 Registrant Fax Ext: 
                 Registrant Email: dt0598@outlook.com
                 Registry Admin ID: 
                 Admin Name: wenben zhou
                 Admin Street: yuehualu11hao
                 Admin City: xiamen
                 Admin State/Province: fujian
                 Admin Postal Code: 366155
                 Admin Country: China
                 Admin Phone: +86.13566778899
                 Admin Phone Ext: 
                 Admin Fax: 
                 Admin Fax Ext: 
                 Admin Email: dt0598@outlook.com
                 Registry Tech ID: 
                 Tech Name: wenben zhou
                 Tech Street: yuehualu11hao
                 Tech City: xiamen
                 Tech State/Province: fujian
                 Tech Postal Code: 366155
                 Tech Country: China
                 Tech Phone: +86.13566778899
                 Tech Phone Ext: 
                 Tech Fax: 
                 Tech Fax Ext: 
                 Tech Email: dt0598@outlook.com
                 Name Server: F1G1NS1.DNSPOD.NET
                 Name Server: F1G1NS2.DNSPOD.NET
                 DNSSEC: Unsigned
                 URL of the ICANN WHOIS Data Problem Reporting System:                                          http://wdprs.internic.net/
                 >>> Last update of WHOIS database: 2016-08-25T16:25:48Z <<<

Whois 信息 :

                 whois iphonediy.com
                 Domain Name: iphonediy.com
                 Registry Domain ID: 76254
                 Registrar WHOIS Server: whois.oray.com
                 Registrar URL: http://www.oray.com
                 Updated Date: 2015-11-27T00:16:37Z
                 Creation Date: 2014-03-31T17:21:57Z
                 Registrar Registration Expiration Date: 2017-03-31T17:21:57Z
                 Registrar: SHANGHAI BEST ORAY INFORMATION S&T CO., LTD.
                 Registrar IANA ID: 1518
                 Registrar Abuse Contact Email: ken@oray.com
                 Registrar Abuse Contact Phone: +86.2062219000
                 Reseller: www.oray.com
                 Domain Status: clientTransferProhibited,clientDeleteProhibited
                 Registry Registrant ID: shbr-7dg4g676722
                 Registrant Name: tony fu
                 Registrant Organization: tony
                 Registrant Street: xiongchudadao
                 Registrant City: wuhan
                 Registrant State/Province: hubei
                 Registrant Postal Code: 430079
                 Registrant Country: CN
                 Registrant Phone: +86.15819829012
                 Registrant Phone Ext: 
                 Registrant Fax: +86.27878671020
                 Registrant Fax Ext: 
                 Registrant Email: 87829128@qq.com
                 Registry Admin ID: shbr-7dg4g674146
                 Admin Name: tony fu
                 Admin Organization: tony
                 Admin Street: xiongchudadao
                 Admin City: wuhan
                 Admin State/Province: hubei
                 Admin Postal Code: 430079
                 Admin Country: CN
                 Admin Phone: +86.15819829012
                 Admin Phone Ext: 
                 Admin Fax: +86.27878671020
                 Admin Fax Ext: 
                 Admin Email: 87829128@qq.com
                 Registry Tech ID: shbr-7dg4g674146
                 Tech Name: tony
                 Tech Organization: tony
                 Tech Street: xiongchudadao
                 Tech City: wuhan
                 Tech State/Province: hubei
                 Tech Postal Code: 430079
                 Tech Country: CN
                 Tech Phone: +86.15819829012
                 Tech Phone Ext: 
                 Tech Fax: +86.27878671020
                 Tech Fax Ext: 
                 Tech Email: 87829128@qq.com
                 Name Server: ns1.oray.net,ns2.oray.net
                 DNSSEC: unsigned

类似作者信息:

http://p6.qhimg.com/t01dd58d9b6fa95b3fd.png

http://p6.qhimg.com/t012efb6b849c0f3ca0.jpg

http://p0.qhimg.com/t01bb8dec0ae9d8a9e5.jpg

我就不妄下评论了


0x05  威胁评估

导致DNS劫持,挂马,钓鱼,钱包空空,敏感信息泄露,账号和密码泄露……


0x06  解决方法

有条件的可以换一个设备,或者使用防火墙禁止diy.szrca.com ,*.szrca.com , *.wayos.net , union.51cy.org, *.51cy.org, *.wayos.cn, *.wayos.net , *.wayos[1-10].cn , union.iphonediy.com ,*.iphonediy.com,*.wayos.com ,sh.edhlw.com ,*.edhlw.com


0x07  总结

毕竟时间有限,还有别的事情要做,哪里没有不专业的地方,请多多包涵,我已经提交某漏洞平台,有疑问的或有建议的可以发我邮件:

http://p1.qhimg.com/t0121a721198a30fb9f.png

文章原文链接:https://www.anquanke.com/post/id/84490