1
0
mirror of https://github.com/nganhkhoa/malware.git synced 2024-06-10 21:32:07 +07:00
mether049-malware/malware-analysis_ref_and_memo.md
2020-03-27 23:13:13 +09:00

524 lines
33 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Tools
- DFIRやマルウェア解析,OSINT,その他の多数のツールに関するデータベース<br>
[DFIR TRAINING(TOOLS)](https://www.dfir.training/dfirtools/advanced-search)
- infographicsやツールのチートシート<br>
[DFIR TRAINING(RESOUCES-Downloads-Infographics & Cheet Sheets)](https://www.dfir.training/resources/downloads/cheatsheets-infographics)
- マルウェアに含まれることが多い文字列とBase64エンコードの対応表<br>
[Learning Aid - Top Base64 Encodings Table](https://gist.github.com/Neo23x0/6af876ee72b51676c82a2db8d2cd3639)
### OS/VM
- **[FLARE VM](https://github.com/fireeye/flare-vm)**<br>
FireEye社が提供するマルウェア解析, DFIR, ペネトレーションテストに特化したWindowsベースのディストリビューション<br>
Practical Malware Analysis Labsが同梱<br>
- **[REMnux](https://remnux.org/)**<br>
SANSが提供するリバースエンジニアリングマルウェア解析に特化したUbuntuベースのディストリビューション<br>
- **[Tsurugi Linux](https://tsurugi-linux.org/index.php)**<br>
DFIR,マルウェア解析OSINTに特化したUbuntuベースのディストリビューション<br>
### Static Analysis and Debug tools
※空欄は調査中(更新予定)
|name|disassembler|decompiler|debugger|reference|
|:-|:-|:-|:-|:-|
|[IDA pro](https://www.hex-rays.com/products/ida/)||(Not free)<br>Snowman(plugin)|||||||
|[Binary Ninja](https://binary.ninja/)|||||||||
|[Cutter](https://github.com/radareorg/cutter)||r2dec,r2ghidra|native<br>gdb<br>windbg<br>etc.|[INTRO TO CUTTER FOR MALWARE ANALYSIS(2019-03)](https://malwology.com/2019/03/14/intro-to-cutter-for-malware-analysis/)<br>[megabeets.net](https://www.megabeets.net/?s=cutter)<br>[Cutter: Presenting r2ghidra Decompiler,r2con 2019](https://www.youtube.com/watch?v=eHtMiezr7l8&list=LLTk6-mAiILdt3V27uab14LA&index=8&t=0s)|||||
|[Ghidra](https://ghidra-sre.org/)||||[Reversing WannaCry Part 2 - Diving into the malware with #Ghidra,youtube](https://www.youtube.com/watch?v=Q90uZS3taG0)<br>[cheetsheet](https://www.oldergeeks.com/downloads/file.php?id=2767)<br>[Scripting in Ghidra, Patching MacOS Image2Icon](https://duraki.github.io/posts/o/20200227-ghidra-scripting-image2icon.html)<br>[]()|||||
|[x64/x32dbg](https://x64dbg.com/#start)||Snowman|||||||
|[WinDbg](https://docs.microsoft.com/ja-jp/windows-hardware/drivers/debugger/debugger-download-tools)|||||||||
|GDB|||||||||
|objdump||||
|[Snowman](https://derevenets.com/)|||||||||
|name|plugin|price|platform|remarks|
|:-|:-|:-|:-|:-|
|[IDA pro](https://www.hex-rays.com/products/ida/)|[Lighthouse](https://github.com/gaasedelen/lighthouse)<br>[UEFI_RETool](https://github.com/yeggor/UEFI_RETool/tree/master/ida_plugin)<br>[VT-IDA Plugin](https://github.com/VirusTotal/vt-ida-plugin)<br>[uEMU](https://github.com/brendantay/uEmu)|Not free|multi||||||
|[Binary Ninja](https://binary.ninja/)|[Lighthouse](https://github.com/gaasedelen/lighthouse)<br>[BinDbg](https://github.com/kukfa/bindbg)|Not free|multi||||||
|[Cutter](https://github.com/radareorg/cutter)|[CutterDRcov](https://github.com/oddcoder/CutterDRcov)<br>[Jupyter Plugin for Cutter](https://github.com/radareorg/cutter-jupyter)<br>[x64dbgcutter](https://github.com/yossizap/x64dbgcutter)<br>[etc.](https://github.com/radareorg/cutter-plugins)|free|multi||||||
|[Ghidra](https://ghidra-sre.org/)|[pwndra](https://github.com/0xb0bb/pwndra)<br>[ghidra_scripts](https://github.com/alephsecurity/general-research-tools/tree/master/ghidra_scripts)<br>[OOAnalyzer](https://insights.sei.cmu.edu/sei_blog/2019/07/using-ooanalyzer-to-reverse-engineer-object-oriented-code-with-ghidra.html)|free|multi||||||
|[x64/x32dbg](https://x64dbg.com/#start)|[DbgChild](https://github.com/David-Reguera-Garcia-Dreg/DbgChild)<br>[checksec](https://github.com/klks/checksec)<br>[idenLib](https://github.com/secrary/idenLib)<br>[xdbg](https://github.com/brock7/xdbg)<br>[ScyllaHide](https://github.com/x64dbg/ScyllaHide)<br>[x64dbgpylib](https://github.com/x64dbg/x64dbgpylib)<br>[ClawSearch](https://github.com/codecat/ClawSearch)<br>[x64dbg-dark](https://github.com/nextco/x64dbg-dark)<br>[YaraGen](https://github.com/mrexodia/YaraGen)<br>[xAnalyzer](https://github.com/ThunderCls/xAnalyzer)<br>[Unpacking Script](https://github.com/x64dbg/Scripts)|free|windows||||||
|[WinDbg](https://docs.microsoft.com/ja-jp/windows-hardware/drivers/debugger/debugger-download-tools)||free|windows|Kernel mode debugging possible|||||
|GDB|gdbpeda<br>pwngdb|free|linux|[onlinegdb](https://www.onlinegdb.com/)|||||
|objdump||free|linux||
|[Snowman](https://derevenets.com/)||free|windows||||||
### Tracer
- **[drltrace](https://github.com/DynamoRIO/drmemory/tree/master/drltrace)**
- [DynamoRIO](https://github.com/DynamoRIO/dynamorio) based
- ライブラリトレーサ(Windows版ltrace)
- **[drstrace](http://drmemory.org/strace_for_windows.html)**
- DynamoRIO based
- システムコールトレーサ(Windows版strace)
- **[memtrace](https://github.com/DynamoRIO/dynamorio/blob/master/api/samples/memtrace_simple.c)**
- DynamoRIO based
- メモリトレーサ
- **[bbbuf](https://github.com/DynamoRIO/dynamorio/blob/master/api/samples/bbbuf.c)**
- DynamoRIO based
- べーシックブロックトレーサ
- **[API Monitor](http://www.rohitab.com/apimonitor)**
- GUI(Windows)
- APIコールを監視ツール
- **[Captain](https://github.com/y3n11/Captain)**
- APIフックを行いAPIの呼び出しを監視
- yaml形式で記載されたシグネチャをもとにDLLインジェクションマクロ実行lsassメモリダンプwmicおよびmshtaマルウェアの検出を行うことが可能
- 現在はアルファ版(2020/02/23時点)
### Instrumentation
- **[drcov](http://dynamorio.org/docs/page_drcov.html)**
- DynamoRIO based
- カバレッジ計測
- drrun経由で実行
```
> drrun.exe -t drcov -- [program name] [arguments]
```
- **Intel PIN**
### Traffic Analysis tools
- **[Wireshark](https://www.wireshark.org/download.html)**
- CLI版はTShark
- ref:
- [Wireshark Tutorial,Unit42(2019)](https://unit42.paloaltonetworks.com/tag/tutorial/)
- **tcpdump**
- **[Scapy](https://scapy.net/)**
- **[Fiddler](https://www.telerik.com/fiddler)**
- Web Proxy debugger
- **[EKFiddle](https://github.com/malwareinfosec/EKFiddle)**
- URLパターンIPなどから特定のマルウェアやEKの通信を識別することが可能
- ref:
- [Malicious Traffic Analysis with EKFiddle(2019-03)](https://drive.google.com/file/d/1VhZyCiHgtDwcCh7cpVWMCTi9B_Nj66AC/view)
- **[Burp Suite](https://portswigger.net/burp)**
- ローカルプロキシツール
- プラグイン
- [awesome-burp-suite](https://github.com/alphaSeclab/awesome-burp-suite)
- **[Fake-net NG](https://github.com/fireeye/flare-fakenet-ng)**
- **[INetSim](https://www.inetsim.org/)**
- **[Noriben](https://github.com/Rurik/Noriben)**
- **[Parse User Agents](https://developers.whatismybrowser.com/)**
- User AgentをパースするWebサービス
- User Agentに含まれる情報の調査に利用したり一般的なUser Agentが田舎の判断に利用することが可能
- 数百万のUser Agentに対応
### Forensic
- **[Sysinternals](https://docs.microsoft.com/en-us/sysinternals/downloads/)**
- Sysmon
- ホスト上で発生したプロセスファイルレジストリネットワークWMI関連のインベントをEventLog(.evtx)に記録する
- ref:
- [SysmonCommunityGuide](https://github.com/trustedsec/SysmonCommunityGuide)
- **[Volatility](https://github.com/mether049/malware/edit/master/malware-analysis_ref_and_memo.md)**
- DFIRやマルウェア解析に焦点を当てたメモリダンプ調査フレームワーク
- プラグインが充実している
- プロファイルの指定が必要である(メモリダンプがどのシステム(OSデータ構造シンボル)で使用したものなのかを識別するため)
- Volatility 3からは不要とのこと
- 対応しているメモリダンプのフォーマット
> - Raw linear sample (dd)
> - Hibernation file (from Windows 7 and earlier)
> - Crash dump file
> - VirtualBox ELF64 core dump
> - VMware saved state and snapshot files
> - EWF format (E01)
> - LiME format
> - Mach-O file format
> - QEMU virtual machine dumps
> - Firewire
> - HPAK (FDPro)
- **ref:**
- [cheet sheet](https://github.com/volatilityfoundation/volatility/raw/gh-pages/docs/VolatilityCheatSheet.pdf)
- [cheet sheet(sans)](https://digital-forensics.sans.org/media/volatility-memory-forensics-cheat-sheet.pdf)
- [Command Reference](https://github.com/volatilityfoundation/volatility/wiki/Command-Reference)
- [First steps to volatile memory analysis](https://medium.com/@zemelusa/first-steps-to-volatile-memory-analysis-dcbd4d2d56a1)
- [Volatility, my own cheatsheet (Part 1): Image Identification](https://www.andreafortuna.org/2017/06/25/volatility-my-own-cheatsheet-part-1-image-identification/)
- Virtual Box上のゲストOSからメモリダンプ(VirtualBox ELF64 core dump)を取得する方法
- VBoxManageを利用してホストOSからゲストOSを起動する(VBoXManageで起動しないと原因は分からないがメモリダンプの取得でうまくいかなかった)
```
> .\VBoxManage.exe list vms # Virtual Boxで作成済みのゲストの名前とuuidの一覧を取得
> .\VBoxManage.exe startvm "guest name or uuid" #起動
```
- VboxManageでメモリダンプ(VirtualBox ELF64 core dump)を取得する
```
> .\VBoxMnage.exe debugvm "guest name or uuid" dumpvmcore --filename output.dmp
```
- この他に,[vboxdump.py](https://www.virtualbox.org/ticket/10222)というメモリダンプ作成用のpythonスクリプトもある
- ref:
- [How to extract a RAM dump from a running VirtualBox machine](https://www.andreafortuna.org/2017/06/23/how-to-extract-a-ram-dump-from-a-running-virtualbox-machine/)
- Plugins
|name|default|how to use|description|reference|
|:-|:-|:-|:-|:-|
|malfind|| python vol.py -f zeus.vmem malfind -p 1724|||
|[hollowfind](https://github.com/monnappa22/HollowFind)|-|python vol.py -f infected.vmem --profile=Win7SP0x86 hollowfind|||
|yarascan|| python vol.py -f zeus.vmem yarascan --yara-file=/path/to/rules.yar|||
|[malconfscan](https://github.com/JPCERTCC/MalConfScan)|-|python vol.py malconfscan -f images.mem --profile=Win7SP1x64|マルウェアのコンフィグ情報の抽出cuckooと組み合わせることが可能|[wiki](https://github.com/JPCERTCC/MalConfScan/wiki)|
|[malstrscan](https://github.com/JPCERTCC/MalConfScan)|-|python vol.py malstrscan -a -f images.mem --profile=Win7SP1x64|||
- **[Hexinator](https://hexinator.com/)**
- バイナリエディタ
- 各種ファイルタイプの構造が定義されたgrammarと呼ばれるxmlファイルを用いて開いたファイルの構造を認識しファイルヘッダやデータ内の各パラメータをバイナリエディタ上でカラーリングして表示
- パラメータの値の閲覧,編集も可能
- freeで多くのgrammerが用意されているがツール自体は試用期間のみ無料
- ファイルの破損部分を確認する際に有用
- バイナリの差分の確認も可能
### Threat hunting
- **[EQL](https://eql.readthedocs.io/en/latest/)**
- cheet sheet
```
# maldoc -> command,script
process where
parent_process_name in ("winword.exe", "excel.exe", "powerpnt.exe")
and process_name in ("powershell.exe", "cscript.exe","wscript.exe", "cmd.exe")
# Unusual Child Process
process where
subtype.create and
(
(process_name == 'smss.exe' and not parent_process_name in ('System', 'smss.exe')) or
(process_name == 'csrss.exe' and not parent_process_name in ('smss.exe', 'svchost.exe')) or
(process_name == 'wininit.exe' and parent_process_name != 'smss.exe') or
(process_name == 'winlogon.exe' and parent_process_name != 'smss.exe') or
(process_name == 'lsass.exe' and parent_process_name != 'wininit.exe') or
(process_name == 'LogonUI.exe' and not parent_process_name in ('winlogon.exe', 'wininit.exe')) or
(process_name == 'services.exe' and parent_process_name != 'wininit.exe') or
(process_name == 'svchost.exe' and parent_process_name != 'services.exe' and
not (parent_process_path == '*\\system32\\svchost.exe' and process_path == '*\\syswow64\\svchost.exe')) or
(process_name == 'spoolsv.exe' and parent_process_name != 'services.exe') or
(process_name == 'taskhost.exe' and not parent_process_name in ('services.exe', 'svchost.exe')) or
(process_name == 'taskhostw.exe' and not parent_process_name in ('services.exe', 'svchost.exe')) or
(process_name == 'userinit.exe' and not parent_process_name in ('dwm.exe', 'winlogon.exe'))
)
```
### .NET analysis
- **[dnspy](https://github.com/0xd4d/dnSpy)<br>**
.NETデコンパイラ,C#やVBで作成された実行ファイルを高精度でデコンパイルする
### Utilities
- **[PeBear](https://github.com/hasherezade/pe-bear-releases)**
- **[PeStudio](https://www.winitor.com/get.html)**
- **[ResourceHacker](http://www.angusj.com/resourcehacker/)**
- PEファイルからリソースファイルの抽出編集が可能なツール
- **PEiD**
- **[010 Editor](https://www.sweetscape.com/)**
- 有償1ヶ月Trialありのテキストエディタバイナリエディタ
- Script機能による自動化
- [official repo](https://www.sweetscape.com/010editor/repository/scripts/)や個人サイトからダウンロード可能
- Template機能によるバイナリフォーマットのパースやSyntax Highlight機能
- ファイルの破損箇所などを確認可能
- [official repo](https://www.sweetscape.com/010editor/repository/templates/)や個人サイトからダウンロード可能
- プロセスメモリの表示等も可能
- ヒストグラム,バイナリ比較,ハッシュ値計算機能
- ref:
- [君にもできる目grepを使わない目grepリローデッドへの挑戦 (010 Editor編)](https://gist.github.com/yoggy/4116843)
- [Li-Script](https://github.com/lich4/personal_script)
- [010Editor-stuff](https://github.com/strazzere/010Editor-stuff)
- **Process Hacker**
- Mutexの確認が可能
- **RegShot**
- **[RegistryChangesView](https://www.nirsoft.net/utils/registry_changes_view.html)**
- **[CyberChef](https://gchq.github.io/CyberChef/)**
- input(ファイル,文字列,データ)に対して様々なOperation(暗号化,復号,エンコード,デコード,情報抽出,変換,置換,計算,その他多数)を適用・組み合わせてOutputするWebサービス
- 適用・組み合わせたOperantinをレシピとしてURLで共有することができる
- [Chepy](https://github.com/securisec/chepy)と呼ばれるpython用ライブラリも開発されている
- [レシピ集](https://github.com/mattnotmax/cyberchef-recipes)
- **[StringSifter](https://github.com/fireeye/stringsifter)**
- 機械学習モデルによってファイルの含まれる文字列とマルウェアとの関連性をランク付けする
- [010 Editorに組み込むことも可能](https://www.sweetscape.com/010editor/repository/scripts/file_info.php?file=RateStrings.1sc&type=1&sort=)
- ref:
- [Learning to Rank Strings Output for Speedier Malware Analysis](https://www.fireeye.com/blog/threat-research/2019/05/learning-to-rank-strings-output-for-speedier-malware-analysis.html)
- **exiftool**
- **wql**
- wqlで子プロセスの検索
```
$procs=Start-Process "programname.exe" -PassThru
echo $procs.Id
$queryNameVersion="SELECT * FROM Win32_Process WHERE ParentProcessId=" + $procs.Id
$child_process=Get-WmiObject -Query $queryNameVersion
echo $child_process
```
### Online Sandbox
|name|site|remarks|
|:-|:-|:-|
|AMAaaS|https://amaaas.com/|apk only|
|ANYRUN|https://app.any.run/#register||
|Intezer Analyze|https://analyze.intezer.com/#/||
|IRIS-H|https://iris-h.services/pages/dashboard|maldoc only|
|CAPE Sandbox|https://cape.contextis.com/||
|Joe Sandbox Cloud|https://www.joesandbox.com/||
|cuckoo|https://cuckoo.cert.ee/||
|cuckoo|https://sandbox.pikker.ee/||
|Hybrid Analysis|https://www.hybrid-analysis.com/?lang=ja||
|ViCheck|https://www.vicheck.ca/submitfile.php||
|Triage|https://tria.ge/||
|Yomi Sandbox|https://yomi.yoroi.company/upload||
|UnpacMe|https://www.unpac.me/#/|online unpacker,beta,<br>extracting embedded AutoIT Script,<br> extracting URL from VB6 downloader(GuLoader)|
|MalwareConifg|https://malwareconfig.com/|特定マルウェアからconfig情報を抽出|
|anlyz.io|https://sandbox.anlyz.io/dashboard||
### Unpacker/Decryptor/Decoder/Extractor/Memory Scanner
- **[TAFOF-Unpacker](https://github.com/Tera0017/TAFOF-Unpacker)<br>**
攻撃者グループTA505が利用するマルウェア(GetandGoDll, Silence, TinyMet, Azorult, KBMiner, etc.)の静的アンパッカー<br>
- **[Trickbot artifact decrypter](https://github.com/snemes/malware-analysis/tree/master/trickbot)<br>**
Trickbotのartifactを取得するためのdecrypter<br>
- **[trick_settings_decoder.py](https://github.com/hasherezade/malware_analysis/tree/master/trickbot)**
Trickbotのartifactを取得するためのdecryter<br>その2
- **[VolatilityBot](https://github.com/mkorman90/VolatilityBot)<br>**
マルウェアサンプルやメモリダンプの自動分析(コードインジェクションの抽出プロセスダンプyaraスキャン文字列の抽出)<br>
- **[Loki - Simple IOC Scanner](https://github.com/Neo23x0/Loki)<br>**
IoCスキャナー(パス・ファイル名の正規表現マッチファイルとプロセスメモリのyaraスキャンhashマッチc2 IoCスキャンPE-Sieve)<br>
- **[flare-floss](https://github.com/fireeye/flare-floss)<br>**
FireEye Labsの静的解析分析技術を利用して難読化された文字列を自動的に検知抽出デコード<br>
- **[PE-Sieve](https://github.com/hasherezade/pe-sieve)<br>**
Process Hollowing,Injectionされた特定のプロセスをダンプ<br>
- **[HollowsHunter](https://github.com/hasherezade/hollows_hunter)<br>**
全プロセスもしくは特定の名称のプロセスのメモリをスキャンしProcess HollowingやInjectionを検知するすることが可能。[Pe-Sieve](https://github.com/hasherezade/pe-sieve)のと同じ開発者によって作成されたツールでありPe-Sieveのdllが内部で用いられている<br>
- **[strings2](http://split-code.com/strings2.html)<br>**
ファイルやプロセスメモリ内の文字列の抽出<br>
- **[mnemosyne](https://github.com/nccgroup/mnemosyne)<br>**
文字列,正規表現でプロセスメモリをスキャン<br>
- **ref:**<br>
- [Memory Scraping for Fun & Profit - Matt Lewis, NCC Group at CRESTCon & IIP Congress,youtube](https://www.youtube.com/watch?v=5HdYcE-woDc)
- **[Memhunter](https://github.com/marcosd4h/memhunter)<br>**
Injecition/Hollowingされたプロセスの自動検出<br>
- ref:<br>
- [Memhunter (Memory resident malware hunting at scale)](https://docs.google.com/presentation/d/1hgx2FTNIkry9Nt8LOJVz_rHNhcGfJChxZVGckv7VI8E/edit#slide=id.g5712e7065f_1_1)<br>
- [Reflective DLL Injection Detection through Memhunte,youtube](https://www.youtube.com/watch?v=t_fR1sCENkc)<br>
- [Process Hollowing Injection Detection through Memhunter,youtube](https://www.youtube.com/watch?v=QxCguP76uyg)<br>
- メモリダンプが不要で,感染環境でメモリスキャンを行う
- メモリスキャンのヒューリスティックトリガーにETWデータを利用している
- ETWのSuspicious Eventsとして以下を定義
> - Process Creattion<br>
> - Registry Operations<br>
> - Threads Operations<br>
> - Virtual Alloc Operations<br>
> - Image Load Operations<br>
> - Kernel Audit APIs usage<br>
> - etc.<br>
- **[Bisonal Analysis Utils](https://www.nttsecurity.com/docs/librariesprovider3/resources/Japan/bisonal-utils)**
- Bisonalに含まれる文字列のデコード通信の復号yaraルール
# PDF Analysis
- **[pdfid.py](https://blog.didierstevens.com/programs/pdf-tools/)**
- **[pdf-parser.py](https://blog.didierstevens.com/programs/pdf-tools/)**
# Docment file Analysis
- Filetype
- .doc, .xls, .ppt
- Office 2003までのファイルの形式
- .docx, .xlsx, .pptx
- Office 2007以降のマクロを含まないファイルの形式
- .docm, .xlsm, .pptm
- Office 2007以降のマクロを含むファイルの形式
- p-code
- マクロコードをコンパイルした中間コード
- ドキュメント内のvbaコードのバージョンとシステム上のvbaのバージョンが同じ場合コンテンツが有効化された際に表示されるソースコードは**p-codeが逆コンパイルされたもの**
- ドキュメント内のvbaコードのバージョンとシステム上のvbaのバージョンが異なる場合コンテンツが有効化された際に表示されるソースコードは**圧縮されたvbaソースコードを解凍したもの**
- VB Editor
- debuggerでstep実行が可能
- 難読化解除の手順
1. olevba等でvbaマクロコードを抽出
2. 悪意のあるファイルを開いてdocx形式で保存し閉じる
- [コンテンツを有効化]は押さない
- [編集を有効にする]は押す
3. olevba等で.docxファイルにマクロが含まれないことを確認する
4. .docxファイルを開く
- ActivXオブジェクトがある場合[コンテンツを有効にする]を押す
5. Alt+F11でVB Editorを開く
6. 1.で抽出したVBAマクロコードのコピー
7. 悪意のあるコード実行部分を出力系の関数等(MsgBox,etc.)で無害化
8. VB Editorのdebuggerで難読化解除
- ref:
- [VBA Macro analysis: Beware of the Shift Key!](https://decalage.info/vbashift)
- vbaData.xmlの削除
- 以下の状況下で有用
- p-codeが利用されている
- マクロのコンテンツを有効化しないと逆コンパイルされたvbaソースコードが表示されない
- p-codeのままではdebuggerを利用できない
- 悪意のあるコードを実行したあとにすぐ終了されるように設計されている
- 方法
- 7-zip等でwordファイルを展開
- wordフォルダ配下のvbaData.xmlを削除
- 再zip
- ref:
- [VBA Stomping — Advanced Maldoc Techniques](https://medium.com/walmartlabs/vba-stomping-advanced-maldoc-techniques-612c484ab278)
- **[pcodedmp](https://github.com/bontchev/pcodedmp)**
- p-codeの逆アセンブラ
- **[pcode2code.py](https://github.com/Big5-sec/pcode2code)**
- p-codeの逆コンパイラ
- **[VBA Seismograph](https://github.com/kirk-sayre-work/VBASeismograph)**
- VBA Stompingの検出ツール
- p-codeで利用される関数名変数名文字列コメント等を出力
- pcodedmpとolevbaを利用している
- **[CMD Watcher](http://www.kahusecurity.com/posts/cmd_watcher_and_maldocs.html)**
- マクロによって実行されるpowershell,cmd,wscript,rundllのコマンドがCMD Watcherに出力される
- コマンドをキャプチャした際に自動的にプロセスを終了させる
- **[ole tools](https://github.com/decalage2/oletools/wiki)**
- [olevba](https://github.com/decalage2/oletools/wiki/olevba)
- VBAマクロソースコードの検出/抽出
- 自動実行可能なマクロの検出
- 疑わしい文字列の抽出
- Anti-Sandbox,Anti-VMの検出
- hex,base64,strreverse,dridexで難読化された文字列の検出/デコード
- IoC(IP,URL,mail addr,file name)の抽出
- etc.
- [oleobj](https://github.com/decalage2/oletools/wiki/oleobj)
- oleファイルから埋め込みオブジェクトを抽出するスクリプト
- [rtfobj](https://github.com/decalage2/oletools/wiki/rtfobj)
- RTFファイルからOLEパッケージオブジェクトを検出し、埋め込みファイルを抽出
- ref:
- [oletools_cheatsheet.pdf](https://github.com/decalage2/oletools/blob/master/cheatsheet/oletools_cheatsheet.pdf)
- **[ViperMonkey](https://github.com/decalage2/ViperMonkey)**
- VBAマクロの分析や難読化解除を行うためのVBAエミュレーションエンジン
- **[Vba2Graph](https://github.com/MalwareCantFly/Vba2Graph)**
- vbaのコールグラフを生成
- **[msoffcrypto-tool](https://github.com/nolze/msoffcrypto-tool)**
- **[msoffice](https://github.com/herumi/msoffice)**
- 暗号化されたOfficeファイルを暗号化/復号するためのツール
- LinuxでPS,VBの動的解析
- [.NET Core](https://docs.microsoft.com/ja-jp/dotnet/core/install/linux-package-manager-ubuntu-1604)
- [PowerShell Core(PowerShell 7+)](https://docs.microsoft.com/ja-jp/powershell/scripting/install/installing-powershell-core-on-windows?view=powershell-7)
- [LibreOffice](https://ja.libreoffice.org/)
- **exiftool**
- HyperLinkBabse等のプロパティにコマンド等が格納されているケースもある
- ref:
- [vbastomp.com](https://vbastomp.com/)
- [Advanced VBA Macros Attack&Defence,BHEU2019](https://www.decalage.info/files/eu-19-Lagadec-Advanced-VBA-Macros-Attack-And-Defence.pdf)
- vba memo
- Using WScript.Shell
```
Dim wsh As New WshShell
or
Dim wsh As Object
Set wsh = CreateObject("Wscript.Shell")
```
- StateMent
- Call
- dllを呼び出せる
- プロシージャを呼び出す
- `Call name [argumentlist]`
- Function
- [Command](https://docs.microsoft.com/ja-jp/office/vba/language/reference/user-interface-help/command-function)
- コマンドライン引数を取得
- [ExecuteExcel4Macro](https://docs.microsoft.com/ja-jp/office/vba/api/excel.application.executeexcel4macro)
- Excel4.0のマクロを実行
# JavaScript Analysis
- **[JS Beautify](https://github.com/beautify-web/js-beautify)**
- JavaScriptのDeobfusecator
- [Online ver](https://beautifier.io/)
- **[malware-jail](https://github.com/HynekPetrak/malware-jail)**
- JavaScriptのマルウェア分析難読化解除ペイロード抽出のためのサンドボックス
# Other various file Analysis
### lnk file
- **[LnkParse](https://pypi.org/project/LnkParse3/)**
- .lnkファイルのパーサ
- exiftoolでもパース可能
- [[MS-SHLLINK]: Shell Link (.LNK) Binary File Format](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-shllink/16cb4ca1-9339-4d0c-a68d-bf1d6cc0f943?redirectedfrom=MSDN)
- .lnkファイルのバイナリフォーマット
# C2 Analysis
- **[C2MATRIX](https://www.thec2matrix.com/matrix)<br>**
- オープンソースのC2フレームワークとその比較表
- [SpreadSheet](https://docs.google.com/spreadsheets/d/1b4mUxa6cDQuTV2BPC6aA-GR4zGZi0ooPYtBe4IgPsSc/edit#gid=0)
### Emotet
- **[Emutet](https://github.com/d00rt/emotet_network_protocol)<br>**
- Emotetのc2通信部分のエミュレータ<br>
### Ursnif
- **Ursnif(version 2)のc2通信の仕組みと復号ツールについて<br>**
- [Writing Malware Traffic Decrypters for ISFB/Ursnif](https://labs.sentinelone.com/writing-malware-traffic-decrypters-for-isfb-ursnif/)
# Binary Analysis
### Unpacking
- **アンパックの流れ**
- OEPの特定し,OEPまで実行
- pushad命令popad命令に着目。popad命令後のjmpでOEPに遷移する可能性がある(pushadした際のスタックのアドレスにハードウェアブレークポイントを設定することで監視)
- 動的に生成された領域に着目(領域にアクセスし,実行されるかをメモリブレークポイントを設定することで監視)
- WinMainCRTStartupWinMainとの類似性からヒューリスティックに判断
- ツールを利用
- プロセスメモリのダンプ
- 基本的にツールを用いる
- IATの再構築(展開ルーチンのIAT再構築とは別)
- IATは展開ルーチンでローダによってそのときの実際のAPIのアドレスに書き換えられているためロード前に戻す必要がある
- PEヘッダはパックされたコードのIATを示しているので新たににインポートセクションを追加しそのセクションを認識するようにPEヘッダを修正する
- 基本的にツールを用いる
### [Microsoft Windows Library](https://en.wikipedia.org/wiki/Microsoft_Windows_library_files)
- **NTDLL.DLL**
- Windows Native APIを提供
- Native APIはKERNEL32.DLLによってエクスポートされるKernel APIやbase APIの多くで使用されている
- Windows applicationから直接的に呼ばれることはほとんどない
- 公式ではドキュメント化されていないが,[こちら](https://undocumented.ntinternals.net/)からある程度確認可能
- **KERNEL32.DLL**
- メモリ操作入出力プロセスやスレッド管理同期処理を行うWin32 base APIを提供する
- **USER32.DLL**
- GUIなどユーザインターフェース関連のAPIを提供
- **MSVCRT.DLL**
- ランタイム(CRT)ライブラリ
- MSVCコンパイラ用の標準C関数等(printf,malloc,etc.)の提供
- [Microsoft's C++ Standard Libraryのソースコード](https://github.com/llvm/llvm-project/tree/47282b1b4bf3e18d2e2166b87159115ed520a2aa)
- ref about crt:
- [exeファイルとCRT - EternalWindows](http://eternalwindows.jp/else/exe.html)
- [C Run-Time Library Reference](https://docs.microsoft.com/en-us/cpp/c-runtime-library/c-run-time-library-reference?view=vs-2019)
- ref:
- [Loading a DLL from memory](https://www.joachim-bauch.de/tutorials/loading-a-dll-from-memory/)
- DLLをロードする流れやメモリからロードするツールについて
### Symbolic Execurtion
to do...
### Taint Analysis
to do...
### Decompiler
to do...
### Perspective
- topdown
- コードの先頭から解析
- bottom-up
- 表層解析で得たキー情報(Win32API,怪しい文字列etc.)の周辺から解析
### ref:
- Intel系アーキテクチャSoftware Developer向けのマニュアル<br>
[Intel® 64 and IA-32 Architectures Software Developer Manuals](https://software.intel.com/en-us/articles/intel-sdm)<br>
- PEファイルのフォーマットについて<br>
[Inside Windows An In-Depth Look into the Win32 Portable Executable File Format, Part 1(2002)](http://bytepointer.com/resources/pietrek_in_depth_look_into_pe_format_pt1.htm)<br>
[Peering Inside the PE: A Tour of the Win32 Portable Executable File Format(1994)](http://bytepointer.com/resources/pietrek_peering_inside_pe.htm)<br>
- Windows APIに関するMSの公式ドキュメント<br>
[Windows API Index](https://docs.microsoft.com/en-us/windows/win32/apiindex/windows-api-list)<br>
# Windows OS
- Windows Internalsを日本語で解説するプロジェクト<br>
[windows-internals-guid](https://github.com/windows-internals-guide/security)<br>
# Windows Command
- widows上で情報収集やフォレンジックに活用できるCommand Line CheetSheet
- [Windows Command Line cheatsheet (part 1): some useful tips](https://www.andreafortuna.org/2017/08/03/windows-command-line-cheatsheet-part-1-some-useful-tips/)
- [Windows Command Line cheatsheet (part 2): WMIC](https://www.andreafortuna.org/2017/08/09/windows-command-line-cheatsheet-part-2-wmic/)
- [WMI 101 for Pentesters](https://www.ethicalhacker.net/features/root/wmi-101-for-pentesters/)
# Training Material
- **[Malware-Traffic-Analysis(TRAFFIC ANALYSIS EXERCISES)](https://www.malware-traffic-analysis.net/training-exercises.html)<br>**
- pcap解析(マルウェア感染等のセキュリティインシデントに関わるトラフィック解析)に関するトレーニング教材<br>
- **[Malware-Analysis-Training](https://github.com/OpenRCE/Malware-Analysis-Training)<br>**
- 初心者/中級者向けのマルウェア解析トレーニング教材<br>
- 教材自体は2010年頃のもので2020年にオープンソース化
- 内容:
- IDA proやOllyDBG等の解析ツールについて
- アセンブリ言語について
- パッキング,耐解析機能,バイナリ差分と比較,難読化,隠ぺい技術等
- **[Advanced Binary Deobfuscation](https://github.com/malrev/ABD)**
- バイナリの難読化解除に関するトレーニング教材
- 内容:
- 難読化技術や難読化解除技術について
- データフロー分析やシンボリック実行
- **[Adversary Tactics: PowerShell](https://github.com/specterops/at-ps)**
- PowerShellスクリプトとセキュリティに関するトレーニング教材
- **[CS6038 (Spring 2020) - Malware Analysis](https://www.youtube.com/playlist?list=PLFvh_k-n27CnAyfsMDowQmogkG5MbZkXz)**
- **[CS6038/CS5138 Malware Analysis, UC](https://class.malware.re/)**
- シンシナティ大学のマルウェア解析講義(Youtube,資料)
- **[ExploitingBooks](https://github.com/hdbreaker/ExploitingBooks)**
- ReverseEngineering,Exploitの資料集
- **[Hands on Adversarial Machine Learning](https://resources.oreilly.com/live-training/hands-on-adversarial-machine-learning/tree/master)**
- Adversarial Machine Learning(敵対的機械学習)に関する教材
- DGAなどに対する敵対的機械学習をハンズオンで取り組むことができる