Skip to content

Unbounded loops in walk_regions() can cause indefinite hangs #86

Description

@SickleFire

Problem

Both the Windows walk_regions() (lines 61-127 in src/os/windows.rs) and the general region-walking logic have unbounded loops that can hang indefinitely on processes with unusual or malicious virtual address space layouts.

  1. A process with millions of VMAs can force mvis to iterate indefinitely.
  2. No iteration counter or timeout protection.
  3. Affects both interactive TUI and CLI, causing hangs.
  4. On Linux, similar issue with /proc//maps parsing with no line limit.

Proposed Solution

  1. Add configurable iteration limits:
const MAX_REGIONS_PER_PROCESS: usize = 100_000;
let mut region_count = 0;
loop {
    region_count += 1;
    if region_count > MAX_REGIONS_PER_PROCESS {
        return Err("Process has too many regions".into());
    }
    // ... existing logic ...
}
  1. Add progress reporting for large scans:

    • Log periodically when processing large address spaces.
    • Allow user to interrupt via Ctrl+C.

Alternative Approaches

  • Use OS profiling APIs to get VMA count before iterating

Examples

  • Attacker uses mmap() in loop to create 1 million VMAs, causing mvis CLI to hang.
  • TUI becomes unresponsive when user scans process with 50K+ regions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions