How wavestone-cdt/edrsandblast works
1. Overall shape
- This repo is a Windows x64 offensive toolkit centered on a shared C codebase plus multiple front-end binaries.
- The core design splits into:
- a common library layer with reusable primitives and parsing logic,
- user-mode evasion logic,
- kernel-mode evasion logic mediated by a vulnerable driver,
- small CLI entrypoints that choose actions,
- and a separate Python offset-extraction pipeline used to prepare version-specific data.
2. Top-level build products
- EDRSandblast is the main project containing the reusable implementation.
- EDRSandblast_StaticLibrary packages the core API for reuse by other binaries.
- EDRSandblast_CLI is the primary command-line front end.
- EDRSandblast_LsassDump is a specialized launcher focused on LSASS dumping.
- The solution is Visual Studio–based (.sln, .vcxproj) and targets native Windows, not .NET.
3. Core subsystem layout
- The code is organized by concern rather than by executable:
- UserlandBypass/ handles DLL unhooking, direct syscalls, and other in-process evasion.
- KernellandBypass/ handles kernel callback removal and ETW Threat Intelligence neutralization.
- LSASSProtectionBypass/ handles RunAsPPL and Credential Guard-related bypasses.
- Drivers/ contains driver-specific implementations for vulnerable-driver read/write primitives.
- Utils/ contains shared utilities for parsing, offsets, memory primitives, process inspection, and Windows plumbing.
- Includes/ is the public header surface for these subsystems.
4. Primary control flow
- The CLI front ends call into EDRSandblast_API in the static library.
- That API dispatches into one of several modes: audit, dump, cmd, credguard, firewall, or driver-loading actions.
- Each mode composes lower-level capabilities:
- user-mode hooks discovery/removal,
- kernel memory read/write,
- process dumping,
- Windows service / firewall manipulation,
- or driver installation and cleanup.
5. User-mode evasion path
- The user-mode path is built around inspecting loaded modules from the process PEB, comparing memory-backed DLLs to on-disk DLLs, and identifying tampering/hooking.
- The implementation has multiple ways to obtain a clean NtProtectVirtualMemory-equivalent path:
- standard unhooking,
- custom trampoline,
- reusing an EDR trampoline,
- loading a duplicate DLL,
- or direct syscalls.
- This subsystem’s boundary is entirely in-process user memory, but it often exists to prepare for later operations that need reliable system calls.
6. Kernel-mode bypass path
- Kernel-mode operations depend on a vulnerable signed driver to provide arbitrary kernel read/write capability.
- With that primitive, the tool can manipulate kernel structures to:
- remove process/thread/image notify routines,
- unlink minifilter callbacks,
- disable the ETW Threat Intelligence provider,
- change process protection state for LSASS access.
- The kernel path is sensitive to Windows build differences, so it relies on version-specific offsets rather than runtime pattern guessing.
7. Driver abstraction boundary
- Driver support is intentionally isolated behind a small primitive interface:
- read kernel memory,
- write kernel memory,
- close driver handle.
- KernelMemoryPrimitives.h selects the concrete backend at compile time (GDRV, RTCore64, or DBUtil_2_3 in the current tree).
- The architecture treats the driver as a thin transport layer; all higher-level bypass logic is driver-agnostic once the primitive is available.
8. LSASS protection bypass features
- RunAsPPL bypass uses kernel writes to raise the current process protection level so it can access protected LSASS memory.
- CredGuard bypass patches wdigest.dll-related state so cleartext credentials can be cached again in LSASS for new logons.
- These two features are separate from EDR-bypass mechanisms, but they share the same kernel-memory and offsets infrastructure.
9. Offsets and versioning subsystem
- A major architectural dependency is the Offsets/ data set and the code that consumes it.
- CSV files store build-specific offsets for:
- ntoskrnl.exe,
- fltmgr.sys,
- wdigest.dll,
- ci.dll.
- ExtractOffsets.py can generate/update these files using PDB metadata from Microsoft symbol servers or Winbindex sources.
- At runtime, the C code uses these offsets to safely find internal kernel fields without guessing.
10. Process and binary parsing utilities
- The Utils/ layer contains the repo’s “plumbing”:
- PE parsing and relocation handling,
- PDB/symbol parsing,
- string/list helpers,
- file version inspection,
- remote PEB browsing,
- syscall number discovery,
- Windows service management,
- firewall rules,
- HTTP client support.
- These utilities support both detection logic and the reconstruction of clean code paths or memory structures.
11. Audit and detection logic
- The audit mode is architecturally important because it is both a reconnaissance mode and a validation mode for the tool itself.
- It enumerates:
- user-mode hook modifications,
- kernel callbacks,
- and EDR-related drivers/processes.
- Detection uses naming heuristics, signer information, and known security-driver catalogs, which then feed later bypass stages.
12. External dependencies and operational inputs
- The repository assumes the presence of:
- a vulnerable signed driver file,
- correct offsets CSVs,
- and optionally internet access for symbol retrieval.
- External sources that materially shape the workflow include Microsoft Symbol Server, Winbindex, and LOLDrivers-style driver samples.
- The runtime behavior therefore depends heavily on offline artifacts prepared ahead of execution.
13. Language and platform boundaries
- Core implementation is native C/C++, with a small assembly component for syscall stubs.
- The offset extractor is Python-based and only prepares data; it is not part of the runtime attack path.
- The entire repo is Windows-specific and centered on kernel structures, PEB/PE parsing, and Windows driver/service APIs.
14. How to draw the architecture
- A good diagram would show:
- CLI binaries at the top,
- feeding a shared static library / core API,
- which branches into user-mode evasion, kernel-mode evasion, and LSASS protection bypass,
- all of which depend on offset CSVs and, for kernel features, a vulnerable driver transport,
- with a side pipeline for Python offset extraction and symbol downloads.
- The key trust boundary is between user mode and kernel mode; almost every advanced feature crosses it via the vulnerable driver primitive.
Main entry points: EDRSandblast_API.c Core API · UserlandBypass Userland bypass · KernellandBypass Kernel bypass · Offsets Offsets
Components 20
Front ends
CLI binaries and shared API entrypoints
- CLI · Primary command-line entrypoint
EDRSandblast_CLI/EDRSandblast.c - LSASS dump · Specialized launcher for protected process dumping
EDRSandblast_LsassDump/EDRSandblast_LsassDump.c - Core API · Shared dispatcher used by all front ends
EDRSandblast_StaticLibrary/EDRSandblast_API.c
Core engine
Reusable native implementation and major bypass subsystems
- Common layer · Reusable utilities and shared primitives
EDRSandblast/Utils - Userland bypass · Hook discovery, unhooking, and direct syscall paths
EDRSandblast/UserlandBypass - Kernel bypass · Kernel callback removal and ETW TI neutralization
EDRSandblast/KernellandBypass - LSASS bypass · RunAsPPL and Credential Guard-related logic
EDRSandblast/LSASSProtectionBypass - Driver ops · Vulnerable-driver abstraction for kernel read/write
EDRSandblast/Utils/DriverOps.c - Kernel RW · Arbitrary kernel memory read/write and handle cleanup
EDRSandblast/Includes/KernelMemoryPrimitives.h - PEB / PE · Process, module, and binary inspection helpers
EDRSandblast/Utils/PEBBrowse.c - Syscalls · Direct syscall resolution and stubs
EDRSandblast/Utils/SW2_Syscalls.c - Process dump · LSASS and process dumping helpers
EDRSandblast/Utils/ProcessDump.c - Firewall ops · Firewall and service manipulation helpers
EDRSandblast/Utils/FirewallOps.cpp - EDR checks · Heuristics for identifying EDR-related processes and drivers
EDRSandblast/Utils/IsEDRChecks.c
Offsets pipeline
Version-specific data and extraction tooling
- Offsets · Build-specific kernel and DLL offsets consumed at runtime
Offsets - Extractor · Generates offsets from symbols and Winbindex sources
Offsets/ExtractOffsets.py - Symbol parse · PDB and symbol parsing used to derive offsets
EDRSandblast/Includes/PdbParser.h
External inputs
Required runtime artifacts and trust-boundary dependencies
- Vulnerable driver · Signed driver used to obtain kernel primitive
- Symbol sources · Microsoft Symbol Server and Winbindex inputs
- Windows kernel · Native Windows user-mode and kernel-mode environment
Connections 27
- CLI → Core API: calls · Primary CLI dispatch
- LSASS dump → Core API: calls · Specialized launcher dispatch
- Core API → EDR checks: audit · Reconnaissance and validation mode
- Core API → Userland bypass: mode · User-mode evasion paths
- Core API → Kernel bypass: mode · Kernel-mode bypass paths
- Core API → LSASS bypass: mode · Protected-process access features
- Core API → Firewall ops: mode · Firewall or service manipulation actions
- Userland bypass → PEB / PE: inspect · Locate loaded modules and compare memory-backed DLLs
- Userland bypass → Syscalls: fallback · Direct syscall paths when hooks are present
- Userland bypass → Process dump: prepare · Reliable process access for dumping operations
- Kernel bypass → Driver ops: uses · All kernel actions go through driver transport
- Driver ops → Kernel RW: provides · Read/write primitive and handle management
- Kernel bypass → Offsets: depends · Build-specific fields and structure locations
- LSASS bypass → Kernel RW: writes · Adjusts protection or cached-credential state
- LSASS bypass → Offsets: depends · Uses version-specific LSASS and DLL offsets
- Offsets → Extractor: generated by · Offsets are produced by the Python pipeline
- Extractor → Symbol sources: queries · Retrieves symbols and metadata from external sources
- Extractor → Symbol parse: parses · Derives offsets from PDB metadata
- Offsets → Kernel bypass: feeds · Runtime lookup data for kernel bypasses
- Offsets → LSASS bypass: feeds · Runtime lookup data for protection bypasses
- Kernel RW → Vulnerable driver: requires · Kernel primitive depends on a vulnerable signed driver
- Core API → Windows kernel: targets · Native Windows execution boundary
- Kernel bypass → Windows kernel: crosses · User to kernel trust boundary
- Userland bypass → Windows kernel: runs on · In-process user-mode operations
- Common layer → PEB / PE: contains · Core utility layer includes binary and process parsing
- Common layer → Symbol parse: contains · Shared symbol and metadata parsing utilities
- Common layer → Process dump: contains · Shared memory and dump helpers