Commit Graph
13 Commits
Author SHA1 Message Date
NK fd15e277a2 Improve Kerberos AVL tree extraction: add debug logging, include
credentials even without password (username+domain still valuable)
2026-02-10 07:22:58 +01:00
NK f23b0b71bb Add file-backed DLL page resolution from disk images
When Windows drops DLL .text pages from the working set, it zeros the
PTE knowing the data can be re-read from the DLL file. This commit
reads DLL files from the disk image via NTFS and serves those pages
when a zero-PTE fault occurs in a known non-writable DLL section.

Architecture:
- FileBackedResolver reads PE files from disk, extracts non-writable
  sections (.text, .rdata), maps them to module_base + VirtualAddress
- Binary search resolves VA to on-disk section data
- Integrated into ProcessMemory::read_virt() as fallback on PageFault
- Works synergistically with pagefile resolution (DLL .text enables
  pattern scans that discover structures whose data pages are in pagefile)

Results on VMware test snapshots:
- 472 sections loaded from 93 DLLs (~40 MB)
- 12,020 DLL pages resolved from disk per snapshot
- 2,235 pagefile pages resolved (up from 0 without file-backed)
- New --disk flag for single-file mode, auto-discovered in folder mode
2026-02-10 07:17:09 +01:00
NK dfc36becd5 Add multi-level pagefile resolution to page table walker
When page table pages (PDPT/PD/PT) are themselves swapped to
pagefile.sys, the parent entry becomes a pagefile PTE. The new
translate_with_pagefile() method resolves page table pages from
the pagefile at each walk level before continuing translation.

Also wire pagefile into ProcessMemory::read_virt() to resolve
data pages that are in pagefile (PageFileFault handling).
2026-02-10 07:02:09 +01:00
NK 578bdb8b5e Handle NTFS-fragmented hives in VMDK grain-direct scan
Phase 2c: fragmented hive assembly from scattered hbin blocks.
When registry hives are fragmented by NTFS (regf header at one location,
hbin blocks scattered across non-contiguous clusters), the grain scan now:

- Collects ALL hbin blocks during grain scan (not just offset=0 roots)
- Groups blocks by offset_in_hive into a candidate map
- Backtracking DFS (small hives ≤256KB): proximity-sorted candidates,
  strict then relaxed validation fallback
- Greedy assembly (large hives): first-match with zero-filled gaps
- Two-tier validation: strict (expected subkeys) → structural (root name)
- Broadened regf path matching for SYSTEM/SECURITY hives
- Default bins_size inference when no matching regf header exists

For incomplete delta disks (e.g., Windows10vstdio with 50% missing extents),
hives are now found and the error is specific ("Select not found" vs
generic "SYSTEM not found").
2026-02-10 06:44:50 +01:00
NK fa767be118 Add VMDK grain-direct scan for SAM extraction from incomplete disks
- Add scan_all_grains() to VmdkDisk: iterates physically allocated grains
  bypassing LBA translation, for fast scanning of incomplete VMDK images
- Add grain-direct fallback in SAM extraction pipeline: scans grains for
  regf/hbin signatures, assembles hives from virtual disk space
- Fix NK root key detection: remove KEY_HIVE_ENTRY (0x04) flag requirement
  since SAM's root key only has KEY_COMP_NAME (0x20)
- Add offset_in_hive validation when reading contiguous hbin blocks to
  prevent mixing blocks from different hives
- Add hive content validation (Select/Domains/Policy subkey checks) to
  reject false matches from non-system config hives
2026-02-09 06:24:30 +01:00
NK a4382362e0 Extend multi-version support to Server 2012-2025
- MSV: add Win7/8/8.1 primary credential offset variants (nt=0x20/0x28)
  with SHA1(NT) cross-validation using inline SHA1 (no external crate)
- MSV: add Win7/8/8.1 LogonSessionList code patterns (xor esi variants)
- WDigest: add Win7 CMP RDI,RBX / CMP RBX,RDI patterns
- DPAPI: add Win7/8 MASTERKEY_CACHE_ENTRY offsets with auto-detection
- Kerberos: multi-version physical scan (try +0x30 and +0x28 Password)
- Finder: rename WIN10_X64_LDR → X64_LDR (stable across Win7-11)
- Offsets: extend upper build bound to 29999 for future Server builds

Server version mapping verified:
  Server 2012 (9200), 2012R2 (9600), 2016 (14393),
  2019 (17763), 2022 (20348), 2025 (26100)
2026-02-09 05:13:33 +01:00
NK 91a570babe Multi-version Windows support (Win7 SP1 through Win11)
- EPROCESS: 5 offset tables (Win7/8/8.1/Win10 early/Win10 late+Win11)
  with auto-detection via find_system_process_auto brute-force scan
- MSV1_0: added Win7 (luid=0x30) and Win8/8.1 (luid=0x60) variants
- Kerberos: 4 offset variants with auto-detection (luid/cred_ptr/pwd differ)
- WDigest: Win10+ and Win7/8/8.1 offset variants with auto-detection
- TsPkg: 4 pTsPrimary offsets (0x40/0x70/0x80/0x90) with probing
- Credman: added Win7/8 MSV offset variants for credman_ptr
- Crypto: added Win7/8/8.1 key offset sets for IV/3DES/AES resolution
- Patterns: added Win7/8/8.1 byte patterns for lsasrv key init
- LDR offsets confirmed stable across Win7-11 (renamed to X64_LDR)
2026-02-09 04:25:36 +01:00
NK 5747f202b3 Fix LSA secret decryption: use AES-256-ECB, correct key offset
Two bugs fixed:
- Wrong AES mode: was using AES-256-CBC, should be AES-256-ECB
  (confirmed by mimikatz CRYPT_MODE_ECB, impacket per-block CBC
  reinit, pypykatz AESModeOfOperationECB)
- Wrong LSA key offset: PolEKList Secret is NT6_SYSTEM_KEYS struct
  (per mimikatz), actual key at offset 68 in decrypted blob, not 44

DefaultPassword now decrypts correctly (was garbled), DPAPI_SYSTEM
now shows correct 44-byte structure with valid version field.
2026-02-09 04:12:15 +01:00
NK 00802654c4 Add pagefile.sys resolution for paged-out LSASS memory
When a VM directory contains both memory snapshots and disk images,
open pagefile.sys from the VMDK/VDI/QCOW2 disk to resolve pages
that Windows swapped out. Uses pre-built NTFS data run map with
RefCell<Box<dyn DiskImage>> for interior mutability.

- PTE pagefile detection (bits 0/10/11 + pagefile number/offset)
- PageFileFault error variant in page table walker
- PagefileReader: opens disk, extracts pagefile.sys data runs,
  binary-search page resolution
- --disk CLI option for explicit disk image in single-file mode
- Folder mode auto-discovers disk and opens pagefile automatically
- Feature-gated behind "sam" (requires NTFS + disk image support)
2026-02-09 03:44:41 +01:00
NK fdf88e6c64 Add Makefile and improve CLI help/usage
- Makefile with release/debug/strip/install/check/clippy/test targets
- Show full help with examples when run without arguments (instead of
  cryptic clap error)
- Add --version flag, EXAMPLES section, supported input types in help
- Validate --format to text|csv|ntlm
2026-02-09 00:32:09 +01:00
NK 10b08d60bf Fix truncated process names by reading full path from PEB
EPROCESS.ImageFileName is a fixed 15-byte field, causing names like
"fontdrvhost.ex", "StartMenuExper", "VGAuthService." to be truncated.

Now reads PEB → ProcessParameters → ImagePathName (UNICODE_STRING) using
each process's own DTB for address translation, extracting just the
filename. Falls back to the 15-byte ImageFileName for kernel processes
(PEB=0) or when PEB pages are paged out.
2026-02-09 00:10:32 +01:00
NK 387c61bdb6 Fix PID 0 garbage in process listing and improve SAM scan resilience
- Skip PID 0 (System Idle Process) in enumeration: has no valid DTB,
  PEB, or name, only adds noise to the listing
- Filter ImageFileName to printable ASCII to prevent replacement
  characters from non-UTF8 bytes (e.g. 0xFF fill in Idle process)
- Add hbin-based fallback scan for NTFS-fragmented hives where regf
  header and hbin data are at non-contiguous disk locations
- Validate hive sizes: reject SYSTEM < 512KB and SAM < 16KB to avoid
  false matches (e.g. 28KB volatile "System" hive)
2026-02-08 22:44:50 +01:00
NK 2011826ed1 vmkatz: VM memory forensics tool with LSASS, SAM, and folder modes
Three extraction modes:
- LSASS: credentials from .vmem/.vmsn/.sav snapshots (9 SSP providers)
- SAM: NT/LM hashes + LSA secrets from .vdi/.vmdk/.qcow2 disk images
- Folder: auto-discover and process all VM files in a directory

Key features:
- VMware twoGbMaxExtentSparse VMDK with snapshot chain support
- VMDK descriptorless mode for orphan extent files with gap handling
- VirtualBox .sav SSM format with LZF decompression
- VDI dynamic/differencing images with parent chain
- QCOW2 L1/L2 address translation with backing file chain
- MBR/GPT partition tables, NTFS navigation via ntfs crate
- Raw regf + hbin scan fallbacks for incomplete disk images
- Hive size validation to reject false matches
- All 9 mimikatz SSP providers with physical scan fallbacks
2026-02-08 22:02:50 +01:00