前言

上一篇文章已经说了我为何要在Windows下部署Cuckoo,就是为了省点内存,提高体验。然后Cuckoo在Windows下在安装部署文档是空的。

Windows布谷鸟

好一个 To be documented ~
幸好Python的代码是跨平台的,所以,不慌它,奥利给,干了
上一篇文章已经搭建好布谷鸟所需要的虚拟机环境(即沙箱),这里主要记录cuckoo搭建的一些小坑

安装Python27

因为Cuckoo的安装要求是在Python2下面的,所以安装Python27

Python2.7.18 下载页面

Windows布谷鸟

下载回来之后,安装好。

Windows布谷鸟

安装Cuckoo

Windows布谷鸟

U1S1,Pycharm他们Jetbrain家 的Loading图是真的帅。
来到设置里面的解析器的包管理页面,安装一下cuckoo,用pip直接装也一样的,我这里是因为环境有点乱了,pip也乱了,IDE里也配置了镜像源,就开个IDE省事。

Windows布谷鸟

Windows布谷鸟

在这个步骤如果出现GMS、Crypto库编译错误什么的,可以安装VC的一个Python环境即可
下载安装 Microsoft Visual C++ Compiler for Python 2.7

安装PIL、Pillow

Windows布谷鸟

安装pymongo

Windows布谷鸟

初始化Cuckoo

cuckoo init

Windows布谷鸟

如果出现启动错误,那就需要将用户目录下的.cuckoo目录删除掉

启动Cuckoo

cuckoo -d

安装了VirtualBox 6.1 ,但是还是出现了这个报错
Potentially vulnerable virtualbox version installed. Failed to retrieve its version. Update if version is: 6.0.5

Windows布谷鸟

修改配置文件,跳过检测即可

1
2
<!-- C:\Users\你的用户名\.cuckoo\conf\cuckoo.conf -->
ignore_vulnerabilities = yes

修改好之后,启动看看,可以发现找不到vboxmanage
报错提示我们,我们还有配置文件没修改,找到virtualbox.conf,修改path的值为我电脑上的virtualbox的目录下的vboxmanage路径

2020-06-21 10:55:00,121 [cuckoo] CRITICAL: CuckooCriticalError: VirtualBox’ VBoxManage not found at specified path “/usr/bin/VBoxManage” (as specified in virtualbox.conf). Did you properly install VirtualBox and configure Cuckoo to use it?

Windows布谷鸟

1
2
3
4
5
<!-- C:\Users\你的用户名\.cuckoo\conf\virtualbox.conf -->

# Path to the local installation of the VBoxManage utility.
# path = /usr/bin/VBoxManage
path = E:/Program Files/Oracle/VirtualBox/VBoxManage.exe

修改好之后,再启动看看,报错提示我们没有cuckoo1这个虚拟机,找到virtualbox.conf,修改path的值为我电脑上的virtualbox的目录下的vboxmanage路径

2020-06-21 11:04:12,516 [cuckoo] CRITICAL: CuckooCriticalError: Please update your configuration. Unable to shut ‘cuckoo1’ down or find the machine in its proper state: The virtual machine ‘cuckoo1’ doesn’t exist! Please create one or more Cuckoo analysis VMs and properly fill out the Cuckoo configuration!

Windows布谷鸟

1
2
3
4
5
<!-- C:\Users\你的用户名\.cuckoo\conf\virtualbox.conf -->
[cuckoo1]
# Specify the label name of the current machine as specified in your
# VirtualBox configuration.
label = XP_64

Windows布谷鸟

修改好之后,再启动看看,报错提示还原虚拟机的快照失败,叫我给虚拟机搞个快照再说。所以,就给他整个快照噻~

2020-06-21 11:11:57,365 [cuckoo.machinery.virtualbox] DEBUG: Stopping vm XP_64
2020-06-21 11:11:57,552 [cuckoo.machinery.virtualbox] DEBUG: Restoring virtual machine XP_64 to its current snapshot
2020-06-21 11:11:57,634 [cuckoo] CRITICAL: CuckooCriticalError: Error initializing machines: VBoxManage failed trying to restore the snapshot of machine ‘XP_64’ (this most likely means there is no snapshot, please refer to our documentation for more information on how to setup a snapshot for your VM): error code 1:

Windows布谷鸟

所以,给它整了一个快照

Windows布谷鸟

Windows布谷鸟

拍好快照之后,再启动看看,看着这个Waiting for analysis tasks. 老夫露出欣慰的笑容 (ಥ_ಥ)

Windows布谷鸟

启动Cuckoo Web界面

cuckoo web
可以看到提示我们,需要配置MongoDB

In order to use the Cuckoo Web Interface it is required to have MongoDB up-and-running and enabled in Cuckoo. Please refer to our official documentation as well as the $CWD/conf/reporting.conf file.

Windows布谷鸟

下载MongoDB

先跑去下载一个MongoDB
MongoDB下载地址

Windows布谷鸟

Windows布谷鸟

安装好了就好了

修改MongoDB的配置文件

找到配置MongoDB的文件,是reporting.conf,打开它,修改一下

1
2
3
4
5
<!-- C:\Users\你的用户名\.cuckoo\conf\reporting.conf -->
[mongodb]
enabled = yes
host = 127.0.0.1
port = 27017

创建cuckoo链接

改好了配置之后,MongoDB也在本地测试能使用之后

cuckoo web 启动一波,给了我一个新的错误

$ cuckoo web
C:\Python27\python.exe: can’t open file ‘C:\Python27\Scripts\cuckoo’: [Errno 2] No such file or directory

Windows布谷鸟

为此,我用mklink将cuckoo链接过去,然后再跑一遍,就给了我一个这样子报错

Windows布谷鸟

没办法,只能去翻翻资料,发现挺多人都遇到这个问题的,GitHub上面挺多关于这个报错的issue,幸好都被close了

测试了两种方案,一钟mklink cuckoo.exe 一种mklink cuckoo-script.py

可以看到mklink py文件的那个方案是正解

访问Cuckoo网站

Windows布谷鸟

喜大普奔(ಥ_ಥ)
其实是可以看到是有点儿不正常的,这个先不管,后面再处理

配置网卡(大坑)

最开始,没了留意到装好了的XP系统居然没有网卡

Windows布谷鸟

设备管理器里面也显示网卡驱动有问题,一度导致我想下载一个万能驱动包给他装上
但是,太麻烦了那样子。毕竟VBox要是不支持XP的网卡的话,也太捞了吧。所以,自信认为问题出在VBOX身上。
接着去搞配置,看着这灰色的网卡选项,我一度很绝望。心想:改不了的嘛,什么情况,太辣鸡了吧。

Windows布谷鸟

然而发现是自己蠢了,虚拟机都没关,就挂起在那里,这让人家怎么改嘛。。。
所以,关掉虚拟机之后,就重新配置一下网卡

Windows布谷鸟

选一个适合自己系统的,要是不知道哪个是系统支持的,可以像我这样,多开几个网卡,选多几个,到时应该总有一个能用的

从新打开网卡设置页面看看

Windows布谷鸟

再ping一手,奈斯

Windows布谷鸟

根据IP地址修改一下IP相关配置

虚拟机网卡的问题修好之后,该配置cuckoo的配置文件了。稍微根据自己的虚拟机实际情况处理一下即可

1
2
3
4
5
<!-- C:\Users\你的用户名\.cuckoo\conf\virtulbox.conf -->
# Specify the IP address of the current virtual machine. Make sure that the
# IP address is valid and that the host machine is able to reach it. If not,
# the analysis will fail.
ip = 192.168.1.232
1
2
3
4
5
6
7
8
9
<!-- C:\Users\你的用户名\.cuckoo\conf\cuckoo.conf -->
[resultserver]
# The Result Server is used to receive in real time the behavioral logs
# produced by the analyzer.
# Specify the IP address of the host. The analysis machines should be able
# to contact the host through such address, so make sure it's valid.
# NOTE: if you set resultserver IP to 0.0.0.0 you have to set the option
# `resultserver_ip` for all your virtual machines in machinery configuration.
ip = 192.168.1.166

配置客户机(沙箱)

安装增强工具

Windows布谷鸟

重启一下虚拟机

Windows布谷鸟

下载一个符合虚拟机版本的Python2安装包,扔进去,我这里是32位的Python27。

Windows布谷鸟

然后,去C:\Users\你的名字.cuckoo\agent这个地方拉agent.py文件进去,双击运行

Windows布谷鸟

建议在此处给它来个快照

Windows布谷鸟

如果出现拖曳文件进虚拟失败的问题,可以采用共享文件夹的方案

Windows布谷鸟

Windows布谷鸟

Windows布谷鸟

尝试修复cuckoo web 的异常

cuckoo -d
cuckoo web

启动一下后台服务以及web服务

  • 注意,没有我下图截的那个红色框的 web启动界面都是不正常的启动。而且是看不到上传图标的

Windows布谷鸟
不正常

Windows布谷鸟
正常

Windows布谷鸟
注意红色框

正常和不正常的区别咋一看不大,就差了一个上传的图标。实际上,不正常的话,是无法上传病毒样本的。
解决方案也比较玄学,这里随意说说。当时测试,发现有几个js文件会load失败,事关socket传输的问题。一系列尝试无果,然后便扔到服务器OSS中,在线load它。然而,还是测试不正常,一气之下,打尻去了。第二天过来重新启动便可以正常启动了。太神奇了~~~

配置tcpdump

Windows布谷鸟

点击下载 Microolap TCPDUMP for Windows
然后解压好,放tcpdump到.cuckoo目录下
修改配置文件

1
2
3
4
5
6
7
8
[sniffer]
# Enable or disable the use of an external sniffer (tcpdump) [yes/no].
enabled = yes

# Specify the path to your local installation of tcpdump. Make sure this
# path is correct.
# tcpdump = /usr/sbin/tcpdump
tcpdump = C:/Users/Marx/.cuckoo/tcpdump.exe

Windows布谷鸟

  • 不过在后期测试的时候,似乎不太正常,所以这个后期再处理下

上传病毒样本

Windows布谷鸟

选中了待分析的软件之后,分析它

Windows布谷鸟

在cuckoo -d 的日志下,可以看到分析进展,是否正在正常运行分析

Windows布谷鸟

在沙盒里面可以看到病毒运行的亚子

Windows布谷鸟

Windows布谷鸟

Windows布谷鸟

点击就可以看到报告了

查看报告

这是一个比较正常的软件的一个分析

  • 概要报告
    Windows布谷鸟

  • 静态分析
    Windows布谷鸟

下面的是一个病毒的分析报告

  • 概要报告
    Windows布谷鸟

  • 行为分析
    Windows布谷鸟

  • 释放文件
    Windows布谷鸟

结语

差不多啦,布谷鸟的部署,花了我两三个下午。虽说整体部署不是很复杂,遇到错误,fix掉配置的问题就可以了。然后总有玄学错误,让人无法排除。说明Cuckoo的稳定性和健壮性是有待提升的。但是问题不大,毕竟是能解决并正常使用的。就是怎么提高用户部署和使用体验的问题了。接着,Cuckoo的官网是没哟Windows下部署的说明文档的,希望能给看到的同学一些帮助,OK~ Easy~