﻿# 小心網域名稱伺服器快取毒害(DNS cache poisoning)攻擊

DNS ([Domain Name System](http://en.wikipedia.org/wiki/Domain_name_system)) 是一個年代久遠且相當重要的網路服務之一，詳細的運作行細節我不談，請自行到 [域名服務器](http://zh.wikipedia.org/w/index.php?title=%E5%9F%9F%E5%90%8D%E6%9C%8D%E5%8B%99%E5%99%A8&variant=zh-tw)(Wikipedia) 學習相關知識。簡單的說，DNS 通常都會實做快取(Cache)功能，若 DNS 收到來自惡意假造的 DNS 封包，導致將錯誤的 Domain Name v.s. IP 對應資料快取在 DNS Server 中，就會讓使用這台 DNS Server 的使用者連結到錯誤的 IP，這將會是個十分嚴重的安全性漏洞！而這樣的安全性漏洞就稱之為 [DNS cache poisoning](http://en.wikipedia.org/wiki/DNS_cache_poisoning)。

你可能很難想像，一台具有高度 [DNS cache poisoning](http://en.wikipedia.org/wiki/DNS_cache_poisoning) 漏洞風險的 DNS 主機，只要幾秒鐘就可以被置入一個假的 DNS 紀錄，而快取的時間有可能會超過 1 天。不相信嗎？請看看 [這個影片](http://www.checkpoint.com/defense/advisories/public/dnsvideo/index.html) 有清楚、詳細的動畫說明攻擊的原理，以及 [這個影片](https://web.archive.org/web/20120612135419/https://www.sec-consult.com/files/sec2.html) 有示範如何成功發動攻擊。

[IANA – Internet Assigned Numbers  Authority](http://www.iana.org/) 提供了一個[線上檢測工具](http://recursive.iana.org/)，各位可以上去測看看你的 DNS Server 或你 ISP 的 DNS Server 是否有 [DNS cache poisoning](http://en.wikipedia.org/wiki/DNS_cache_poisoning) 漏洞：

> Cross-Pollination Check  
> [http://recursive.iana.org/](http://recursive.iana.org/ "http://recursive.iana.org/")

這個檢測工具會回應三種安全警示：

1.  Highly vulnerable - 極易受傷的 ( 高度風險 ) ( 紅色底 )
2.  Vulnerable - 易受傷的( 低度風險, 但還是有風險 ) ( 棕色底 )
3.  Safe - 安全等級 ( 綠色底 )

我們公司的 DNS Server 已經架了好多年了，作業系統是 Fedora Core 3，我自己用這個線上檢測工具測試過後發現竟然是 Highly vulnerable 等級，讓我嚇了一跳，緊急在上週將 Bind 8 升級到 Bind 9 最新版修復了這個問題。

我也測試了好多個知名的 ISP 提供的 DNS Server，發現全台灣最多人用的 HiNet DNS 伺服器 ( 168.95.1.1 ) 竟然是 Vulnerable 等級 ( 可以用 hinet.net 進行檢測 )，感覺有點糟就是了，以後不敢再用這台了。另外像是 sparq.com.tw 是屬於 Highly vulnerable 等級，還有 seed.net.tw , apol.com.tw 是 Vulnerable 等級，最後好險測到我最我常用的 so-net.net.tw 是 Safe 等級。

最後奉勸各位，若你有任何 DNS Server 超過 1 ~ 2 年沒更新的，幾乎都有 [DNS cache poisoning](http://en.wikipedia.org/wiki/DNS_cache_poisoning) 弱點存在，不管是哪個平台的 DNS Server，因為這是 DNS 設計上的瑕疵，目前大部分知名的 DNS Server 軟體新的版本都已經修正此問題，或已提供更新，或有解決方案了，上網找一下就有了，底下我列出一些相關連結供各位參考。

**相關連結**

-   [DNS cache poisoning - Wikipedia](http://en.wikipedia.org/wiki/DNS_cache_poisoning)
-   [域名服務器緩存污染 – Wikipedia](http://zh.wikipedia.org/wiki/%E5%9F%9F%E5%90%8D%E6%9C%8D%E5%8B%99%E5%99%A8%E7%B7%A9%E5%AD%98%E6%B1%A1%E6%9F%93)
-   [Dan Kaminsky](http://en.wikipedia.org/wiki/Dan_Kaminsky)
-   [US-CERT](http://www.us-cert.gov/): [Vulnerability Note VU#800113 - Multiple DNS implementations vulnerable to cache poisoning](http://www.kb.cert.org/vuls/id/800113)
-   [Cross-Pollination Check](http://recursive.iana.org/)
-   [DNS Cache Poisoning Vulnerability](http://www.iana.org/about/presentations/davies-viareggio-entropyvuln-081002.pdf) \[英文的 PDF 簡報檔\]
-   [DNS Cache Poisoning Attack](http://www.checkpoint.com/defense/advisories/public/dnsvideo/index.html) \[英文, 動畫說明攻擊的原理與過程\]
-   Frequently Asked Questions on Cache Poisoning and Cross Pollination
-   [How to prevent DNS cache pollution](https://web.archive.org/web/20100601212446/http://support.microsoft.com/kb/241352)
-   [Microsoft Security Bulletin MS08-037 – Important](https://learn.microsoft.com/en-us/security-updates/securitybulletins/2008/ms08-037)
-   網域名稱伺服器快取毒害(DNS cache poisoning)攻擊暨漏洞修補通知
-   (MS08-037) Microsoft DNS Cache Poisoning Vulnerability (953230)
-   [After 6 months - fix available for Microsoft DNS cache poisoning attack](https://seclists.org/bugtraq/2007/Nov/175)
-   Microsoft issues DNS poisoning advisory 
-   [porttest.dns-oarc.net -- Check your resolver's source port behavior](https://www.dns-oarc.net/oarc/services/porttest)
-   [What is Cache poisoning?](https://www.techtarget.com/searchsecurity/definition/cache-poisoning)
-   [DNS cache poisoning 快取毒害漏洞](http://nvoms123.blogspot.com/2008/08/dns-cache-poisoning.html)
-   [DNS cache poisoning - Google 搜尋](http://www.google.com.tw/search?hl=zh-TW&q=DNS+cache+poisoning&meta=&aq=f&oq=)
-   [DNS 攻擊程式碼已於網路散佈](https://web.archive.org/web/20110720202805/http://www.zdnet.com.tw/news/software/0,2000085678,20130739,00.htm) \[[ZDNet Taiwan](http://www.zdnet.com.tw/)\]
