[Home]Memo/Cuckoo

Amatubu_Wiki | Memo | RecentChanges | Preferences

Difference (from prior major revision) (no other diffs)

Changed: 247,259c247,258
<pre>2016-05-25 21:22:32,893 [lib.cuckoo.core.scheduler] INFO: Starting analysis of FILE "test.bin" (task #1, options "")
2016-05-25 21:22:32,985 [lib.cuckoo.core.scheduler] INFO: Task #1: acquired machine cuckoo1 (label=WinXP)
2016-05-25 21:22:32,996 [modules.auxiliary.sniffer] INFO: Started sniffer with PID 28834 (interface=vboxnet0, host=192.168.56.101, pcap=/path/to/cuckoo/storage/analyses/1/dump.pcap)
tcpdump: vboxnet0: You don't have permission to capture on that device
((no devices found) /dev/bpf0: Permission denied)
2016-05-25 21:23:49,855 [lib.cuckoo.core.scheduler] ERROR: Timeout hit while for machine WinXP to change status
2016-05-25 21:23:49,868 [lib.cuckoo.core.scheduler] CRITICAL: A critical error has occurred trying to use the machine with name cuckoo1 during an analysis due to which it is no longer in a working state, please report this issue and all of the related environment details to the developers so we can improve this situation. (Note that before we would simply remove this VM from doing any more analyses, but as all the VMs will eventually be depleted that way, hopefully we'll find a better solution now).
2016-05-25 21:23:50,332 [lib.cuckoo.core.scheduler] WARNING: Unable to stop machine WinXP: Trying to stop an already stopped vm WinXP
2016-05-25 21:23:50,444 [modules.processing.behavior] WARNING: Analysis results folder does not exist at path '/path/to/cuckoo/storage/analyses/1/logs'.
2016-05-25 21:23:52,327 [lib.cuckoo.common.objects] WARNING: Unable to import yara (please compile from sources)
2016-05-25 21:23:52,362 [modules.processing.network] WARNING: The PCAP file does not exist at path "/path/to/cuckoo/storage/analyses/1/dump.pcap".
2016-05-25 21:23:54,218 [lib.cuckoo.core.scheduler] INFO: Task #1: reports generation completed (path=/path/to/cuckoo/storage/analyses/1)
2016-05-25 21:23:54,235 [lib.cuckoo.core.scheduler] INFO: Task #1: analysis procedure completed
<pre>2016-05-26 19:48:46,707 [lib.cuckoo.core.scheduler] INFO: Starting analysis of FILE "test.exe" (task #12, options "")
2016-05-26 19:48:46,769 [lib.cuckoo.core.scheduler] INFO: File already exists at "/path/to/cuckoo/storage/binaries/e37e5e39cc971ca0c196605371d0699b6c1f135378da9d454227e02977571e0f"
2016-05-26 19:48:46,799 [lib.cuckoo.core.scheduler] INFO: Task #12: acquired machine cuckoo1 (label=WinXP)
2016-05-26 19:48:46,806 [modules.auxiliary.sniffer] INFO: Started sniffer with PID 12759 (interface=vboxnet0, host=192.168.56.101, pcap=/path/to/cuckoo/storage/analyses/12/dump.pcap)
tcpdump: listening on vboxnet0, link-type EN10MB (Ethernet), capture size 262144 bytes
2016-05-26 19:48:50,893 [lib.cuckoo.core.guest] INFO: Starting analysis on guest (id=cuckoo1, ip=192.168.56.101)
2016-05-26 19:49:33,692 [lib.cuckoo.core.scheduler] ERROR: Analysis failed: The package "modules.packages.exe" start function encountered an unhandled exception: Error returned by is32bit: Command '['bin\\is32bit.exe', '-f', u'C:\\DOCUME~1\\sent\\LOCALS~1\\Temp\\test.exe']' returned non-zero exit status 1
236 packets captured
8521 packets received by filter
0 packets dropped by kernel
2016-05-26 19:49:39,519 [lib.cuckoo.core.scheduler] INFO: Task #12: reports generation completed (path=/path/to/cuckoo/storage/analyses/12)
2016-05-26 19:49:39,532 [lib.cuckoo.core.scheduler] INFO: Task #12: analysis procedure completed

Mac OS X 10.11 (El Capitan) で Cuckoo Sandbox (2.0-RC1) を動かす

まだ途中のメモです。実際に動くところまではいっていません。

TODO

ホスト側の設定

[Preparing the Host]

Python の準備

Python は Mac OS X に最初から入ってるし、Homebrew で直接インストールすることもできるけど、もともと入っているものはいろいろ制約がありそうなのと、できるだけバージョンをあわせたほうがトラブルも少ないだろうということで、pyenv を入れる流れに。2行めのは、~/.bash_profile にも入れておくべし。

$ brew install pyenv
$ if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
$ pyenv install 2.7.11
$ pyenv rehash
$ pyenv global 2.7.11

パッケージ管理の pip を入れ、最新バージョンに更新。

$ easy_install pip
$ pip install --upgrade pip

必要なパッケージのインストール

Cuckoo Sandbox を動かすために必要なモジュールは、cuckoo/requirements.txt に記述されているが、このままだと cryptography 1.0 のインストールでエラーになる(El Capitan には OpenSSL のヘッダが含まれていないため)ので、代わりにこの対策がされた 1.0.1 を入れるため、requirements.txt を以下のように編集する。

--- requirements.txt	2016-01-12 03:26:34.000000000 +0900
+++ requirements_mod.txt	2016-05-25 18:15:38.000000000 +0900
@@ -2,7 +2,7 @@
 beautifulsoup4==4.4.1
 cffi==1.2.1
 chardet==2.3.0
-cryptography==1.0
+cryptography==1.0.1
 Django==1.8.4
 dpkt==1.8.6.2
 ecdsa==0.13

そして、パッケージのインストール。

$ pip install -r requirements.txt

tcpdump のイストール

これも最初から入っているものでもよさそうだけど、一応 Homebrew のを入れておく

$ brew install homebrew/dupes/tcpdump

tcpdump がユーザ権限で動かせるように設定する

通常は root でないとキャプチャできないので、権限を変更する。再起動すると設定が元に戻るようなので、必要に応じて分析の前に実行するといいかも。

$ sudo chmod 644 /dev/bpf*

あるいは、[No Interfaces Available In Wireshark Mac OS X] にあるように、Wireshark に含まれてる ChmodBPF というスクリプトをスタートアップに登録しておく方法もあるらしい。でも、El Capitan では StartupItems 使えないっけな...?

必須でないパッケージ等のインストール

$ brew install mongodb

$ pip install yara

Cuckoo の設定

最低限、変更すべきところは、以下。VM には、デフォルトの VirtualBox を使う前提で。

conf/cuckoo.conf

ip = 192.168.56.1
port = 2042

必須の変更項目は特にない。変更する可能性があるとしたら上記くらいか?
IP アドレスは、後述する、VirtualBox の「ホストオンリーネットワーク」のアダプタのものにあわせる(初期設定もままならば変更しなくてよい)。

conf/auxiliary.conf

tcpdump = /usr/local/sbin/tcpdump

tcpdump のパスにあわせる。

conf/virtualbox.conf

path = /usr/local/bin/VBoxManage

VBoxManage のパスにあわせる。

interface = vboxnet0

ホストオンリーネットワークのアダプタの名前にあわせる(初期設定のままならば変更しなくてよい)。

[cuckoo1]
# Specify the label name of the current machine as specified in your
# VirtualBox configuration.
label = WinXP

VirtualBox 上のマシンの名前にあわせる。

platform = windows

ゲストのプラットフォームにあわせる。Windows ならそのままでよい。

ip = 192.168.56.101

ゲストのホストオンリーアダプタ側の IP アドレスにあわせる。この IP アドレスは固定である必要があるので、ゲスト側で固定に設定し、その IP アドレスを入れる。

ホストオンリーアダプタの初期設定では、192.168.56.2 が DHCP 、.3 から .255 が割り当て領域になっているので、上限を .100 に変更する前提で、.101 を使う。

conf/processing.conf

key = XXXXXXX

VirusTotal API key を設定する。初期設定のものは、VirusTotal チームから提供されたもののようで、そのままでも動くようだけど、キーを持っているならば設定すべきところかな。

VirtualBox の設定

ホストオンリーネットワークの設定

ゲストネットワークの設定

ゲスト側の設定

[Preparing the Guest]

2D、3D アクセラレーションを無効化する

2D、3D アクセラレーションが有効になっていると、Headless モード(画面を表示せずに起動させるモードで、Cuckoo Sandbox からゲストを動かすときに使われる)で起動できないので、無効化しておく。無効にしていないと以下のようなエラーが出る。

VBoxManage failed starting the machine in HEADLESS mode: VBoxManage: error: Failed to load unit 'HGCM' (VERR_SSM_UNEXPECTED_DATA)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole

VBoxManage failed starting the machine in HEADLESS mode: VBoxManage: error: Failed to load unit 'vga' (VERR_SSM_LOADED_TOO_MUCH)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole

Python のインストール

それぞれインストーラでインストールするだけ。

ネットワーク設定

その他

いろいろソフトを入れると自動更新を無効化するのが案外面倒かもしれない。

エージェントのインストールと起動

[+] Starting agent on 0.0.0.0:8000 ...

スナップショットの作成

エージェントも含めて正常に起動することを確認したら、スナップショットを作成する。スナップショットは、サンドボックス上でプログラムをテストしたのちに、元に戻すために使われる。

ネットワーク設定のテスト

ホストとゲストの間の通信ができるかどうか確認する。

ホストからゲスト

$ ping 192.168.56.101

ゲストからホスト

> ping 192.168.56.1

Cuckoo Sandbox の起動

[Starting Cuckoo]

ホスト側で。

 $python cuckoo.py

以下のように表示され、待ち受けが開始される。


                          .:                 
                          ::                 
    .-.     ,  :   .-.    ;;.-.  .-.   .-.   
   ;       ;   ;  ;       ;; .' ;   ;';   ;' 
   `;;;;'.'`..:;._`;;;;'_.'`  `.`;;'  `;;'

 Cuckoo Sandbox 2.0-rc1
 www.cuckoosandbox.org
 Copyright (c) 2010-2015

 Checking for updates...
 Good! You have the latest version available.

2016-05-25 20:19:31,585 [lib.cuckoo.core.scheduler] INFO: Using "virtualbox" as machine manager
2016-05-25 20:19:33,565 [lib.cuckoo.core.scheduler] INFO: Loaded 1 machine/s
2016-05-25 20:19:33,603 [lib.cuckoo.core.scheduler] INFO: Waiting for analysis tasks.

分析させる

[Submit an Analysis]

ホスト側で。

$ python utils/submit.py /path/to/binary

現状、以下のような感じでうまく動いてない。

2016-05-26 19:48:46,707 [lib.cuckoo.core.scheduler] INFO: Starting analysis of FILE "test.exe" (task #12, options "")
2016-05-26 19:48:46,769 [lib.cuckoo.core.scheduler] INFO: File already exists at "/path/to/cuckoo/storage/binaries/e37e5e39cc971ca0c196605371d0699b6c1f135378da9d454227e02977571e0f"
2016-05-26 19:48:46,799 [lib.cuckoo.core.scheduler] INFO: Task #12: acquired machine cuckoo1 (label=WinXP)
2016-05-26 19:48:46,806 [modules.auxiliary.sniffer] INFO: Started sniffer with PID 12759 (interface=vboxnet0, host=192.168.56.101, pcap=/path/to/cuckoo/storage/analyses/12/dump.pcap)
tcpdump: listening on vboxnet0, link-type EN10MB (Ethernet), capture size 262144 bytes
2016-05-26 19:48:50,893 [lib.cuckoo.core.guest] INFO: Starting analysis on guest (id=cuckoo1, ip=192.168.56.101)
2016-05-26 19:49:33,692 [lib.cuckoo.core.scheduler] ERROR: Analysis failed: The package "modules.packages.exe" start function encountered an unhandled exception: Error returned by is32bit: Command '['bin\\is32bit.exe', '-f', u'C:\\DOCUME~1\\sent\\LOCALS~1\\Temp\\test.exe']' returned non-zero exit status 1
236 packets captured
8521 packets received by filter
0 packets dropped by kernel
2016-05-26 19:49:39,519 [lib.cuckoo.core.scheduler] INFO: Task #12: reports generation completed (path=/path/to/cuckoo/storage/analyses/12)
2016-05-26 19:49:39,532 [lib.cuckoo.core.scheduler] INFO: Task #12: analysis procedure completed

Amatubu_Wiki | Memo | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited May 26, 2016 20:03 by Amatubu (diff)
Search:

Copyright (c) 1996-2019 naoki iimura e-mail