Home

Awesome

Dorothy2

A malware/botnet analysis framework written in Ruby.

For a perfect view of this document (images and links), open it through the project's code repository.

For any issue, use our Redmine

A wiki page for dorothy2 is under construction. Please take a look at it.

Gem Version

##Introduction

Dorothy2 is a framework created for suspicious binary analysis. Its main strengths are a very flexible modular environment, and an interactive investigation framework with a particular care of the network analysis. Additionally, it is able to recognise new spawned processes by comparing them with a previously created baseline. Static binary analysis and an improved system behaviour analysis will be shortly introduced in the next versions. Dorothy2 analyses binaries by the use of pre-configured analysis profiles. An analysis profile is composed by the following elements:

The use of profiles gives the researcher the possibility to run analysis on a set of binaries by using different environments. As it is known, some malwares are configured to run only in specific environment. A CSIRT, might use them to test suspicious malwares only against an environment that reflects the one of its customers. Sources can also be configured to be automatically analysed by certain profiles (e.g. use Profile_Windows_30sc for all the binaries retrieved by Kippo_source).

Dorothy2 is a continuation of my Bachelor degree's final project (Dorothy: inside the Storm ) that I presented on Feb 2009. More information about the whole project can be found on the Italian Honeyproject website.

The framework is mainly composed by five modules that can be even executed separately. The following picture gives an overview of the current modules and how they are connected each others.

dorothy.modules

In charge of retrieving the binaries from the configured sources. Currently a “binary source” can be system folder, an email-box, or a host reachable by ssh. Once the binaries have been retrieved, the BFM will populate the analysis queue.

In charge of analysing the queue by executing the scheduled binaries into a sandbox, and then storing the generated network traffic and its screenshots into the analysis folder (moreover populating Dorothive with the basic information of the file, and CouchDB with the network pcaps).

In charge of dissecting the pcaps file, and storing the most relevant information (flows data, GeoIP info, etc) into Dorothive. In addition, it extracts all the files downloaded by the sandbox through HTTP/HTTPS and store them into the binary file's analysis folder.

A dummy Sinatra application which gives an interactive overview on all the acquired data. WARNING: this module is intended to be executed in an controlled environment. The author strongly discourage to expose it on the Internet.

Our botnet infiltration module, refers to this ppt presentation for an overview.

The first four modules are publicly released under GPL 3 license as tribute to the the Honeynet Project Alliance. All the information generated by the framework - i.e. binary info, timestamps, dissected network analysis - are stored into a postgres DB (Dorothive) in order to be used for further analysis. A no-SQL database (CouchDB) is also used to mass store all the traffic dumps thanks to the pcapr/xtractr technology.

I started to code this project in late 2009 while learning Ruby at the same time. Since then, I´ve been changing/improving it as long as my Ruby coding skills were improving. Because of that, you may find some parts of code not-really-tidy :)

##Requirements

WARNING: The current version of Dorothy only utilises VMWare ESX5 as its Virtual Sandbox Module (VSM). Thus, the free version of ESXi is not supported due to its limitations in using the vSphere 5 API. However, the overall framework could be easily customised in order to use another virtualization engine. Dorothy2 is very modular,and any customisation or modification is very welcome.

Dorothy needs the following software (not expressly in the same host) in order to be executed:

Regarding the Operating System

Installation

It is recommended to follow this step2step process:

  1. Set your ESX environment
  1. Install the required software
  2. Install Dorothy and libmagic libraries
  3. Start Dorothy, and configure it
  4. Use Dorothy

1. Set your ESX environment

  1. Basic configuration (ssh)
  1. Configure two separate virtual networks, one dedicated exclusively to the SandBoxes (See Sample Setups)

  2. Configure the Windows VMs used for sandboxing

  1. From vSphere, create a unix VM dedicated to the NAM

In addition, remember to allow pcapr to run on all the interfaces

    What IP address should pcapr.Local run on? Use 0.0.0.0 to listen on all interfaces [127.0.0.1]
    0.0.0.0

5 From vSphere, configure the NIC on the virtual machine that will be used for the network sniffing purpose (NAM). >The vSwitch where the vNIC resides must allow the promisc mode, to enable it from vSphere:

   >Configuration->Networking->Proprieties on the vistualSwitch used for the analysis->Double click on the virtual network used for the analysis->Securiry->Tick "Promiscuous Mode", then select "Accept" from the list menu.

WARNING: If you are virtualizing ESX from a Linux host machine, remember to give the right privileges to the network interface used by VM Player / Workstation in order to allow promiscuous mode:

   > chmod a+rw /dev/vmnet0

* Sample Setups

  1. Basic setup

In the following example, the Dorothy gem is installed in the same host where Dorothive (the DB) resides. This setup is strongly recommended

>![dorothy.basicsetup](http://www.honeynet.it/wp-content/uploads/Dorothy-Basic.jpg)

2. Advanced setup

This setup is recommended if Dorothy is going to be installed in a Corporate environment. By leveraging a private VPN, all the sandbox traffics exits from the Corporate network with an external IP addresses.

dorothy.advancedsetup

2. Install the required software

  1. Install postgres

     $sudo apt-get install postgresql-9.1
    

or

    http://www.postgresql.org/download/

2. Configure a dedicated postgres user for Dorothy (or use the default postgres user instead, up to you :)

Note: If you want to use Postgres "as is", and then configure Dorothy to use "postgres" default the user, configure a password for this user at least (by default it comes with no password)

  1. Install the following packages

     $sudo apt-get install ruby1.9.3 rubygems postgresql-server-dev-9.1 libxml2-dev  libxslt1-dev libmagic-dev
    

For OSX users: all the above software are available through mac ports. A tip for libmagic: use brew instead:

    $ brew install libmagic
    $ brew link libmagic

In case you want to install pcapr here do this as well:

    $sudo apt-get install tshark zip couchdb

3. Install Dorothy gem

*Install Dorothy gem

    $ sudo gem install dorothy2

4. Start Dorothy, and configure it!

  1. Install MaxMind libraries

  2. Start Dorothy

     $ dorothy_start -v
    

The following message should appear

    [WARNING] It seems that the Dorothy configuration file is not present,
    please answer to the following question in order to create it now.

2. Follow the instruction to configure * The environment variables (db, esx server, etc) * The Dorothy sources (where to get new binaries) * The ESX Virtual machines used for the analysis

The first time you execute Dorothy, it will ask you to fill those information in order to create the required configuration files into the etc/ folder. However, you are free to modify/create such files directly - configuration example files can be found there too. Finally, check out the file extensions.yml within the /etc folder: it instructs Dorothy's sandboxes about how to process the binaries to analize.

###5. Use Dorothy

  1. Copy a .exe or .bat file into $yourdorothyhome/opt/bins/manual/

  2. Execute dorothy with the malwarefolder source type (if you left the default one)

    $ dorothy_start -v -s malwarefolder

Usage

Dorothy usage:

Usage:
dorothy2 [options]
where [options] are:
        --Version, -V:   Print the current version.
        --verbose, -v:   Enable verbose mode
       --infoflow, -i:   Print the analysis flow
   --baseline, -b <s>:   Create a new process baseline
     --source, -s <s>:   Choose a source (from the ones defined in etc/sources.yml)
   --CreateSource, -C:   Create new source file
     --daemon, -d <s>:   (start|stop) Execute/kill the selected module (-W, -B, -A) in backround. If no modules are specified, it will exec/kill all of them.
          --debug, -e:   Add extensive log trails
         --manual, -m:   Start everything, copy the file, and wait for me.
  --SandboxUpdate, -S:   Update Dorothive with the new Sandbox file
	--DorothiveInit, -D <s>:   (RE)Install the Dorothy Database (Dorothive)
	--queue, -q:   Show the analysis queue
	--Analyser, -A:   Execute only the Analyser Module (will analalyse only the current queue)
	--BFM, -B:   Execute only the Binary Fetcher Module (BFM)
	--DEM, -E:   Execute only the network Data Extation Module (DEM) aka doroParser
	--WebGUI, -W:   Execute the WebGUI Module (WGUI)
	--help, -h:   Show this message

Example

$dorothy2 -v -d start

This will execute all the modules in background

The first time dorothy2 is executed it will drive the user into configuring the analysis environment, more specifically the user will get through the following configuration steps:

Once the configuration step will be performed, the user will be always able to edit the configuration files at anytime.

###6. Debugging problems

I do recognise that setting up Dorothy is not the easiest task of the world. By considering that the whole framework consists in the union of several 3rd pats, it is very likely that one of them will fail during the process. Below there are some tips about how understand the root-cause of your crash.

  1. Set the verbose flag (-v) while executing dorothy, or the —debug flag for additional debugging trails.

$dorothy_start -v -d -s malwarefolder

  1. If any error occours, go to our Redmine and raise a bug-ticket!

  2. Write at dorothy2 at googlegroups.com


Acknowledgements

Thanks to all the people who have contributed in making the Dorothy2 project up&running:

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Every contribution is more than welcome! For any help, please don't hesitate in contacting us at : info at honeynet.it or through our ML: dorothy2 at googlegroups.com

License

Dorothy is copyrighted by Marco Riccardi and is licensed under the following GNU General Public License version 3.

                GNU GENERAL PUBLIC LICENSE
                   Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. http://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.