Git Product home page Git Product logo

cado-security / varc Goto Github PK

View Code? Open in Web Editor NEW
241.0 7.0 11.0 1.23 MB

Volatile Artifact Collector collects a snapshot of volatile data from a system. It tells you what is happening on a system, and is of particular use when investigating a security incident.

License: GNU General Public License v3.0

Shell 0.49% Batchfile 0.20% Python 99.10% YARA 0.20%
aws aws-fargate aws-lambda cloud-security dfir dfir-automation forensics memory-forensics aws-forensics docker-forensics

varc's Introduction

varc (Volatile Artifact Collector)

ci PyPI version

varc collects a snapshot of volatile data from a system. It tells you what is happening on a system, and is of particular use when investigating a security incident.

It creates a zip, which contains a number of different pieces of data to understand what is happening on a system:

  • JSON files e.g. running processes and what network connections they are making
  • Memory of running proccesses, on a per-process basis. This is also carved to extract log and text data from memory
  • Netstat data of active connections
  • The contents of open files, for example running binaries
  • Details of which processes triggered a provided compiled YARA rule file

We have successfully executed it across:

  • Windows
  • Linux
  • OSX
  • Cloud environments such as AWS EC2
  • Containerised Docker/Kubernetes environments such as AWS ECS/EKS/Fargate and Azure AKS
  • Even serverless environments such as AWS Lambda

Check out the example captures under the "Releases" tab to see some crazy data! The screen recording below shows a collection from a Docker container (left) and the output from running inside and AWS Lambda function which deployed Xmrig (right):

In line with the order of volatility, we collect process memory before anything else. Note that varc, and any other tool that runs inside a system, will impact the memory of a system.

Using as a compiled binary

You can find compiled binaries for Windows, Linux and OSX under the Releases tab. Simply execute and a zip is created with the output. To access some data, you will need to run with elevated privileges (i.e. sudo or root on Linux).

usage: varc [-h] [--skip-memory] [--skip-open] [--dump-extract] ...

optional arguments:
  -h, --help      show this help message and exit
  --skip-memory   Skip collecting process memory, which can be slow
  --skip-open     Skip collecting open files, which can be slow
  --dump-extract  Extract process memory dumps, which can be slow

Using as a Python library

Install from pip with:

pip3 install varc

Or alternatively, clone this repository then install with:

python3 setup.py install

Then call with:

from varc import acquire_system
output_file_path = acquire_system().zip_path

Automated Investigations and Response

varc significantly simplifies the acquisition and analysis of volatile data. Whilst it can be used manually on an ad-hoc basis, it is a great match for automatic deployment in response to security detections. The output of varc is designed to be easily consumed by other tools, in standard JSON format as much as possible.

A typical pipeline might be:

  • A detection is fired from a detection tool
  • varc is deployed to collect and identify further activity
  • Further remediation actions are taken based on the analysis of varc output

Why are the collected memory files empty?

Process memory collection is not currently supported on OSX.

If you run varc on a Linux system without the Ptrace Kernel capability enabled, you will get empty memory files. You will still get detailed system output.

For example, in our testing:

  • AWS Lambda successfully dumped process memory by default.
  • EKS on EC2 successfully dumped process memory by default.
  • ECS on Fargate required us to enable CAP_SYS_PTRACE in our task definition.

Using the collected data

All data is saved in an open, non-propietary format in the hope it can easily be processed by other community tools.

Our free tool Cado Community Edition will happily parse this zip, and display the JSON data tables as intended.

Our commercial tool Cado Response additionally enables you to automatically capture both static and volatile data from systems through Cado Host. By using the API, you can automatically investigate and respond to to detections from third party tools such as an EDR like SentinelOne or a cloud detection tool like GuardDuty.

Here is an example of varc output for a Lambda function running xmrig, viewed in Cado Community Edition:

License

This is licensed under the GPL. Please contact us if this does not work for your use case - we may be able to alternatively license under a non-copyleft license such as the Apache License. We're friendly! As this software is licensed under the GPL and used in our commercial product, we ask any contributors to sign a simple Contributor License Agreement (CLA).

License

We would love any Pull Requests or Bug Reports!

varc's People

Contributors

adamcohenhillel avatar bluesidestrongside avatar cadosecurity avatar chrisdoman avatar p-s-cott 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

varc's Issues

Glibc 2.15 required

For example: on linux, glibc 2.15 is a minimum, needed for the "process_vm_readv" syscall. That excludes older linuxes unfortunately. Now the aplication just crashes:

[2022-09-21 10:58:39,701]:[INFO] - Adding open file /lib64/security/pam_namespace.so
[2022-09-21 10:58:39,705]:[INFO] - Adding open file /usr/lib64/php/modules/gd.so
[2022-09-21 10:58:39,727]:[INFO] - Adding open file /usr/local/lib/python3.6/lib-dynload/_struct.cpython-36m-x86_64-linux-gnu.so
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/varc.py", line 43, in <module>
    extract_dumps=args.extract_dumps
  File "/usr/local/lib/python3.6/site-packages/varc_core/systems/__init__.py", line 21, in acquire_system
    return LinuxSystem(include_memory, include_open, extract_dumps)
  File "/usr/local/lib/python3.6/site-packages/varc_core/systems/linux.py", line 31, in __init__
    self.process_vm_readv = self.libc.process_vm_readv
  File "/usr/local/lib/python3.6/ctypes/__init__.py", line 361, in __getattr__
    func = self.__getitem__(name)
  File "/usr/local/lib/python3.6/ctypes/__init__.py", line 366, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib64/libc.so.6: undefined symbol: process_vm_readv

Reorganize Output

Hi,

While initially looking at the output of varc on a Linux capture, I was a bit confused about what the contents of /etc, /var and similar directories were until I realized that these just contain copies of the open files. Would it be better to have all of this under a directory such as open_files? I think it would make it clearer for anyone looking at the output. It would also mean that if you add additional functionality and capture additional files, they wouldn't be stored next to the opened file copies and can be stored in their own directories. Thanks

PyInstaller requirements

python3 -m pip install -r ../requirements.txt
python3 -m PyInstaller --onefile ../varc.py

PyInstaller <-- not listed in the project as a requirements.txt.

Pretty easy to install but would help and catch the error or provide a note in the batch to have users install the needed dependency.

Error:
C:\Tools\varc\release>python -m PyInstaller --onefile ../varc.py
C:\Users\user\AppData\Local\Programs\Python\Python38\python.exe: No module named PyInstaller

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.