2013 the current methodologies for apt malware traffic detection

48
The Current Methodologies for APT/Malware Traffic Detection Canaan Kao, Yu-jia Huang and Kay Kuo [email protected]

Upload: canaan-kao

Post on 14-Aug-2015

80 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: 2013 the current methodologies for apt malware traffic detection

The Current Methodologies for

APT/Malware Traffic Detection

Canaan Kao, Yu-jia Huang and Kay Kuo

[email protected]

Page 2: 2013 the current methodologies for apt malware traffic detection

Who am I?

A programmer (寫程式的人).

C/C++, Win32 SDK, Linux Kernel Programming.

A CEH.

(傳說中的駭客好人卡)

意外地參與了教育部的

Anti-Botnet 計畫,籌備了

四屆的 BoT 研討會。

(還有擔任三屆的講員….)

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

2

Page 3: 2013 the current methodologies for apt malware traffic detection

Agenda

0. 一個關於 Detection Rate 的故事

1. 目前大家實際上在用的方法

2. 一些需要去克服的問題

3. 總結

4. 參考資料

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

3

Page 4: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

在講故事之前,先把一些”詞”先定義一下:

這裡所謂的”偵測”,

都是所謂的”事後偵測”,

指的都是偵測被入侵之後該

Bot/Victim 的網路行為,進而找出未被發現的 Bot/Victim。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

4

Page 5: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

話說去年在辦完 BoT2012 之後,突然有一天心血來潮,請研究助理比較一下我們自己用 RuleGen 所產生的 rule set 與當時

Snort 的 rule set (community version)對我們所錄下來的 Malware Traffic 的偵測率。

(Snort Rule 使用 default action)

(關於 RuleGen 請參與去年的投影片)

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

5

Page 6: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

說真的,那時我只是好奇。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

6

Page 7: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

但是實驗結果,卻給了我一個驚喜!!!

(其實,驚的成分比較多)

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

7

Page 8: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

驚喜就是…. (2012/09)

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

8

Page 9: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

左邊第一條 bar,是當時RuleGen rule set 的表現,因為

traffic 是從自家收集的 Malware 錄製的,所以 100%,沒有什麼好高興的,老王賣瓜罷了。

中間的 bar,是當時 Snort Rule set 的表現,有 68%,看起來似乎不錯,也合情理,but….絕大多數的命中率由底下兩條 rules 所貢獻

FILE-IDENTIFY download of executable content

FILE-IDENTIFY Portable Executable binary file

magic detected

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

9

Page 10: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

如果我們把那兩條拿掉,Snort 當時 rule set 的成績,則會只剩下 16%,也就是最右邊那條 bar。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

10

Page 11: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

換句話說,在當時,在該實驗, Snort

之所以能夠維持 68% 的偵測率,是因為靠著偵測執行檔下載的行為,並不是偵測 Malware 的網路行為。

當你不清楚敵人的位置時,看到黑影就開槍或許也是一招。

只是無招勝有招?錯殺一百?

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

11

Page 12: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

關於該實驗的紀錄。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

12

Page 13: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

但是 16% 一直在我腦中,久久無法釋懷,因為代表一件事:

如果有人在當時,受到我們所用來實驗的 Malware 攻擊,

假設他是用 Snort 來偵測,

而他或他的MIS 又忽略偵測執行檔案下載的那兩條

rules

(那兩條只要有執行檔下載就會叫,不分好壞)。

那他在網路上對 那些Malware 在當時偵測率就是 16%

,不是 68%。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

13

Page 14: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

後來今年七月,我們又再做一次類似的實驗。

採用第三方所收集的 Malware Packet

Trace 進行實驗

http://contagiodump.blogspot.tw/2

013/04/collection-of-pcap-files-

from-malware.html

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

14

Page 15: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

15

Page 16: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

這次的結果….

2013/09/13

anti-botnet.20130708

snortrules-snapshot-2946

(SourceFire)

Hit Rate:42/75=56% Hit Rate:28/75=37%

Hit/Used Rule

Number:62

Hit/Used Rule

Number:60

The Current Methodologies for

APT/Malware Traffic Detection

16

Page 17: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

Snort Rule File:

malware-cnc.rules

最近一直持續成長

malware-cnc.rules.20130315, 657KB

malware-cnc.rules.20130613, 739KB

(大家若有興趣可以密切注意)

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

17

Page 18: 2013 the current methodologies for apt malware traffic detection

0. 一個關於 Detection Rate 的故事

故事講完了,所以這個故事告訴我們:

1. 在敵方不明的時候,

看到黑影就開槍也是一招?

2. 偵測率只能當參考,

還要看你的 training samples.

做研究的盲點….

3. 目前魔還是高一丈….

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

18

Page 19: 2013 the current methodologies for apt malware traffic detection

1. 目前大家實際上在用的方法

有時候我們不得不承認,能做研究,跟做出來的東西能用是兩回事….

雖然對研究生來說,能畢業的研究,就是好研究

但是此時不能派上用場的研究結果,不代表永遠都不能用,這其實也就是研究珍貴的地方。

底下跟大家分享一些我所知道真的有在用的偵測方法。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

19

Page 20: 2013 the current methodologies for apt malware traffic detection

1.目前大家實際上在用的方法

1.擋 IP

需要常更新

2.擋 Domain Name

DGA

計算查詢失敗率也是一招?

3.擋 HTTP host

不過有可能造假 (昨天有講員說了)

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

20

Page 21: 2013 the current methodologies for apt malware traffic detection

1.目前大家實際上在用的方法

4.抓 HTTP User-Agent

content:"User-Agent|3a| MyAgent";

5.抓 HTTP Check-in URI

uricontent:"guid="; uricontent:"ver=";

uricontent:"stat="; uricontent:"ie=";

uricontent:"os=";

6.抓 HTTP cookie

content:"|0D 0A|Cookie|3a| cid=";

pcre:"/^\d{4}\r$/Rm"; 2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

21

Page 22: 2013 the current methodologies for apt malware traffic detection

1.目前大家實際上在用的方法

7.擋 HTTP URL (Safe Browsing)

好大一張表

8.擋 Malware File (MD5-based/Pattern-based)

好大一張表

這其實就是傳統 AV 在做的事。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

22

Page 23: 2013 the current methodologies for apt malware traffic detection

1.目前大家實際上在用的方法

9.在 Firewall 上面配置 VM/Cloud.

速度是個問題…

10. 偵測到 Flooding/SPAM之類的攻擊行為 之後,再猜該來源主機是否可能是 Bot。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

23

Page 24: 2013 the current methodologies for apt malware traffic detection

2.一些需要去克服的問題

1. C&C 通訊隱藏在一般的 protocol 裡面.

FTP 的 Control Connection

DNS Query 的 payload.

HTTP Request 的 Header.

SMTP Mail Body 裡面的 MIME 資料段 (例如:

Malware 獨規的 base64)

如果你在網路上的封包中,在 SMTP 連線中發現一段解不開的 MIME,你會怎麼做?

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

24

Page 25: 2013 the current methodologies for apt malware traffic detection

2.一些需要去克服的問題

例子: 利用 FTP 的 Control Connection 來通訊

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

25

Page 26: 2013 the current methodologies for apt malware traffic detection

2.一些需要去克服的問題

例子:SMTP Mail Body 裡面的 MIME 資料段

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

26

Page 27: 2013 the current methodologies for apt malware traffic detection

2.一些需要去克服的問題

2. 通訊加密的問題

目前沒有什麼太好的解法

如果是標準的 SSL/TLS,或許可以用 SSL-Proxy 處理。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

27

Page 28: 2013 the current methodologies for apt malware traffic detection

2.一些需要去克服的問題

3. Data Leaking Detection

光 data 的定義就是個問題。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

28

Page 29: 2013 the current methodologies for apt malware traffic detection

2.一些需要去克服的問題

4. 封包裡的資料描述與本機是否相符?

如下,偽裝的很好,可是應該沒有機器裝 IE6了吧?

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

29

Page 30: 2013 the current methodologies for apt malware traffic detection

2.一些需要去克服的問題

5. 封包裡的資料描述與所傳輸的是否相符?

這不是 pdf 檔阿…. (誰有用過 IE 5.0.2?)

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

30

Page 31: 2013 the current methodologies for apt malware traffic detection

2.一些需要去克服的問題

6. 效率/速度的問題,當要查的表越來越大,要進行的檢查項目越來越多,資安設備很容易成為網路的瓶頸所在。

利用多核心?

把可加速的部分硬體化?

在 PCRE、pattern matching 都有硬體化之後,還有什麼是可以硬體化的?

7. DNS monitoring in run time

Fast-Flux

DGA

(run time 的難度,資料不足,時間有限)

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

31

Page 32: 2013 the current methodologies for apt malware traffic detection

其他事項之一:

如果有人要賣你可以偵測 APT 的商品….

你就可以拿 Mila 分享的 pcap files 來測試。

(如果無法偵測,就不要買)

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

32

Page 33: 2013 the current methodologies for apt malware traffic detection

其他事項之二:

VirusTotal 之類的網站可以用,但是你必須知道你拿什麼去交換….

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

33

Page 34: 2013 the current methodologies for apt malware traffic detection

3. 總結

1. 我們面對Malware/APT 的事後網路行為,目前的偵測率並沒有很高,尤其是當我們沒有先拿到樣本的時候。

2. 看到黑影就開槍或許可以當作沒有辦法時的辦法,但是誤判的代價是需要考量的。

3. IDS 的 engine 也需要改良,光靠死的 rule set

來偵測 Malware/APT 的行為會有其侷限性。

4. 在目前這種魔高一丈的環境,我們要進行事後偵測,依然是非常辛苦,還是要苦苦追趕

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

34

Page 35: 2013 the current methodologies for apt malware traffic detection

4. 參考資料

1. http://contagiodump.blogspot.tw/2013/04/collection-

of-pcap-files-from-malware.html

2. http://www.snort.org/

3. http://www.anti-botnet.edu.tw/

4. http://www.wireshark.org/

5. http://www.openinfosecfoundation.org/

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

35

Page 36: 2013 the current methodologies for apt malware traffic detection

Thanks for your attention

Q&A

As the host of heaven cannot be numbered, neither the sand of the

sea measured. Jer33:22

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

36

Page 37: 2013 the current methodologies for apt malware traffic detection

5 致謝

今年是 Anti-Botnet 計畫的最後一年

感謝教育部的長官們,這五年來的支持

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

37

Page 38: 2013 the current methodologies for apt malware traffic detection

5 致謝

感謝黃能富教授的信任與支持,讓我可以盡情地執行計畫。

也感謝諸位教授們以及老師們在相關合作計畫上的幫忙。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

38

Page 39: 2013 the current methodologies for apt malware traffic detection

5 致謝

感謝歷屆講師的相助,沒有你們,這個會議無法如此精彩。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

39

Page 40: 2013 the current methodologies for apt malware traffic detection

5 致謝

感謝威播科技這麼多年來的贊助,也希望大家有機會能多支持本土資安廠商。

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

40

Page 41: 2013 the current methodologies for apt malware traffic detection

5 致謝

感謝場內、場外的會議助理們,沒有你們的幫忙我們不會有這麼順利美好的會議

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

41

Page 42: 2013 the current methodologies for apt malware traffic detection

5 致謝

最後謝謝大家熱情的參與

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

42

Page 43: 2013 the current methodologies for apt malware traffic detection

BoT2014?

In case I don't see you, good afternoon,

good evening, and good night.

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

43

Page 44: 2013 the current methodologies for apt malware traffic detection

底下是附件

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

44

Page 45: 2013 the current methodologies for apt malware traffic detection

2013測試採用的 packet trace 列表

1. BIN_Andromeda_85F908A5BD0ADA2D72D138E038AECC7D_2013-04.pcap

2. BIN_ArdamaxKeylogger_E33AF9E602CBB7AC3634C2608150DD18.pcap

3. BIN_Bitcoinminer_12E717293715939C5196E604591A97DF-2013-05-12.pcap

4. BIN_CitadelPacked_2012-05.pcap

5. BIN_CitadelUnpacked_2012-05.pcap

6. BIN_Cutwail_284Fb18Fab33C93Bc69Ce392D08Fd250_2012-10.pcap

7. BIN_Cutwail-Pushdo(1)_582DE032477E099EB1024D84C73E98C1.pcap

8. BIN_Cutwail-Pushdo(2)_582DE032477E099EB1024D84C73E98C1.pcap

9. BIN_Darkmegi_2012-04.pcap

10. BIN_DarknessDDoS_v8g_F03Bc8Dcc090607F38Ffb3A36Ccacf48_2011-01.pcap

11. BIN_dirtjumper_2011-10.pcap

12. BIN_DNSChanger_2011-12.pcap

13. BIN_DNSWatch_protux_4F8A44EF66384CCFAB737C8D7ADB4BB8_2012-11.pcap

14. BIN_Drowor_worm_0f015bb8e2f93fd7076f8d178df2450d_2013-04.pcap

15. BIN_Enfal_Lurid_0fb1b0833f723682346041d72ed112f9_2013-01.pcap

16. BIN_GameThief_ECBA0FEB36F9EF975EE96D1694C8164C_2013-03.pcap

17. BIN_Gh0st_variant-v2010_B1D09374006E20FA795B2E70BF566C6D_2012-08.pcap

18. BIN_Googledocs_macadocs_2012-12.pcap

19. BIN_Gypthoy_3EE49121300384FF3C82EB9A1F06F288.pcap

20. BIN_Hupigon_8F90057AB244BD8B612CD09F566EAC0C.pcap

21. BIN_Imaut_823e9bab188ad8cb30c14adc7e67066d.pcap

22. BIN_IRCbot_c6716a417f82ccedf0f860b735ac0187_2013-04.pcap

23. BIN_IXESHE_0F88D9B0D237B5FCDC0F985A548254F2-2013-05.pcap

24. BIN_Kelihos_aka_Nap_0feaaa4adc31728e54b006ab9a7e6afa.pcap

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

45

Page 46: 2013 the current methodologies for apt malware traffic detection

2013測試採用的 packet trace 列表

25. BIN_Kuluoz-Asprox_9F842AD20C50AD1AAB41F20B321BF84B.pcap

26. BIN_LetsGo_yahoosb_b21ba443726385c11802a8ad731771c0_2011-07-19.pcap

27. BIN_Likseput_E019E37F19040059AB5662563F06B609_2012-10.pcap

28. BIN_LoadMoney_MailRu_dl_4e801b46068b31b82dac65885a58ed9e_2013-04 .pcap

29. BIN_LURK_AF4E8D4BE4481D0420CCF1C00792F484_20120-10.pcap

30. BIN_MatsnuMBRwiping_1B2D2A4B97C7C2727D571BBF9376F54F.pcap

31. BIN_Mediana_0AE47E3261EA0A2DBCE471B28DFFE007_2012-10.pcap

32. BIN_Nettravler_1f26e5f9b44c28b37b6cd13283838366.pcap

33. BIN_Nettravler_DA5832657877514306EDD211DEF61AFE_2012-10.pcap

34. BIN_Ponyloader-Zeus_B10393BE747143F3B4622E9E5277FFCE.pcap

35. BIN_PowerLoader_4497A231DA9BD0EEA327DDEC4B31DA12_2013-05.pcap

36. BIN_Ramnitpcap_2012-01.pcap

37. BIN_Reedum_0ca4f93a848cf01348336a8c6ff22daf_2013-03.pcap

38. BIN_RssFeeder_68EE5FDA371E4AC48DAD7FCB2C94BAC7-2012-06.pcap

39. BIN_Sanny-Daws_338D0B855421867732E05399A2D56670_2012-10.pcap

40. BIN_SpyEye_2010-02.pcap

41. BIN_Stabuniq_F31B797831B36A4877AA0FD173A7A4A2_2012-12.pcap

42. BIN_Taidoor_40D79D1120638688AC7D9497CC819462_2012-10.pcap

43. BIN_Tapaoux_60AF79FB0BD2C9F33375035609C931CB_winver_2011-08-23.pcap

44. BIN_Tbot_23AAB9C1C462F3FDFDDD98181E963230_2012-12.pcap

45. BIN_Tbot_2E1814CCCF0C3BB2CC32E0A0671C0891_2012-12.pcap

46. BIN_Tbot_5375FB5E867680FFB8E72D29DB9ABBD5_2012-12.pcap

47. BIN_Tbot_A0552D1BC1A4897141CFA56F75C04857_2012-12.pcap

48. BIN_Tbot_FC7C3E087789824F34A9309DA2388CE5_2012-12.pcap

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

46

Page 47: 2013 the current methodologies for apt malware traffic detection

2013測試採用的 packet trace 列表

49. BIN_Tinba_2012-06.pcap

50. BIN_TrojanCookies_840BD11343D140916F45223BA05ABACB_2012_01.pcap

51. BIN_UStealD_2b796f11f15e8c73f8f69180cf74b39d.pcap

52. BIN_Vobfus_634AA845F5B0B519B6D8A8670B994906_2012-12.pcap

53. BIN_Wordpress_Mutopy_Symmi_20A6EBF61243B760DD65F897236B6AD3-DeepEndR.pcap

54. BIN_Wordpress_Mutopy_Symmi_20A6EBF61243B760DD65F897236B6AD3-ShortRun.pcap

55. BIN_Xpaj_2012-05.pcap

56. BIN_ZeroAccess_3169969E91F5FE5446909BBAB6E14D5D_2012-10.pcap

57. BIN_ZeroAccess_Sirefef_29A35124ABEAD63CD8DB2BBB469CBC7A_2013-05.pcap

58. BIN_Zeus_b1551c676a54e9127cd0e7ea283b92cc-2012-04.pcap

59. BIN_ZeusGameover_2012-02.pcap

60. Citadel_3D6046E1218FB525805E5D8FDC605361-2013-04.pcap

61. EK_BIN_Blackhole_leadingto_Medfos_0512E73000BCCCE5AFD2E9329972208A_2013-04.pcap

62. EK_Blackhole_55A60EBB5EC6079C52CEDB6CB1DC48AD.pcap

63. EK_Blackhole_Java_CVE-2012-4681_2012-08.pcap

64. EK_Blackholev1_2012-03.pcap

65. EK_Blackholev1_2012-08.pcap

66. EK_Blackholev2_2012-09.pcap

67. EK_Smokekt150(Malwaredontneedcoffee)_2012-09.pcap

68. HorstProxy_EFE5529D697174914938F4ABF115F762-2013-05-13.pcap

69. Mswab_Yayih_FD1BE09E499E8E380424B3835FC973A8_2012-03.pcap

70. OSX_DocksterTrojan.pcap

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

47

Page 48: 2013 the current methodologies for apt malware traffic detection

2013測試採用的 packet trace 列表

71. PassAlert_B4A1368515C6C39ACEF63A4BC368EDB2-2013-05-13.pcap

72. PDF_CVE-2011-2462_Pdf_2011-12.pcap

73. purplehaze.pcap

74. RTF_Mongall_Dropper_Cve-2012-0158_C6F01A6AD70DA7A554D48BDBF7C7E065_2013-01.pcap

75. XTremeRAT_DAEBFDED736903D234214ED4821EAF99_2013-04-13.pcap

2013/09/13 The Current Methodologies for

APT/Malware Traffic Detection

48