Giter VIP home page Giter VIP logo

cert-polska / drakvuf-sandbox Goto Github PK

View Code? Open in Web Editor NEW
986.0 35.0 135.0 24.51 MB

DRAKVUF Sandbox - automated hypervisor-level malware analysis system

Home Page: https://drakvuf-sandbox.readthedocs.io/

License: Other

Shell 1.88% Makefile 0.26% Python 78.21% JavaScript 13.57% CSS 0.19% Dockerfile 0.23% C 2.56% CMake 0.08% C++ 3.03%
malware sandbox reverse-engineering malware-analysis malware-research

drakvuf-sandbox's Introduction

DRAKVUF Sandbox

DRAKVUF Sandbox is an automated black-box malware analysis system with DRAKVUF engine under the hood, which does not require an agent on guest OS.

This project provides you with a friendly web interface that allows you to upload suspicious files to be analyzed. Once the sandboxing job is finished, you can explore the analysis result through the mentioned interface and get an insight on whether the file is truly malicious or not.

Because it is usually pretty hard to set up a malware sandbox, this project also provides you with an installer app that would guide you through the necessary steps and configure your system using settings that are recommended for beginners. At the same time, experienced users can tweak some settings or even replace some infrastructure parts to better suit their needs.

Quick start

DRAKVUF Sandbox - Analysis view

Supported hardware & software

In order to run DRAKVUF Sandbox, your setup must fullfill all of the listed requirements.

  • Processor:
    • βœ”οΈ Required Intel processor with Intel Virtualization Technology (VT-x) and Extended Page Tables (EPT) features
  • Host system with at least 2 core CPU and 5 GB RAM, running GRUB as bootloader, one of:
    • βœ”οΈ Debian 10 Buster
    • βœ”οΈ Ubuntu 18.04 Bionic
    • βœ”οΈ Ubuntu 20.04 Focal
  • Guest system, one of:
    • βœ”οΈ Windows 7 (x64)
    • βœ”οΈ Windows 10 build 2004 (x64)

Nested virtualization:

  • βœ”οΈ Xen - works out of the box.
  • βœ”οΈ VMware Workstation Player - works, but you need to check Virtualize EPT option for a VM; Intel processor with EPT still required.
  • βœ”οΈ KVM - works, however it is considered experimental. If you experience any bugs, please report them to us for further investigation.
  • ❌ AWS, GCP, Azure - due to lack of exposed CPU features, hosting DRAKVUF Sandbox in the cloud is not supported (although it might change in the future).
  • ❌ Hyper-V - doesn't work.
  • ❌ VMWare Fusion (Mac) - doesn't work.

Maintainers/authors

Feel free to contact us if you have any questions or comments.

General contact email: [email protected] (fastest response)

You can also chat with us about this project on Discord:

This project is authored by:

If you have any questions about DRAKVUF engine itself, contact [email protected]

Acknowledgements

This project was created and/or upgraded thanks to the following organizations and initiatives:

Connecting Europe Facility of the European Union

Co-financed by the Connecting Europe Facility of the European Union

The Honeynet Project

Contributed by The Honeynet Project

CERT Polska

Maintained by CERT Polska

drakvuf-sandbox's People

Contributors

bonusplay avatar c3rb3ru5d3d53c avatar catsuryuu avatar ch4rl1e93 avatar chivay avatar dependabot[bot] avatar desecnd avatar icedevml avatar jack28 avatar jstarink avatar kscieslinski avatar manorit2001 avatar msm-cert avatar msm-code avatar psrok1 avatar techathena avatar x-m7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drakvuf-sandbox's Issues

Duplicate frontend building

When building the deb package for drakcore, build target from rules is run twice.
It triggers rebuild of frontend and download of minio which increases build times.

Add to README: how to troubleshoot problems with device model not starting

If the error log contains the following error about device model:

libxl: error: libxl_create.c:1676:domcreate_devmodel_started: Domain 4:device model did not start: -3
subprocess.CalledProcessError: Command 'xl create /etc/drakrun/configs/vm-0.cfg' returned non-zero exit status 3.

then one should inspect /var/log/xen/qemu*.log in order to determine what actually happened. This should be docummented in "Troubleshooting" section in README.

Prepare few comparisons for ProcDOT integration

We do need some material to compare how far we are currently with the ProcDOT integration. This could be basically achieved by dropping a few samples into a VM monitored by procmon, generating graphs and finally comparing these graphs against ones that are generated by our integration.

Xubuntu 18.04 compatibility: missing dataclasses package

In Xubuntu 18.04, there is a problem with drakcore UI caused by lack of dataclasses module (builtin since Python 3.7, but Xubuntu has Python 3.6).

This is not on our list of officially supported systems but if this is an only issue and it is related just to the compatibility with Python 3.6 then we could probably study the topic.

Apr 28 16:52:46 ubuntu uwsgi[3909]: Traceback (most recent call last): Apr 28 16:52:46 ubuntu uwsgi[3909]: Β  File "/opt/venvs/drakcore/lib/python3.6/site-packages/drakcore/app.py", line 16, in <module> Apr 28 16:52:46 ubuntu uwsgi[3909]: Β  Β  from drakcore.pstree import generate_process_tree Apr 28 16:52:46 ubuntu uwsgi[3909]: Β  File "/opt/venvs/drakcore/lib/python3.6/site-packages/drakcore/pstree.py", line 2, in <module> Apr 28 16:52:46 ubuntu uwsgi[3909]: Β  Β  from dataclasses import dataclass, field Apr 28 16:52:46 ubuntu uwsgi[3909]: ModuleNotFoundError: No module named 'dataclasses'

Compatibility study for Azure Cloud

Related bug: #90

The default azure kernel shipped with Azure Cloud Ubuntu 18.04 doesn't declare Xen support, thus the grub hook doesn't see it as a suitable Dom0 system.

Some guide on how to prepare a custom Ubuntu VM with a generic kernel:
https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-ubuntu

Another options is to simply try to replace azure kernel with a stock one, but the Xen Dom0 doesn't work out of the box in such setup:
https://ubuntu.com/blog/microsoft-and-canonical-increase-velocity-with-azure-tailored-kernel

Internal Server Error when visiting localhost:6300

Describe the bug

After completing the necessary steps to complete the installation of the sandbox, I tried to go to http://localhost:6300. Instead of the the web UI, I was greeted with an internal server error.

How to reproduce

Steps to reproduce the behavior:

  1. Install sandbox as instructed
  2. Execute sudo draksetup postinstall
  3. Visit localhost:6300

Output of the status checking commands

systemctl status drak-web.service

drak-web.service - drak-web service
   Loaded: loaded (/etc/systemd/system/drak-web.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-05-09 23:49:53 PDT; 10min ago
 Main PID: 783 (uwsgi)
    Tasks: 6 (limit: 2207)
   CGroup: /system.slice/drak-web.service
           β”œβ”€ 783 /opt/venvs/drakcore/bin/uwsgi --ini /etc/drakcore/uwsgi.ini
           β”œβ”€1014 /opt/venvs/drakcore/bin/uwsgi --ini /etc/drakcore/uwsgi.ini
           β”œβ”€1016 /opt/venvs/drakcore/bin/uwsgi --ini /etc/drakcore/uwsgi.ini
           β”œβ”€1018 /opt/venvs/drakcore/bin/uwsgi --ini /etc/drakcore/uwsgi.ini
           β”œβ”€1029 /opt/venvs/drakcore/bin/uwsgi --ini /etc/drakcore/uwsgi.ini
           └─1030 /opt/venvs/drakcore/bin/uwsgi --ini /etc/drakcore/uwsgi.ini

May 09 23:49:59 ubuntu uwsgi[783]: *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
May 09 23:49:59 ubuntu uwsgi[783]: *** uWSGI is running in multiple interpreter mode ***
May 09 23:49:59 ubuntu uwsgi[783]: spawned uWSGI master process (pid: 783)
May 09 23:49:59 ubuntu uwsgi[783]: spawned uWSGI worker 1 (pid: 1014, cores: 1)
May 09 23:49:59 ubuntu uwsgi[783]: spawned uWSGI worker 2 (pid: 1016, cores: 1)
May 09 23:50:00 ubuntu uwsgi[783]: spawned uWSGI worker 3 (pid: 1018, cores: 1)
May 09 23:50:00 ubuntu uwsgi[783]: spawned uWSGI worker 4 (pid: 1029, cores: 1)
May 09 23:50:00 ubuntu uwsgi[783]: spawned uWSGI http 1 (pid: 1030)
May 09 23:52:48 ubuntu uwsgi[783]: --- no python application found, check your startup logs for errors ---
May 09 23:52:48 ubuntu uwsgi[783]: [pid: 1014|app: -1|req: -1/1] 127.0.0.1 () {36 vars in 563 bytes} [Sat May  9 23:52:48 2020] GET / => generated 21 bytes in 2 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

sudo systemctl status [email protected]

[email protected] - drakrun service
   Loaded: loaded (/etc/systemd/system/[email protected]; indirect; vendor preset: enabled)
   Active: active (running) since Sat 2020-05-09 23:50:07 PDT; 16min ago
 Main PID: 1334 (drakrun)
    Tasks: 1 (limit: 2207)
   CGroup: /system.slice/system-drakrun.slice/[email protected]
           └─1334 /opt/venvs/drakrun/bin/python /opt/venvs/drakrun/bin/drakrun 1

May 09 23:50:07 ubuntu systemd[1]: Started drakrun service.
May 09 23:52:07 ubuntu drakrun[1334]: iptables: Bad rule (does a matching rule exist in that chain?).
May 09 23:52:07 ubuntu drakrun[1334]: iptables: Bad rule (does a matching rule exist in that chain?).
May 09 23:52:07 ubuntu drakrun[1334]: [2020-05-09 23:52:07,174][INFO] Service karton.drakrun-prod started
May 09 23:52:07 ubuntu drakrun[1334]: [2020-05-09 23:52:07,187][INFO] Service binds created.
May 09 23:52:07 ubuntu drakrun[1334]: [2020-05-09 23:52:07,195][INFO] Binding on: {'type': 'sample', 'stage': 'recognized', 'platform': 'win32'}
May 09 23:52:07 ubuntu drakrun[1334]: [2020-05-09 23:52:07,198][INFO] Binding on: {'type': 'sample', 'stage': 'recognized', 'platform': 'win64'}

tree /var/lib/drakcore

.
└── minio
    β”œβ”€β”€ drakrun
    β”œβ”€β”€ karton2
    └── .minio.sys
        β”œβ”€β”€ backend-encrypted
        β”œβ”€β”€ buckets
        β”‚   β”œβ”€β”€ .bloomcycle.bin
        β”‚   β”œβ”€β”€ .minio.sys
        β”‚   β”‚   └── buckets
        β”‚   β”‚       β”œβ”€β”€ .bloomcycle.bin
        β”‚   β”‚       β”‚   └── fs.json
        β”‚   β”‚       β”œβ”€β”€ .usage-cache.bin
        β”‚   β”‚       β”‚   └── fs.json
        β”‚   β”‚       └── .usage.json
        β”‚   β”‚           └── fs.json
        β”‚   β”œβ”€β”€ .tracker.bin
        β”‚   β”œβ”€β”€ .usage-cache.bin
        β”‚   └── .usage.json
        β”œβ”€β”€ config
        β”‚   β”œβ”€β”€ config.json
        β”‚   └── iam
        β”‚       └── format.json
        β”œβ”€β”€ format.json
        β”œβ”€β”€ multipart
        └── tmp
            β”œβ”€β”€ 64f8397f-8834-4223-83c1-336df8a504ef
            β”œβ”€β”€ 72d1d724-222f-44a6-810c-a24e2c742133
            β”œβ”€β”€ b7219802-97ef-4e4a-b647-55979848954f
            └── f8c8d0cb-6d09-4a91-bc9b-53fbebf64459

18 directories, 11 files

Improve analysis list UI

Right now, only the analysis ID is shown on the list of analyses. We would want to also show at least:

  • SHA256 of the sample,
  • the output from file sample.bin command,
  • the analysis date and time.

xc: error: panic: xc_dom_boot.c:122: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory

Describe the bug

when im try this command: sudo draksetup install --iso /opt/path_to_windows.iso

logs:

root@ubuntu:/home/fmt# draksetup install --iso win7.iso
[2020-05-09 05:50:33,413][INFO] Ensuring that drakrun@* services are stopped...
[2020-05-09 05:50:35,586][INFO] Performing installation...
[2020-05-09 05:50:35,766][INFO] Checking xen-detect...
Running in PV context on Xen V4.13.
[2020-05-09 05:50:35,921][INFO] Testing if xl tool is sane...
[2020-05-09 05:50:38,503][INFO] Generated VM configuration for vm-0
Parsing config from /etc/drakrun/configs/vm-0.cfg
xc: error: panic: xc_dom_boot.c:122: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory
libxl: error: libxl_dom.c:762:libxl__build_dom: xc_dom_boot_mem_init failed: Cannot allocate memory
libxl: error: libxl_create.c:1420:domcreate_rebuild_done: Domain 1:cannot (re-)build domain: -3
libxl: error: libxl_domain.c:1177:libxl__destroy_domid: Domain 1:Non-existant domain
libxl: error: libxl_domain.c:1131:domain_destroy_callback: Domain 1:Unable to destroy guest
libxl: error: libxl_domain.c:1058:domain_destroy_cb: Domain 1:Destruction of domain failed
[2020-05-09 05:50:48,029][ERROR] Failed to launch VM vm-0
Traceback (most recent call last):
File "/opt/venvs/drakrun/lib/python3.6/site-packages/drakrun/draksetup.py", line 201, in install
subprocess.run('xl create {}'.format(shlex.quote(cfg_path)), shell=True, check=True)
File "/usr/lib/python3.6/subprocess.py", line 438, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'xl create /etc/drakrun/configs/vm-0.cfg' returned non-zero exit status 3.

my vm-0.cfg info:

root@ubuntu:/home/fmt# cat /etc/drakrun/configs/vm-0.cfg
arch = 'x86_64'
name = "vm-0"
maxmem = 2048
memory = 2048
vcpus = 2
maxcpus = 2
builder = "hvm"
boot = "cd"
hap = 1
acpi = 1
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "destroy"
vnc=1
vnclisten="0.0.0.0"
vncdisplay=0
vncpasswd="lAHA0VnXQv0ElbHfugK0"
usb = 1
usbdevice = "tablet"
altp2m = 2
shadow_memory = 16
audio=1
soundhw='hda'
vif = [ 'type=ioemu,model=e1000,bridge=drak0' ]
disk = [ "tap:qcow2:/var/lib/drakrun//volumes/vm-0.img,xvda,w", "file:/home/fmt/win7.iso,hdc:cdrom,r" ]

error

Add to README: how to manipulate the amount of memory dedicated to Dom0 and VMs

Such an error may indicate that there is not enough memory in total:

subprocess.CalledProcessError: Command 'xl create /etc/drakrun/configs/vm-0.cfg' returned non-zero exit status 3.
xc: error: panic: xc_dom_boot.c:122: xc_dom_boot_mem_init: can't allocate low memory for domain: Out of memory

this may be resolved by editing either /etc/default/grub.d/xen.cfg to adjust Dom0 memory (update-grub and reboot required) or by editing /etc/drakrun/scripts/cfg.template to adjust DomU memory. This should be documented.

vmi-win-guid command timeout

Describe the bug

During Setup at the point when i run the command sudo draksetup postinstall i run into a timeout.

root@debian:/home/martin# draksetup postinstall
Traceback (most recent call last):
  File "/usr/lib/python3.7/subprocess.py", line 474, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.7/subprocess.py", line 939, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.7/subprocess.py", line 1682, in _communicate
    self._check_timeout(endtime, orig_timeout)
  File "/usr/lib/python3.7/subprocess.py", line 982, in _check_timeout
    raise TimeoutExpired(self.args, orig_timeout)
subprocess.TimeoutExpired: Command '['vmi-win-guid', 'name', 'vm-0']' timed out after 30 seconds

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/draksetup", line 7, in <module>
    ds.main()
  File "/opt/venvs/drakrun/lib/python3.7/site-packages/drakrun/draksetup.py", line 389, in main
    generate_profiles()
  File "/opt/venvs/drakrun/lib/python3.7/site-packages/drakrun/draksetup.py", line 233, in generate_profiles
    output = subprocess.check_output(['vmi-win-guid', 'name', 'vm-0'], timeout=30).decode('utf-8')
  File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.7/subprocess.py", line 479, in run
    stderr=stderr)
subprocess.TimeoutExpired: Command '['vmi-win-guid', 'name', 'vm-0']' timed out after 30 seconds

I guessing this is, because the command vmi-win-guid name vm-0 takes around 1 minute to complete.

I am running all of this in a KVM on proxmox.

How to reproduce

Steps to reproduce the behavior:

  1. Install drakcore and drakrun
  2. Start and install a Windows 10 x64 image
  3. Execute sudo draksetup postinstall

Output of the status checking commands

root@debian:/home/martin# drak-healthcheck
Checking daemon status...
drak-web.service              OK
drak-system.service           OK
drak-minio.service            OK
drak-postprocess.service      OK

Checking worker status...
[email protected]             ERROR

Design needed: Behavioral signatures

This is a feature request based on community feedback.

Signatures should allow to extract some interesting high-level facts out of behavioral logs, e.g. process injected itself to other process and exitted, process created files in C:\sth\sth\Autostart\ etc.

Xen not showing up as boot entry in grub in Ubuntu Server 18.04 LTS

Describe the bug

When installing the drakvuf bundle on Ubuntu Server 18.04 LTS, xen is not showing up in the grub bootloader, and it does not boot into xen by default.

How to reproduce

Steps to reproduce the behavior:

  1. Install drakvuf bundle
  2. Execute sudo reboot
  3. xen-detect always returns not running on xen

Configurable analysis timeout

Currently we do have hardcoded timeout of 10 minutes. This should be configurable globally (in config) and locally (if somebody would like to override this value for a single analysis).

Lower Redis connection timeout from 120 seconds

Looks like the current Redis connection timeout is set to 120 seconds. This should be lowered to some sane value.

Apr 26 16:19:13 zen systemd[1]: Started drakrun service.
Apr 26 16:21:12 zen drakrun[417]: [2020-04-26 16:21:12,503][INFO] Service karton.drakrun-prod started
Apr 26 16:21:12 zen drakrun[417]: [2020-04-26 16:21:12,505][INFO] Service binds created.
Apr 26 16:21:12 zen drakrun[417]: [2020-04-26 16:21:12,505][INFO] Binding on: {'type': 'sample', 'stage': 'recognized', 'platform': 'win32'}
Apr 26 16:21:12 zen drakrun[417]: [2020-04-26 16:21:12,506][INFO] Binding on: {'type': 'sample', 'stage': 'recognized', 'platform': 'win64'}

Parse procmon log to the form of process tree

Parse procmon output into a form of a process tree that can be easily read by human (and visualized).

E.g. output structure:

[
  {
    "pid":2408,
    "process":"C:\\Users\\Administrator\\AppData\\Local\\Temp\\cmd.exe",
    "children":[
      {
        "pid":2968,
        "process":"C:\\Users\\Administrator\\AppData\\Local\\Temp\\emo2.exe",
        "children":[
          {
            "pid":3048,
            "process":"C:\\Users\\Administrator\\AppData\\Local\\Temp\\emo3.exe",
            "children":[

            ]
          }
        ]
      },
      {
        "pid":3028,
        "process":"C:\\Users\\Administrator\\AppData\\Local\\Temp\\emo4.exe",
        "children":[

        ]
      }
    ]
  }
]

Ubuntu 20.04 compatibility

At the moment there are few separate issues that are preventing DRAKVUF Sandbox from working on Ubuntu 20.04:

patches:

  • adjustment PR to drakvuf
  • adjustment PR to drakvuf-sandbox

Correlate socketmon/apimon logs and PCAP data into a basic network activity report

DRAKVUF is already capable of producing network-related logs (socketmon plugin) and generic WinAPI call logs (apimon plugin). We do also have ordinary pcaps. This can be correlated together into the form of network activity report.

We are mostly interested in basic info about:

  • DNS queries
  • TCP streams and UDP packets
  • HTTP(S) traffic

All of the above should be annotated with PIDs, whenever possible.

Behavioral analysis UI

Depends on #10. Visualize DRAKVUF logs in the web UI in order to make them more discoverable.

For each process separately, we would like to show (at least):

  • related process activity (procmon logs)
  • registry activity (apimon, regmon logs)
  • file operations (apimon, filetracer, filedelete logs)

related #43

Generate usermode DLL profiles (e.g. wntdll)

Since we do have a functional networking, we may:

  • spin up a temporary VM
  • spin up a temporary web server
  • inject a PowerShell command that would grab the interesting DLLs (e.g. syswow64\ntdll.dll) and upload them to the web server
  • retrieve them on the host side and generate necessary profiles

Compatibility study for Google Cloud Platform

Check whether drakvuf-sandbox is feasible on GCP on at least one of the supported systems. Info needed: whether some custom hacks/adjustments are needed and if we could document them/implement some improvements dedicated for GCP.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.