MS 1,a) 2,b) 2 MS Rich Text Compound File Binary MS MS MS 98.4% MS MS Methods to Detect Malicious MS Document File using File Structure Inspection Abstract: Today, the number of targeted attacks is increasing, and targeted attacks are becoming a serious threat for many organizations. There are various kinds of targeted attacks. Above all, a method to attach malware to interesting e-mail for the recipient is the most popular. In general, there is no way to distinguish a malicious document file from a normal one, because malware is embedded in a document file to hide oneself during an attack. We analyzed malicious MS document (Rich Text or Compound File Binary) files containing malware. Then, we found that there are differences in file structure between normal MS document files and malicious ones. In this paper, we propose detection methods of malicious MS document files using file structure inspection. Specifically, we propose five novel malware detection methods. The experimental result shows the effectiveness of the methods. The methods could detect 98.4% of the malicious MS document files in the experiment. Keywords: targeted attack, malware, MS document file, static analysis, detection 1. 2007 5.4%2011 33%? 1 NISC, Chiyoda, Tokyo 100 0014, Japan 2 IISEC, Yokohama, Kanagawa 221 0835, Japan a) yuhei.otsubo@cas.go.jp b) dgs104101@iisec.ac.jp exploit shellcode shellcode 1
exploit CFB Compound File Binary? doc xls ppt Rich Text? rtf MS MS MS MS MS MS MS MS 2. MS MS exploit MS? MS OfficeMalScanner? MS MS? MS MS MS 4 4 1 MS Fig. 1 {\rtf Hello,\par {\b world}!\par } 1 Rich Text An example of a Rich Text format file. MS MS MS 3. MS exploit MS MS 3.1 Rich Text 3.1.1 Rich Text 7bit ASCII Rich Text?? { Rich Text { } EOF 3.1.2 1 EOF Rich Text } EOF Rich Text EOF 3.2 CFB 3.2.1 Microsoft Word Microsoft Excel Microsoft Power- Point doc xls ppt CFB CFB Stream Storage CFB 512Byte sector index 2
Stream sector sector sector FAT File Allocation Table n sector sector FAT n 4Byte sector -2 sector Free Sector sector -1 Stream Storage DE Directory Entry 3.2.2 2 CFB sector sector 0 Size file sector Size sector (Size file 512) mod Size sector = 0 (1) CFB CFB sector (??) 3.2.3 3 FAT FAT sector1 4Byte FAT sector1 Size sector 4 sector FAT sector Count FAT FAT Size FAT Size FAT = Count FAT Size sector 4 (2) CFB FAT Size file 512 Size FAT (3) CFB FAT (??) 3.2.4 4 Free Sector? Free Sector sector CFB Free Sector MS Free Sector CFB sector Free Sector 3.2.5 5 sector CFB sector DIFAT Double-Indirect FAT FAT minifat DE Stream Free Sector 6 DIFAT FAT sector minifat Stream CFB 6 sector 4. Python 4.1 MS Rich Text CFB Rich Text CFB MS 4.2 1Byte EOF } 4.3 CFB 30Byte sector 2Byte SectorShift sector Size sector 2 SectorShift?? (??) 4.4 CFB 44Byte FAT sector 4Byte Count FAT?? (??) Size FAT?? (??) 4.5 CFB sector index n CFB 512Byte n + 1 sector Size file 3
Size file = 512 + (n + 1) Size sector (4) n n FAT -1 Free Sector 4.6 CFB FAT sector sector1 CFB sector FAT DE sector sector Count real sector Count real = (Size file 512) Size sector (5) FAT sector Count FAT CFB 44Byte 4Byte minifat sector Count minifat CFB 64Byte 4Byte DIFAT sector Count DIFAT CFB 72Byte 4Byte DE Stream sector index CFB 48Byte 4Byte index FAT DE sector Count DE Stream sector DE DE 128Byte 120Byte Stream 4Byte Stream Stream Root Entry Stream Root Entry Stream CFB 56Byte 4Byte Size mini Directory Entry n Stream Size n Stream sector Count n Size n Size mini Stream Root Entry Count n 0 Size n Size mini Size n sector Count n Stream sector Count Stream Stream sector Free Sector Count free FAT -1 sector sector Count theoretical Count FAT Count minifat Count DIFAT Count DE Count Stream Count free CFB sector Table 1 1 A summary of the speciments. (KB) (KB) rtf 98 266.5 199 516.2 doc 36 252.2 1195 106.1 xls 49 180.4 298 191.7 Table 2 CPU Memory OS 2 Memory(VM) OS(VM) An experimental environment. Core i5-3450 3.1GHz 8.0GB Windows 7 SP1 2.0GB Windows XP SP3 Interpreter(VM) Python 2.7.3 sector 5. 5.1 MS MS???? 2009 2012 MS doc Rich Text rtf OfficeMalScanner?? contagio clean? html MS?? 5.2?? 4
3 Table 3 Detection rates of the test program. rtf 97 99.0% 0.021s doc 35 97.2% 0.062s xls 48 98.0% 0.051s 180 98.4% 0.037s 4 Table 4 Detection rates of the features. Table 5 5 Comparing detection rates with antivirus softwares, etc. 180 98.4% T AV 41 22.4% S AV 37 20.2% M AV 42 23.0% T,S,M AV 82 44.8% OfficeMalScanner 167 91.3% 1 97 / 98 99.0% 2 65 / 85 76.4% 3 77 / 85 90.6% 4 82 / 85 96.5% 5 81 / 85 95.3% 98.4% 0.037s 0.125s 180?? rtf doc xls OfficeMalScanner?? 20.2% 23.0% 3 44.8% OfficeMalScanner shellcode SCAN BRUTE Rich Text OfficeMalScanner RTFScan SCAN OfficeMalScanner OfficeMalScanner RTFScan OfficeMalScanner 91.3% 1,692?? 0.9% xls 4.7% 6. 6.1 1 6 Table 6 False positive rate of the test program. rtf 0 0.0% doc 2 0.2% xls 14 4.7% 16 0.9% exploit exploit MS exploit exploit 3 2? OfficeMalScanner 6.2 2 html html 4KByte html html MS MS sector sector sector 5
MS MS MS contagio 6.3 0.037s 98.4% MS 0.9%, zip zip 76.4% MS MS OfficeMalScanner? MS MS exploit MS MS exploit exploit exploit 7. MS MS 5 MS 5 0.037s 98.4% MS 5 2009 2012 MS MS MS Stream PDF [1] (online) http://www.meti.go.jp/ press/2011/05/20110527004/20110527004.html (2013-05-08). [2] Microsoft [MS-CFB]: Compound File Binary File Format(online) http://msdn.microsoft.com/enus/library/dd942138.aspx (2013-05-22). [3] Microsoft Rich Text Format (RTF) Specification, version 1.9.1(online) http://www.microsoft.com/en-us/download/ details.aspx?id=10725 (2013-05-22). [4] Handy Scissors, Vol.54, No.3, pp.1211-1219 (2013). [5] Boldewin, F. Analyzing MSOffice malware with Office- MalScanner(online) http:// www.reconstructer.org/papers/analyzing%20msoffice %20malware%20with%20OfficeMalScanner.zip (2013-05-08). [6] Hyukdon, K. Yeog, K. Sangjin, L. and Jongin, L. A Tool for the Detection of Hidden Data in Microsoft Compound Document File Format ICISS 08 Proceedings of the 2008 International Conference on Information Science and Security, pp.141-146 (2008). [7] Mila, P. 16,800 clean and 11,960 malicious files for signature testing and research(online) http://contagiodump.blogspot.jp/2013/03/16800- clean-and-11960-malicious-files.html (2013-05-21). 6
大坪雄平, 三村守, 田中英彦 : ファイル構造検査による悪性 MS 文書ファイルの検知, 情報処理学会研究報告, Vol 2013-IOT-22, No.16 (2013) 頁 1 1. はじめに 中 頁 2 1. はじめに 中 頁 2 2. 関連研究 中 頁 2 2. 関連研究 中 頁 2 2. 関連研究 中 頁 2 3.1.1 基本構造 中頁 3 3.2.2 特徴 2: ファイルサイズ違反 中頁 3 3.2.3 特徴 3:FAT 参照不可領域 中頁 3 3.2.4 特徴 4:Free Sector 位置違反 中 頁 3 4.3 特徴 2 の判定 中 頁 3 4.4 特徴 3 の判定 中 頁 4 5.1 実験内容 中 頁 4 5.1 実験内容 中 頁 4 5.1 実験内容 中 頁 4 5.2 実験結果 中頁 5 5.2 実験結果 中 頁 5 5.2 実験結果 中 頁 5 5.2 実験結果 中 頁 5 6.1 検知に失敗した原因 中 頁 6 6.3 試験プログラムの効果 中 正誤表誤 2011 年には約 6 倍の 33% に拡大? するなど, 正 2011 年には約 6 倍の 33% に拡大 [1] するなど, CFB(Compound File Binary)?(doc, CFB(Compound File Binary)[2]doc, xls,ppt 拡張子 ) やRich Text?(rtf xls, ppt 拡張子 ) や Rich Text[3] 拡張子 ) (rtf 拡張子 ) 文献? では, 様々な形式の悪性文書ファ文献 [4] では, 様々な形式の悪性文書イルに埋め込まれた実行ファイルを自ファイルに埋め込まれた実行ファイル動的に抽出するツールが提案されていを自動的に抽出するツールが提案される. ている. MS 文書ファイル専用の解析ツールである OfficeMalScanner? は, MS 文書ファイル専用の解析ツールである OfficeMalScanner[5] は, 文献? では,MS 文書ファイルの構造を文献 [6] では,MS 文書ファイルの構造検査することにより,MS 文書ファイルを検査することにより,MS 文書ファイに埋め込まれた, 表示内容と関係のなルに埋め込まれた, 表示内容と関係のいデータを解析するツールが提案されないデータを解析するツールが提案さている. れている. 単純な Rich Text の例を図?? に示す. 単純な Rich Text の例を図 1 に示す. 上記 (??) 式が成り立たないものがあっ上記 (1) 式が成り立たないものがあった. た. 上記 (??) 式が成り立たないものがあっ上記 (3) 式が成り立たないものがあった. た. 文献? で検索しているFree Sector につ文献 [6] で検索しているFree Sector にいてファイル末尾に該当するsectorについてファイル末尾に該当するsector 絞ってに絞って この値を用いて?? の (??) 式が成り立たない場合に特徴 2 の検知とした. この値を用いて 3.2.2 の (1) 式が成り立たない場合に特徴 2 の検知とした.?? の (??) 式からSize FAT を計算し,?? の 3.2.3 の (2) 式から Size FAT を計算し, (??) 式が成り立たない場合に特徴 3の検 3.2.3の (3) 式が成り立たない場合に特知とした. 徴 3の検知とした. 実験の対象となるMS 文書ファイルの概実験の対象となるMS 文書ファイルの概要を表?? に示す. 表?? の左側の検体要を表 1に示す. 表 1の左側の検体は, は, 表?? の右側の検体はマルウェアダンプ表 1の右側の検体はマルウェアダンプササイトcontagioでマルウェアではないイト contagio でマルウェアではない (clean) とされ 研究用に公開された (clean) とされ 研究用に公開された検体? である. 検体 [7] である. 実験を実施する環境は表?? に示すとおりであり, 実験を実施する環境は表 2 に示すとおりであり, 検体の拡張仕事の検知率を表?? に示検体の拡張仕事の検知率を表 3に示す. す. 検知に成功した180 体の検体の特徴ごと検知に成功した180 体の検体の特徴ごとの検知状況は表?? に示すとおりであの検知状況は表 4に示すとおりである. る. OfficeMalScanner の検知率との比較結果を表?? に示す. マルウェアではないとされた検体 1,692 体に関する誤検知率を表?? に示す. OfficeMalScanner の検知率との比較結果を表 5 に示す. マルウェアではないとされた検体 1,692 体に関する誤検知率を表 6 に示す. 検知に失敗した3 個のうち2 個は, 文献? 検知に失敗した3 個のうち2 個は, 文献またはOfficeMalScanner で検知するこ [4] またはOfficeMalScannerで検知するとができた. ことができた. 文献? はエンコード方式を解析し埋め込まれた実行ファイルを検知するが, 文献 [4] はエンコード方式を解析し埋め込まれた実行ファイルを検知するが,