linux sandbox 软件下载,开源软件 cuckoo sandbox 学习 (一) 安装使用

本帖最后由 helloman 于 2013-10-5 17:12 编辑

http://labs.alienvault.com/labs/index.php/2012/hardening-cuckoo-sandbox-against-vm-aware-malware/

1. 环境搭建

ref http://docs.cuckoosandbox.org/en/latest/

ref http://www.behindthefirewalls.com/2013/07/how-to-install-cuckoo-sandbox-on-ubuntu.html

第一部分, 分析机的环境搭建环境需要一台 linux 的机器作为分析的机器, 即 host, 需要创建虚拟机来模拟恶意软件的运行环境,我们使用一台装有 win7的虚拟机,即guest。虚拟机软件可以使用 virtual box.

cuckoo利用在guest机器上运行恶意软件 , 采集软件的的行为, 发给分析的机器, 由分析的机器对采集的信息进行处理,生成报告。

下面我们来分别看 分析机器和guest机器环境的搭建:

分析机器:

1。 os : ubuntu 12.04.1 desktop i386

安装在一台vmware虚拟机上。administrator/password

2。Python libraries

分析的脚本使用的python语言,我们需要python.

$ sudo apt-get install pythonCuckoo 还需要 SQLAlchemy .

$ sudo apt-get install python-sqlalchemy

3. 可选模块

$ sudo apt-get install python-dpkt python-jinja2 python-magic python-pymongo python-libvirt python-bottle python-pefile

4. 可选模块 Yara

apt-get install libpcre3 libpcre3-dev

tar xvfz yara-1.7.tar.gz

cd yara-1.7

./configure

make

sudo make install

cd ..

tar xvfz yara-python-1.7.tar.gz

cd yara-python-1.7

python setup.py build

sudo python setup.py install

如果找不到 python.h, 下载开发环境

sudo apt-get install python2.7-dev, 察看你的 python 版本。下载相应的包。

5。 可选模块 Pydeep

需要先 下载 ssdeep

http://sourceforge.net/projects/ssdeep/files/ssdeep-2.10/ssdeep-2.10.tar.gz/download

tar xvfz ssdeep-2.10.tar.gz

cd ssdeep-2.10./configure

make

make check

sudo make install

unzip master.zip

cd pydeep-master

python setup.py build

sudo python setup.py install

6. Installing Tcpdump

$ sudo apt-get install tcpdump

7. 安装 Vitual Box

官网下载https://www.virtualbox.org/wiki/Linux_Downloadsdpkg -i virtualbox-4.2_4.2.16-86992~Ubuntu~precise_i386.deb用Vitual Box 创建一个虚拟机,如果你像我一样, host机器,ubuntu 也是装在一个vmware的虚拟机器上, 你可以设置vmware虚拟一个光驱, 钩选上 connected, 和 connect at power on. 确保 用户在cdrom组

$ sudo usermod -a -G cdrom username

然后启动虚拟机, 安装guest 机器 的操作系统, 我这里装的是 win7.

8.创建一个用户, 并加入 组vboxusers$ sudo adduser cuckoo

$ sudo usermod -a -G vboxusers cuckoo

9. 下载并解压 cuckoo本帖最后由 helloman 于 2013-8-16 14:47 编辑

环境搭建第二部分, guest 虚拟机的环境搭建

1. 下载并安装 python 和 python p_w_picpath library

2. 从控制面板关掉 firewall 和  auto update 以及uac

3. 网络设置

win7 我们使用静态ip 192.168.56.101

4.设置共享文件夹, 拷贝agent 到 guest

virtual box 菜单 devices -- 〉shared folder, 添加一个共享文件夹,例如取名为 myshare

运行命令 net use e: \\vboxsvr\myshare

你就可以看到 一个新的盘符 e.

我们在 ubuntu 往共享文件夹拷东西, 就可以在 win7的 E盘里看到。我们把 cuckoo/agent/agent.py 拷到里面去并运行它。guest 机器 需要这个文件来和host 通信。

你可以把它放在 startup 目录, 让每次系统启动时自动运行, 或者运行它然后做 snapshot, 这样每次虚拟机一运行,  agent 就会运行。

5。 修改host 上 cuckoo/config/virtual box.conf 配置文件

将虚拟机名改成你创建的虚拟机。

6.  到现在已经完成设置,我们创建快照

$ VBoxManage snapshot "" take "" --pause

环境搭建第三部分,跑一个试试1. 命令行切换到 cuckoo目录, 运行 cuckoo$ python cuckoo.py2. 再起一个 terminal, 用来提交一个分析$python ./utils/submit.py /home/..../some.exe3. 等待分析结束, 察看分析结果cuckoo/storage/analyses/1/reports/report.html4. 关闭虚拟机, 恢复到干净状态vboxmanage controlvm 'gest_win7' poweroffvboxmanage snapshot 'gest_win7' restorecurrent

自定义特征用于恶意程序的分类

上面介绍了环境的搭建,下面我们介绍一下使用cuckoo根据我们自己的需要来做分析。

比如:

有些***程序他会在运行时候创建 一个可执行程序。 我们创建一个特征, 来查看待 检测的程序是否生成了 exe文件。

cuckoo 的安装后signatures目录有个 文件, modules/signatures/creates_exe.py, 它就是这个作用。

打开这个文件,修改

enabled = False 为 enabled = True.

from lib.cuckoo.common.abstracts import Signature

class CreatesExe(Signature):

name = "creates_exe"

description = "Creates a Windows executable on the filesystem"

severity = 2

categories = ["generic"]

authors = ["Cuckoo Developers"]

minimum = "0.5"

enabled = False

defrun(self):

match = self.check_file(pattern=".*\\.exe$",

regex=True)

if match:

self.data.append({"file": match})

return True

return False

然后我们提交一个文件, 这个文件会创建一个文件, 其文件名为 some.exe. 我们看看, cuckoo是否捕捉到这个动作。

用vs 创建一个console类型 project,

#include "stdafx.h"

#include

#include

#include

int _tmain(int argc, _TCHAR* argv[])

{

TCHAR buf[MAX_PATH];

printf("hello, cuckoo, I am bad, trying to copy myself.\n");

// The function gets the current module for you.

:: DeleteFile(L"C:\\some.exe");

GetModuleFileName(0, buf, MAX_PATH);

::CopyFile(buf,L"C:\\some.exe",FALSE);

return 0;

}

提交后,察看report.html, 我们看到在signatures 下面显示

Creates a Windows executable on the filesystem

Behavior Summery:

Files

c:\some.exe

说明cuckoo成功的捕获到了这个特征。

建议参考下 https://github.com/cuckoobox/community/tree/master/modules/signatures, 这里有别人写的一些特征匹配

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值