Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# hvICE

hvICE is a research project focused on kernel memory introspection and protection using **libVMI**. It provides a set of tools to monitor kernel text and read-only data for unauthorized modifications, as well as a collection of "Icebreaker" kernel modules designed to test and bypass such protections.

## Features

- **Memory Introspection**: Uses libVMI to set EPT (Extended Page Table) write protections on kernel text (`_text` to `_etext`) and read-only data.
- **Violation Detection**: Detects and pauses the VM when a write attempt is made to protected kernel memory, distinguishing between legitimate kernel self-modifications and potential attacks.
- **Analysis Tools**: Includes a helper module to find kernel GVA/GPA ranges and generate configuration offsets for libVMI.
- **Icebreaker Suite**: A collection of kernel modules that attempt to bypass memory protections using various techniques:
- **CR0 Manipulation**: Disabling the write-protect bit in the `CR0` register.
- **PTE Manipulation**: Directly flipping write-protection bits in Page Table Entries.
- **KASLR Spoofing**: Manipulating page tables to spoof the kernel's KASLR offset to confuse introspection tools.

## Components

### 1. hvICE Main (`ICE.c`)
The core userspace application that interfaces with libVMI. It:
- Connects to a target VM domain.
- Identifies kernel text and rodata ranges via symbols.
- Sets EPT write violations on those ranges.
- Listens for events and pauses the VM upon a violation.

### 2. find_ranges (`find_ranges/`)
A kernel module used to identify the exact Guest Virtual Addresses (GVA) and Guest Physical Addresses (GPA) of the kernel code and essential `task_struct` offsets required for libVMI configuration.

### 3. Icebreaker (`icebreaker/`)
A suite of "adversarial" modules:
- **cr0_write_test**: Tests the ability to overwrite the system call table by disabling `CR0.WP`.
- **KASLR_spoof**: Attempts to trick libVMI's KASLR detection by allocating dummy pages at a spoofed kernel text start address.

## Installation & Usage

### Prerequisites
- **libVMI**: Installed and configured on the host machine.
- **KVM/Xen**: A supported hypervisor with VMI capabilities.
- **Kernel Headers**: Matching headers for the target guest kernel to compile the modules.

### Running hvICE
1. Compile `ICE.c` linking against `libvmi` and `glib`.
2. Run the binary providing the target domain name:
```bash
./ICE <domain_name>
```

### Using find_ranges
1. Compile the kernel module in `find_ranges/`.
2. Load the module into the guest:
```bash
insmod find_ranges.ko
```
3. Check `dmesg` for the generated libVMI configuration and kernel address ranges.

### Testing with Icebreaker
1. Compile the desired module in `icebreaker/`.
2. Load it into the guest while `hvICE` is monitoring:
```bash
insmod KASLR_spoof.ko
```
3. Observe the output of the `ICE` application to see if the memory violation was detected.