
軽量なmacOSマルウェア解析サンドボックス。OpenBSMまたはMonitor.appを介してシステムアクティビティを監視し、ファイル、プロセス、ネットワークイベントの詳細なレポートとタイムラインを生成します。
「Norimaci」は、macOS向けのシンプルで軽量なマルウェア解析サンドボックスです。このツールは「Noriben」に触発されて作成されました。Norimaciは、Sysinternals Process Monitor (procmon) の代わりに、OpenBSMまたはMonitor.appの機能を使用してmacOSのシステムアクティビティを監視します。
Norimaciは3つのPythonスクリプトで構成されています。
OpenBSMは、macOS上のアクティビティを監査するフレームワークです。詳細については公式サイトを参照してください。
Monitor.appは、FireEyeが作成した無料ツールです。詳細については公式サイトを参照してください。
元同僚(@cci_forensics)がこの名前を提案しました。
「Norimaci」は「Noriben」と「Macintosh」を組み合わせた造語です。発音は「Norimaki」で、日本語では「のり巻き」を表します。英語では"sushi roll"を意味します。
Noribenは最小限の材料で構成される日本の弁当箱スタイルです。のり巻きの材料はNoribenと似ています(海苔、ご飯、その他お好みのもの)。
そこで、このツールを「Norimaci」と名付けることにしました。
注意:Monitor.appはmacOS 10.12 - 10.14のみをサポートしています。macOS 10.15以降でマルウェアを実行する場合は、インストールする必要はありません。代わりにOpenBSMを使用する必要があります。
Monitor.appと共にNorimaciを使用する場合は、以下のライブラリをソースリポジトリまたはpipからインストールする必要があります。
マルウェアサンプルを実行するために、macOS VMを構築する必要があります。また、偽のインターネット接続用に別のVMを構築することを強くお勧めします。なぜなら、多くのマルウェアが自身のサーバー(例:C2サーバー)に接続しようとするからです。
PolarProxyとINetSimは、偽のHTTP/HTTPSおよびDNSサービスを提供する非常に便利なツールです。疑似インターネットの構築については、NETRESECブログを参照してください。
OpenBSMを使用してシステムアクティビティを監視する場合は、以下のように /etc/security/audit_control ファイルを変更する必要があります。 デフォルトでは、OpenBSMはログインと認証に関する監査ログのみを記録します。しかし、Norimaciはより多くの種類の監査ログ(ファイル作成、ファイル削除、プロセス実行、ネットワークなど)を必要とします。
変更後、設定を適用するためにコンピュータを再起動する必要があります。
#
# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_control#8 $
#
dir:/var/audit
flags:lo,aa,fc,fd,pc,nt,ex <- ここをこのように編集
minfree:5
naflags:lo,aa,fc,fd,pc,nt,ex <- ここをこのように編集
policy:cnt,argv
filesz:2M
expire-after:10M
superuser-set-sflags-mask:has_authenticated,has_console_access
superuser-clear-sflags-mask:has_authenticated,has_console_access
member-set-sflags-mask:
member-clear-sflags-mask:has_authenticated
$ sudo python3 ./norimaci.py -m openbsm -o ./out/
Password:
--===[ Norimaci v0.1.0
--===[ Minoru Kobayashi [@unkn0wnbit]
[*] Launching OpenBSM agent...
[*] When runtime is complete, press CTRL+C to stop logging.
^C
[*] Termination of OpenBSM agent commencing... please wait
[*] Converting OpenBSM data ...
[*] Loading converted macOS activity data ...
[*] Saving report to: /Users/macforensics/tools/norimaci/out/Norimaci_14_Jan_20__15_55_093219.txt
[*] Saving timeline to: /Users/macforensics/tools/norimaci/out/Norimaci_14_Jan_20__15_55_093219_timeline.csv
注意:Monitor.appはmacOS 10.15では動作しません。ただし、macOS 10.14以前では問題なく動作します。
$ python3 ./norimaci.py -h
--===[ Norimaci v0.1.0
--===[ Minoru Kobayashi [@unkn0wnbit]
usage: norimaci.py [-h] [-m MONITOR] [-j JSON] [-bl OPENBSM_LOG] [-p PROCLIST]
[-ml MONITORAPP_LOG] [-o OUTPUT] [--force] [--debug]
Light weight sandbox which works with OpenBSM or Fireeye's Monitor.app
optional arguments:
-h, --help show this help message and exit
-m MONITOR, --monitor MONITOR
Specify a program to monitor macOS activity. You can
choose 'openbsm' or 'monitorapp'.
-j JSON, --json JSON Path to a JSON file which is converted by
'openbsmconv.py' or 'monitorappconv.py'.
-bl OPENBSM_LOG, --openbsm-log OPENBSM_LOG
Path to an OpenBSM log file.
-p PROCLIST, --proclist PROCLIST
Path to a process list file to process OpenBSM log
file. A file which has ".proclist" extnsion would be
used, if this option is not specified.
-ml MONITORAPP_LOG, --monitorapp-log MONITORAPP_LOG
Path to a Monitor.app data file.
-o OUTPUT, --output OUTPUT
Path to an output directory.
--force Enable to overwrite output files.
--debug Enable debug mode.
$ python3 ./openbsmconv.py -h
usage: openbsmconv.py [-h] [-f FILE] [-p PROCLIST] [-o OUT] [-c] [-rp]
[--with-failure] [--with-failure-socket] [--force]
[--debug]
Converts OpenBSM log file to JSON format.
optional arguments:
-h, --help show this help message and exit
-f FILE, --file FILE Path to a bsm log file
-p PROCLIST, --proclist PROCLIST
Path to a process list file
-o OUT, --out OUT Path to an output file
-c, --console Output JSON data to stdout.
-rp, --use-running-proclist
Use current running process list instead of a existing
process list file. And, the process list is saved to a
file which places in the same directory of '--file' or
to a file which specified '--proclist'.
--with-failure Output records which has a failure status too.
--with-failure-socket
Output records which has a failure status too (related
socket() syscall only).
--force Enable to overwrite an existing output file.
--debug Enable debug mode.
$ python3 ./monitorappconv.py -h
usage: monitorappconv.py [-h] [-f FILE] [-o OUT] [-c] [--force] [--debug]
Parses data of Fireeye Monitor.app and converts it to JSON format. Please note
that strings in JSON data are saved as UTF-8.
optional arguments:
-h, --help show this help message and exit
-f FILE, --file FILE Path to a saved data of Monitor.app.
-o OUT, --out OUT Path to an output file.
-c, --console Output JSON data to stdout.
--force Enable to overwrite an output file.
--debug Enable debug mode.
Norimaciを使用してmacOS 10.15 Catalina上のAppleJeus.Aを解析します。このデモ動画はJapan Security Analyst Conference 2020 (JSAC2020) のために作成されました。

git clone https://github.com/mnrkbys/norimaci.git