Coder Social home page Coder Social logo

vt-shittyvisor-rs's Introduction

A minimalistic Intel VT-x research hypervisor in Rust

Here are some of my notes: https://memn0ps.github.io/hypervisor-development-in-rust-part-1/

I made this shittyvisor for learning and fun in Dec/Jan/Feb and had planned to implement EPT but the legend Satoshi Tanda released his amazing one and I ran out of time. Maybe I'll come back to this later in the future if I ever get the time to fix the silly bug and implement EPT etc.. The original plan was to release it bug free with EPT but I can't be bothered anymore. I'm too tried and it takes too much of an effort to write blogs and code but I'm still happy that I learned a lot during the process.

Primary motivation: https://secret.club/2020/01/12/battleye-hypervisor-detection.html and https://secret.club/2020/07/06/bottleye.html and https://secret.club/2020/04/13/how-anti-cheats-detect-system-emulation.html

Note: I'm getting the following error in vmexit handler, which needs fixing: VMEXIT_REASON: 25 - VM entry with invalid VM-execution control fields in executive VMCS (when attempting to return from SMM)

Features

  • Check for Intel CPU
  • Check for VMX Support
  • Enable VMX
  • Set Lock Bit
  • Adjust Control Registers (set/clear CR0 and CR4)
  • Initialize VMXON (VMXON Region)
  • Initialize VMCS (VMCS Region)
  • Initialize VMCLEAR
  • Initialize VMPTRLD
  • Initialize VMCS Control Values
  • Initialize Guest Register State
  • Initialize Host Register State
  • Initialize VMLAUNCH
  • Handle VMEXITS / VMRESUME / VMXOFF
  • EPT (TODO)
  • MSR Bitmaps (TODO)
  • Changing IRQL (TODO)

Install

To start using Rust, download the installer, then run the program and follow the onscreen instructions. You may need to install the Visual Studio C++ Build tools when prompted to do so.

rustup toolchain install nightly
rustup default nightly
cargo install cargo-make
  • Step 1: Install Visual Studio 2022
  • Step 2: Install Windows 11, version 22H2 SDK
  • Step 3: Install Windows 11, version 22H2 WDK

Build

Change directory to .\driver\ and build driver and hypervisor

cargo make sign

Enable Test Mode or Test Signing Mode

bcdedit /set testsigning on

[Optional] Debug via Windbg

bcdedit /debug on
bcdedit /dbgsettings net hostip:<IP> port:<PORT>

[Optional] Debug Print Filter

  • Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
  • Create a new Key called Debug Print Filter
  • Create a new DWORD (32) Value
  • Give it the name DEFAULT
  • Give it the Value data: 8

Create / Start Service

sc.exe create hypervisor type= kernel binPath= C:\Windows\System32\drivers\hypervisor.sys
sc.exe query hypervisor
sc.exe start hypervisor

Credits / References / Thanks / Motivation

Thanks to @daax_rynd, @Intel80x86, @not_matthias, @standa_t, and @felix-rs / @joshuа

vt-shittyvisor-rs's People

Contributors

memn0ps avatar

Watchers

 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.