botnet detection and prevention

78
Botnet. 1 BOTNET Detection and Prevention 黃黃黃 黃黃 黃黃黃黃黃黃黃黃黃黃黃 [email protected]

Upload: dacia

Post on 25-Feb-2016

141 views

Category:

Documents


6 download

DESCRIPTION

BOTNET Detection and Prevention. 黃能富 教授 國立清華大學資訊工程系 [email protected]. Contents. Botnet 是什麼? Botnet 有哪些架構? Botnet 能夠用來做什麼? Botnet 如何擴張? Botnet 如何偵測? Botnet 如何防治? Botnet Traffic Forensics System Conclusion. Botnet 是什麼?. 從 2004 年起 botnet 才開始被大家搜尋,也就是說這個詞從那時起才開始流行。. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: BOTNET Detection and Prevention

Botnet. 1

BOTNET Detection and Prevention

黃能富 教授國立清華大學資訊工程系

[email protected]

Page 2: BOTNET Detection and Prevention

Botnet. 2

Contents Botnet 是什麼? Botnet 有哪些架構? Botnet 能夠用來做什麼? Botnet 如何擴張? Botnet 如何偵測? Botnet 如何防治? Botnet Traffic Forensics System Conclusion

Page 3: BOTNET Detection and Prevention

Botnet. 3

Botnet 是什麼? 從 2004 年起 botnet 才開始被大家搜尋,也就是說這個詞從那時起才開始流行。

Page 4: BOTNET Detection and Prevention

Botnet. 4

Botnet 是什麼? Bot (Zombie)

受控制的被入侵電腦、俗稱為”僵屍” 或 “傀儡”。 典故應該是起源於 IRC channel 當中的自動回話機器人軟體 (robot) 。

Botnet 一群被 bot master 控制的 bots 。 所謂的”僵屍網路” 或 “傀儡網路”。

依此定義, Botnet 所涵蓋的範圍是很廣的。

Page 5: BOTNET Detection and Prevention

Botnet. 5

Botnet 有哪些架構? Botnet 依照它的命令與控制 (Command &

Control, C&C) 傳達模式一般可以分為兩種: Centralized ( 集中式 )

有專責的 servers 來傳達 C&C C&C servers 以 IRC servers 居多 EX: Agobot, SDBot, SpyBot and GT Bot.

P2P ( 點對點 ) 沒有專責的 servers 來傳達 C&C 除了自行設計外,也有使用現成的 P2P 協定

– EX: Phatbot utilizes Gnutella EX: Slapper, Sinit, Phatbot, and

Nugache.

Page 6: BOTNET Detection and Prevention

Botnet. 6

Botnet 有哪些架構? 集中式的 Botnet 架構示意圖。

在早期 C&C server 通常是 IRC Server 。

Page 7: BOTNET Detection and Prevention

Botnet. 7

2. Botnet 有哪些架構? What is IRC ?

IRC: Internet Relay Chat Protocol RFC 1459, in 1993.TCP port 6667.

簡單地說它是一個 “線上多人聊天室 ” 在台灣,相對於 BBS 它並不流行。

這表示理論上 IRC 所佔的校園網路的流量應該不多

Page 8: BOTNET Detection and Prevention

Botnet. 8

Botnet 有哪些架構? 關於 IRC 上面的 Robot:

它最初的設計理念是用來在 IRC 聊天室中自動回應其他使用者,以便取代真人,也就是所謂的 Chat Bot 。 到後來 IRC 成為木馬的溝通管道,木馬會自動連上特定的 IRC server ,成為 bot ,自動聽取主人經由 IRC 所下的命令並執行。 因此,慢慢地, botnet 就成為殭屍網路的代名詞。

Page 9: BOTNET Detection and Prevention

Botnet. 9

Botnet 能夠用來做什麼? 1. 做壞事營利 : 發 SPAM 、打 DDOS 等。 2. 租給人家做壞事營利。 ( 下圖的新聞 E)

Page 10: BOTNET Detection and Prevention

Botnet. 10

Botnet 能夠用來做什麼? 如何靠 Botnet 營利 ?

1. 賣從被害者所偷來的資料。 E-mail address book, Credit Card NO, and

so on.2. 賣 DDOS (DDOS as a Service)3. 賣 SPAM (Spam as a Service)4. 網路戰爭

Page 11: BOTNET Detection and Prevention

Botnet. 11

Botnet 能夠用來做什麼? Botnet DDOS 示意圖。

Page 12: BOTNET Detection and Prevention

Botnet. 12

Botnet 如何擴張? 根據觀察, Botnet 通常有兩種方法擴張:

1. 藉由已經存在的 bot 直接去入侵有弱點的 hosts 。 通常需要比較高的技術能力。 利用設備的弱點。

2. 藉由社交工程 ( 詐騙 ) 的手法,讓使用者心甘情願地自己把 bot 執行起來。想法子寫一隻目前的防毒軟體掃不到的毒。 利用人性的弱點。

無論是用哪個方法,最終的目的都是要把 bot 程式塞到被害人的電腦裡。

Page 13: BOTNET Detection and Prevention

Botnet. 13

Botnet 如何擴張? 藉由已經存在的 bot 直接去入侵有弱點的

hosts 。

Page 14: BOTNET Detection and Prevention

Botnet. 14

Botnet 如何擴張? 弱點週期 (Zero-Day Attack period) 。

Page 15: BOTNET Detection and Prevention

Botnet. 15

Botnet 如何擴張? 當一個系統弱點被發現之後,在 patch 或 偵測碼 出現之前的這一段時間,是所謂的

Zero-Day Period (ZDP) , 有這個弱點的設備在 ZDP 這個期間內是只有任人宰割的份。 過了 ZDP 之後,如果有弱點的機器沒有上相對的 patch ,或是防護程式沒有更新到相對的偵測碼,依然還是任人宰割。

Page 16: BOTNET Detection and Prevention

Botnet. 16

Botnet 如何擴張? 藉由社交工程 ( 詐騙 ) 的手法,讓使用者心甘情願地自己把 bot 執行起來。 ( 下圖也包含了

web 掛碼這種媒介 )

Page 17: BOTNET Detection and Prevention

Botnet. 17

Botnet 如何擴張? MSN 的社交工程 -1(騙你點 URL)

Page 18: BOTNET Detection and Prevention

Botnet. 18

Botnet 如何擴張? 點了之後,就有可能自動把 malware 抓下來執行。

Page 19: BOTNET Detection and Prevention

Botnet. 19

Botnet 如何擴張? MSN 的社交工程 -2

騙你輸入 email address 或是 MSN 帳號/密碼。

Page 20: BOTNET Detection and Prevention

Botnet. 20

Botnet 如何擴張? 壞人取得 email address 之後

發 email 進行下一階段的詐騙把你的 email address 賣給別人

壞人取得 帳號 /密碼之後 用你這個帳號密碼去 try 你別的帳號

Ex: 拿 Yahoo 的去 try Gmail 。

Page 21: BOTNET Detection and Prevention

Botnet. 21

Botnet 如何擴張? Email 社交工程 ( 人性的挑戰 )

直接把 LNK/EXE 寄給你 , 執行了你就變 bot 。

Page 22: BOTNET Detection and Prevention

Botnet. 22

Botnet 如何擴張? Anti Virus 有時不太敏感 -1

例如 2008/12/25 收到bot , 2008/12/26 送去掃

BOTNET偵測與防治技術簡介 22

Page 23: BOTNET Detection and Prevention

Botnet. 23

Botnet 如何擴張? Anti Virus 有時不太敏感 -2

Page 24: BOTNET Detection and Prevention

Botnet. 24

Botnet 如何擴張? Anti Virus 有時不太敏感 -3

Page 25: BOTNET Detection and Prevention

Botnet. 25

Botnet 如何擴張? Anti Virus 有時不太敏感 -4

AV 是一般 user 的最後一道防線,當使用者點到惡意連結,下載了一隻新毒,在上述的例子中能夠偵測它的只有 1/3 的防毒軟體,掃不到的不乏大廠。 在人性的弱點上,因為好奇或是不慎而執行了

bot ,且 AV 又沒擋住, Botnet 就是這樣擴張的。

Page 26: BOTNET Detection and Prevention

Botnet. 26

Botnet 如何偵測? 要如何知道校園網路中到底有沒有 bot 呢?

做流量分析,研究 bot 與 bot master 之間的C&C 。找 C&C connections找 bot 的網路異常行為: SPAM, DDOS 等 交叉比對之。 EX: 如果發現你有 C&C 又發 SPAM ,就猜你是

bot 。 直接針對某種類型的 bot 做 host scan 。

某些 bot 會影響主機上的 server 反應。 這特殊的反應 ( 如反應變慢 ) 可以當成判定的依據。但這種 scanner 工具並不多。

Page 27: BOTNET Detection and Prevention

Botnet. 27

Botnet 如何偵測? 下圖是 GT Bot 的部份的 C&C ,在 traffic 中找 GT Bot 的時候可以此為據。

Page 28: BOTNET Detection and Prevention

Botnet. 28

Botnet 如何偵測? 直接掃 bot 的程式

Ex: Simple Conficker Scanner

Page 29: BOTNET Detection and Prevention

Botnet. 29

Botnet 如何偵測?想法子成為 botnet 的臥底去刺探軍情。

1. 直接執行 bot ,看它跟誰聯絡。 2. 故意使用有弱點的機器當 honeypot (誘餌機 ) ,引誘入侵者。 以上這些方法都會同時錄 traffic 。

Page 30: BOTNET Detection and Prevention

Botnet. 30

Botnet 如何偵測? 刺探軍情的成果之一。

受害者 :72.10.162.2 (印尼 )

Page 31: BOTNET Detection and Prevention

Botnet. 31

Botnet 如何偵測? 刺探軍情的成果之二。

攻擊封包特徵 :IP Fraged 、 UDP 、 SP:1767 DP:1145

Page 32: BOTNET Detection and Prevention

Botnet. 32

Botnet 如何偵測? Honeypot 與 Traffic Analysis 通常可得到如下結果:

清楚 C&C traffic 的特徵明白入侵手法知道敵人從來哪來, Bot 跟何方聯絡 (IP)

因此就可以拿來作為防治的依據。例如: 偵測 /阻擋已知的 Botnet C&C traffic 偵測 /阻擋已知的 入侵手法阻擋 malicious IP list

Page 33: BOTNET Detection and Prevention

Botnet. 33

Botnet 如何偵測? Botnet 偵測上可能面臨的困難。

C&C 連線加密。 架構為 P2P or Random 。偽裝成別的通訊協定。

EX: HTTP

Page 34: BOTNET Detection and Prevention

Botnet. 34

Botnet 如何防治? 由上述可知, Botnet 之所以得以擴張,主要是因著兩方面的弱點:

設備的弱點:一開始的時候就設計不良。接著時間久了,弱點被壞人發現,但管理者沒發現。系統沒有定期更新。

人性的弱點:不知道網路上有壞人,容易被騙。好奇,被聲色所引誘。

Page 35: BOTNET Detection and Prevention

Botnet. 35

Botnet 如何防治? 建議:

一開始的時候就設計不良。EX : Buffer Overflow, SQL-Injection治標:採用 IDS/IPS/WAF 或是各式各樣的掃描器。治本:從資訊教育改進,程式設計不只是要考慮功能,還要注意安全。

接著時間久了,弱點被壞人發現,但管理者沒發現。管理者需要加強資安的敏感度,與時代同進步。

系統沒有定期更新。用正版軟體。 (安全是需要代價的 )

Page 36: BOTNET Detection and Prevention

Botnet. 36

Botnet 如何防治? Botnet 防治上可能面臨的困難。

Bug Free 的程式 / 系統 只是一個夢想? 資安教育需要很長的時間才有成效。 人的心防強度有時候容易瓦解。

EX: 被壞人投其所好。EX:偽裝老師寄給研究生的執行檔,研究生敢不開?

Page 37: BOTNET Detection and Prevention

Botnet. 37

The Botnet Traffic Forensics System

Page 38: BOTNET Detection and Prevention

Botnet. 38

Botnet Detection

1. Compromise and put some things

2. Social Engineering/SPAM3. Browsing4. Infection

5. Join Botnet/ Data Leakage

Web Servers/Landing Site/跳板 Cracker/Bot Master C&C Server

Anti-botnet Mechanism

Page 39: BOTNET Detection and Prevention

Botnet. 39

About Anti-Botnet Project

Page 40: BOTNET Detection and Prevention

Botnet. 40

About Anti-Botnet Project

Page 41: BOTNET Detection and Prevention

Botnet. 41

About Anti-Botnet Project

Page 42: BOTNET Detection and Prevention

Botnet. 42

About Anti-Botnet Project

Generated rule to detect this contact

Page 43: BOTNET Detection and Prevention

Botnet. 43

About Anti-Botnet Project

這樣做 rule 的方法是對的,但是,有個問題? Malware 的數量有多少 ?

Page 44: BOTNET Detection and Prevention

Botnet. 44

About Anti-Botnet Project Number of Malwares is very huge

Page 45: BOTNET Detection and Prevention

Botnet. 45

About Anti-Botnet Project

To analyze this huge amount of malwares, the better way is to do this automatically, and parallelization, like using cloud computing platform.

Page 46: BOTNET Detection and Prevention

Botnet. 46

About Anti-Botnet Project

Rule Matching with Known Rule Set

(snort)

Traffic to Rule Converter

Rule Matching with the Known and New Rules

(snort)

Hit/Miss

Hit

Miss

Traffic Selector

Botnet Detection

Rule Verification

Rule Optimization

End

Manual Processing

Known Rule Set

Input

Adding New Rules into Known Rule Set

Malign TrafficInputStart

Malign TrafficInput

Hit/MissHit

Miss

End

Need to Refine?

New Produced and Integrated

Rule Set

Benign TrafficInput

Optimized Rule Set

Produced

YesNo

Automatic Rule Generation Flow.

Page 47: BOTNET Detection and Prevention

Botnet. 47

About Anti-Botnet Project Our rule set (for Snort ) is available to

download on the website, updated periodically.

http://www.anti-botnet.edu.tw/index.html

Page 48: BOTNET Detection and Prevention

Botnet. 48

About Anti-Botnet Project 製作 Anti-Botnet IDS rule

2012/6 Botnet IDS Rule 組成為 (共 4,040條 Rule) 1,654 條自製 ( 由真實 bot活體網路行為轉譯 )

– 至 2012/8 止已側錄 6,234隻Malware及 Bot 2,386 條 國外公開的 botnet rule 格式採用 Snort Rule Format (Open Source)

Page 49: BOTNET Detection and Prevention

Botnet. 49

About Anti-Botnet Project

Botnet Rule 下載者來源分佈 2012/1-2012/6 來自世界各地 IP 499 個

Page 50: BOTNET Detection and Prevention

Botnet. 50

About Anti-Botnet Project

Botnet Rule 下載者來源分佈 2012/1-2012/6 來自台灣 IP 184 個

Page 51: BOTNET Detection and Prevention

Botnet. 51

Botnet Detection

1. Compromise and put some things

2. Social Engineering/SPAM3. Browsing4. Infection

5. Join Botnet/ Data Leakage

Web Servers/Landing Site/跳板 Cracker/Bot Master C&C Server

End Users

Anti-botnet Mechanism

Page 52: BOTNET Detection and Prevention

Botnet. 52

Botnet Detection

Page 53: BOTNET Detection and Prevention

Botnet. 53

Botnet IDS 與一般的 IDS 要分工合作(如下),防禦外侮與保護 servers ,不是 Botnet IDS 的責任。 Botnet IDS 應該要 得到第一手的 使用者網路行為 才能精準判斷 內賊是誰 !!

Botnet IDS 的防禦位置

Page 54: BOTNET Detection and Prevention

Botnet. 54

簡單地說: IDS 與 Botnet IDS 必須要分工合作

IDS 要盡量放外面去抵擋外侮 Botnet IDS 要盡量放裡面去觀察使用者的網路行為

Botnet IDS 對於隱藏於其 LAN 端的 DNS/Proxy/SMTP servers 後面的 Bot Host 沒有偵測能力。 DNS/Proxy/SMTP servers 會成為代罪羔羊。 所以要盡量把 DNS/Proxy/SMTP servers 放到 Botnet IDS 的 WAN 端。

Botnet IDS 的防禦位置

Page 55: BOTNET Detection and Prevention

Botnet. 55

Known and Unknown 如果說,我們對 Malware 進行動態分析,利用對 memory 的鑑識,可以規避加殼,取得 Malware 的本相以進行分析與歸類。 那 Malware 的 Traffic 是否一樣有跡可尋,可以依照其網路行為對 Malware 進行分門別類,而無視於其檔案的型態?

不管這隻 Malware 是否加殼不管是 EXE or PDF.

Page 56: BOTNET Detection and Prevention

Botnet. 56

Known and Unknown Botnet/Malware 的通訊經常偽裝成許多既有的協定。

例如: IRC 、 HTTP and P2P 因為獨創一格的通訊協定反而容易被發現

Page 57: BOTNET Detection and Prevention

Botnet. 57

Known and Unknown 在這裡唱歌的,不一定都是神經病

用 TCP 80 port 的不一定是 HTTP 。 用 UDP 53 port 的不一定是 DNS 。

Page 58: BOTNET Detection and Prevention

Botnet. 58

Known and Unknown正常的 HTTP Request and Response

Page 59: BOTNET Detection and Prevention

Botnet. 59

Known and Unknown(1)非對稱式 (Client/Server 只有一邊是用

HTTP)

Page 60: BOTNET Detection and Prevention

Botnet. 60

Known and Unknown (2) 對稱式 (Server and Client 都用 HTTP)

Page 61: BOTNET Detection and Prevention

Botnet. 61

Our Approach (3) 參數異常型 (HTTP Request 異常 )

Page 62: BOTNET Detection and Prevention

Botnet. 62

Our Approach (4) 只使用 Port 80 但是內容非 HTTP 協定

Page 63: BOTNET Detection and Prevention

Botnet. 63

Known and Unknown: 格式正常的 DNS Query

Page 64: BOTNET Detection and Prevention

Botnet. 64

Known and Unknown: 格式異常的 DNS Query

Page 65: BOTNET Detection and Prevention

Botnet. 65

Known and Unknown 目前Malware 的偽裝行為跟正常網路行為還是有些差別。

只要有心,還是可以分辨出來。但是這些分辨的方法,未必有漂亮的數學模型。

很多都是靠經驗與苦工。 這些細微的異常,是識別 Malware Traffic 與 Normal Application 的關鍵,但常常因為它們對 Servers/Network 是

Harmless 而被忽略。

Page 66: BOTNET Detection and Prevention

Botnet. 66

Known and Unknown, 過去的偵測方式主要偵測目標 主要實做方式 優點 缺點

AV-based Malware Files

針對 HTTP 、 FTP 、SMTP 與 POP3 用 proxy 的方式攔截檔案,沿用主機端的掃毒方式。

較精確 1. 慢2. 若病毒本體沒有出現在 Traffic 中,則無法察覺3. 對於已經中毒發作的 Host 缺乏偵測能力

IDS-based Harmful behavior for servers

主要先偵測 Port Scan 、 Flood、 SPAM 、 Exploits 再反推其源頭。假設其源頭為 bot 。

1. 快2. 當 Traffic 中無病毒本體也適用3. 對於已經中毒發作的 Host 具有偵測能力

1. 對於 Harmless 的 Malware 行為無法偵測2. 無法精確推斷惡意是否為Malware 所為

Page 67: BOTNET Detection and Prevention

Botnet. 67

Known and Unknown: 現在的偵測方式 現在的偵測方式 AV+IDS+VM

加 IDS解決了 對於已經中毒發作的 Host 缺乏偵測能力 可以偵測 Harmful 行為

加 VM增強了 對未知型 Malware 的偵測能力 .

但是 因為傳統 AV 和 VM 都需要把 packets 還原成檔案才有辦法動作,所以依然是慢 對於 Harmless 的 Malware 行為無法偵測

Page 68: BOTNET Detection and Prevention

Botnet. 68

Known and Unknown

我們目前除了能夠建立 “ harmful” 的行為模型外,也能夠建立 “ harmless but malicious” 的行為模型,針對未知的網路行為進行相似度的比對,可以發預警防範於未然。

Page 69: BOTNET Detection and Prevention

Botnet. 69

Known and Unknown: 網路行為 不同的 malware 族群的關係連結圖

Page 70: BOTNET Detection and Prevention

Botnet. 70

不同的 malware 族群的關係連結圖

Page 71: BOTNET Detection and Prevention

Botnet. 71

Known and Unknown: 網路行為 Based on known Malwares to

find the unknown ones.Old->New異中求同

擱置差異共創雙贏?

Page 72: BOTNET Detection and Prevention

Botnet. 72

Known and Unknown: The Family

屬於相同 Malware 族群 的關係連結圖

Page 73: BOTNET Detection and Prevention

Botnet. 73

Known and Unknown: The Family

上圖有四個不同 MD5 的 Malwares 0daf294cb73024bee7312932fa70e997

Trojan-Downloader.Win32.Agent.solm 7108b98a3c83022c42ee1375ec569a3b

Trojan-Downloader.Win32.Agent.sqai 83d2ab4747ff0d9b47bce98690312680

Trojan-GameThief.Win32.Frethoq.doh C3e7d7960590baaefbc72d601e0b6d73

Unknown by AV ( 防毒軟體尚無法偵測 )

Page 74: BOTNET Detection and Prevention

Botnet. 74

Domain Generation Algorithm Domain Generation Algorithm (DGA)

Usually, the bot tries to contact the masters periodically.

But the IP addresses of the masters are not fixed.

Fixed IP addresses are not feasible as when the masters change IP addresses or been removed. The bots are isolated.

So, the bot use the domain name to query the master IP addresses. The domain name is not changed but the IP addresses can be changed dynamically to prevent from identification.

The domain generation algorithm is used by the botnet to generate (use) the domain name dynamically.

Page 75: BOTNET Detection and Prevention

Botnet. 75

Domain Generation Algorithm Domain Generation Algorithm (DGA)

簡單地說,就是 Client (bot) 和 Server (bot master) 會依照特定的 time slot 或是在特定的條件下,使用特定 (非固定 ) 的 domain names 進行轉址通訊。

這會增加 RuleGen 自動採碼的困難。 在 A 時間所採到的 domain name /

signature 無法適用於 B 時間。 對策:

使用逆向工程找出其 Algorithm鎖 IPs, 如果不常換的話… . 其他…

Page 76: BOTNET Detection and Prevention

Botnet. 76

Domain Generation Algorithm 某一個 Malware 在觀察的期間內 , 所產生的

domain name list ( 接觸使用 )

Page 77: BOTNET Detection and Prevention

Botnet. 77

Domain Generation Algorithm Example of generated domain names

by some malware (within a long period)

Page 78: BOTNET Detection and Prevention

Botnet. 78

Conclusion

科技一直不斷地進步,網路攻擊的手法也一直不斷的翻新,與時俱進,成為防禦端不可避免的功夫。 Malware 透過加殼,可以快速變化出許多不同的實體,但是本相相同,所以會有相同的網路行為, Botnet 網路行為鑑識是可行的。 因為 Malware 數量的快速增加,使得自動化分析成為必要的手段。 DGA 會是新一代自動化採碼與分析的挑戰。