GithubHelp home page GithubHelp logo

bondey / kvm-vmi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kvm-vmi/kvm-vmi

0.0 2.0 0.0 116 KB

KVM-based Virtual Machine Introspection

License: GNU General Public License v3.0

Makefile 17.83% Ruby 82.17%

kvm-vmi's Introduction

kvm-vmi

Join the chat at https://gitter.im/kvm-vmi/Lobby standard-readme compliant

Slack

KVM-based Virtual Machine Instrospection.

Table of Contents

Overview

This project adds virtual machine introspection to the KVM hypervisor to monitor a running virtual machine without a guest agent.

This project is divided into 4 components:

  • kvm: linux kernel with vmi patches for KVM
  • qemu: patched to allow introspection
  • nitro: userland library which receives events, introspects the virtual machine state, and fills the semantic gap
  • libvmi: virtual machine instrospection library with unified API across Xen and KVM

At the moment, 2 versions of VMI patches are available for QEMU/KVM in this repository:

1 - Nitro (legacy)

KVM-VMI started as an improved fork of Nitro, a set of VMI patches for QEMU/KVM to intercept system calls and rebuild the execution context.

Nitro is the name of the userland component that will receive and interpret the syscalls, as well as the name of the set of patches for QEMU/KVM.

Corresponding submodule branches:

  • kvm: vmi
  • qemu: vmi
  • nitro: master
  • libvmi: nitro

(Sorry for the confusing branches naming...)

Details:

Once the traps are set, the VM will be in a "paused" state and go back to the hypervisor on every system call. In details, the traps are working directly at the instruction level, on syscall and sysret, which means that you can also stop the VM when the system call returns from the kernel.

When the VM is "paused", some introspection can be done by reading or writing into the memory. Therefore it is possible to reconstruct VM state and understand the system call context (process name, system call name).

Furthermore, we are able to decode the system call parameters and display what file is being created (in the case of NtCreateFile, for Windows only).

A hooking API allows you to define callbacks on top of the system calls you intercept:

NtCreateFile

def enter_NtCreateFile(syscall):
    DesiredAccess = syscall.args[1]
    object_attributes = syscall.args[2]
    obj = ObjectAttributes(object_attributes, syscall.process)
    buffer = obj.ObjectName.Buffer
    access = FileAccessMask(DesiredAccess)
    syscall.hook = {
        'object_name': buffer,
        'access': access.rights
    }

Resulting in this output:

[
    {
        "event": {
            "cr3": "0x76f9e000",
            "vcpu": 0,
            "rax": "0x52",
            "direction": "enter",
            "type": "syscall"
        },
        "name": "NtCreateFile",
        "process": {
            "pid": 2344,
            "name": "powershell.exe"
        },
        "hook": {
            "object_name": "\\??\\C:\\Program Files\\Windows Sidebar\\Gadgets\\PicturePuzzle.Gadget\\en-US\\gadget.xml",
            "access": [
                "SYNCHRONIZE",
                "GENERIC_READ",
                "FILE_READ_ATTRIBUTES"
            ]
        }
    },
]

2 - KVMI

A complete set of VMI APIs proposed by BitDefender

This is where the current effort is focused on.

Corresponding submodule branches:

  • kvm: kvmi
  • qemu: kvmi
  • nitro: kvmi
  • libvmi: kvmi

Install

Vagrant (recommended)

Go to the vagrant/ sub-directory to install a development environment for kvm-vmi

Manually

Unfortunately, it is not possible to compile the KVM modules as an out-of-tree build. You will have to compile and install a new kernel along with the new modules.

This is only valid for the Nitro set of patches:

  • Start by compiling a new kernel in kvm
  • Reboot
  • Make sure you loaded the modified kernel module (make reload)
  • Go to nitro to setup the userland component and intercept syscalls
  • Compile the modified version of qemu if you intend to analyze syscall events

References

Based on Jonas Pfoh's work:

Maintainers

@Wenzel

Contributing

PRs accepted.

Small note: If editing the Readme, please conform to the standard-readme specification.

License

GNU General Public License v3.0

kvm-vmi's People

Contributors

wenzel avatar

Watchers

James Cloos avatar Bondey avatar

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.