Isolation philosophy
Everything happens from user-mode. Dr.Semu provides strong isolation guarantees without modifying the Windows kernel.
- Kernel drivers for filesystem filtering
- SSDT hooks for system call interception
- Hypervisor-based isolation
- ProjFS - Native Windows API for filesystem virtualization (introduced in Windows 10 1809)
- Registry APIs - Standard Windows registry functions for hive cloning
- DynamoRIO - User-mode dynamic instrumentation framework
Filesystem isolation
Windows Projected File System
Dr.Semu uses ProjFS to provide a virtual filesystem that appears real to the malware but is completely isolated. How it works (from README.md:13-15):
Windows Projected File System (ProjFS) is used to provide a virtual file system.
Implementation
The virtual filesystem is implemented invirtual_FS_REG/virtualizationInstance.cpp and virtual_FS_REG/fs_provider.cpp.
Key components:
- Virtualization instance - Manages ProjFS session
- Provider callbacks - Handles file enumeration and data requests
- Path translation - Converts virtual paths to host paths
Virtual root structure
Each analysis session gets a unique virtual root:ProjFS callbacks
Dr.Semu implements several ProjFS callbacks:- Directory enumeration
- File access
FindFirstFile or NtQueryDirectoryFile, ProjFS invokes these callbacks to provide directory contents.Path redirection
All filesystem operations are transparently redirected: Real path (malware’s view):Isolation enforcement
Dr.Semu blocks access to its own components to prevent sandbox detection:- Detecting the virtual environment
- Accessing other concurrent VM instances
- Tampering with Dr.Semu’s components
Registry isolation
Registry hive cloning
Registry isolation is achieved by cloning all registry hives to a separate location with a VM-specific prefix (from README.md:15):For Registry redirection, it clones all Registry hives to a new location and redirects all Registry accesses.
Implementation
Registry virtualization is implemented invirtual_FS_REG/virtual_reg.cpp.
Process (simplified):
Enumerate hives
Discover all existing registry hives:
- HKEY_LOCAL_MACHINE
- HKEY_USERS
- HKEY_CURRENT_USER (linked to user SID under HKU)
Virtual registry structure
Original registry path:Path rewriting
The DynamoRIO client intercepts registry system calls and rewrites paths:Supported operations
All registry operations are virtualized:- Read operations:
NtQueryValueKey,NtEnumerateKey,NtQueryKey - Write operations:
NtSetValueKey,NtCreateKey,NtDeleteKey - Transacted operations:
NtCreateKeyTransacted,NtOpenKeyTransacted
Process and object isolation
Process tracking
Dr.Semu maintains a whitelist of allowed processes:Child process injection
When malware creates a child process, Dr.Semu automatically instruments it:- DynamoRIO instrumentation
- Virtual filesystem access
- Registry redirection
- Same VM context
Object namespace isolation
Kernel objects (mutexes, events, semaphores) are not isolated by name. Malware can still:- Create named objects visible system-wide
- Detect other Dr.Semu instances via object names
Network isolation (optional)
Dr.Semu can optionally block internet access:- Logged but not executed
- Return synthetic error codes
- Captured in behavior reports
- Command & control communication
- Credential exfiltration during analysis
- Payload downloads
Network isolation is currently disabled by default. You must modify the source code to enable it.
Isolation limitations
Known issues
From the README.md TODO section:Current limitations:
- Solve isolation related issues
- Process enumeration - Malware can enumerate system processes outside the sandbox
- Window enumeration - Malware can detect real windows and applications
- Hardware fingerprinting - CPU, disk, and memory information reflects the host
- Timing attacks - DynamoRIO overhead may be detectable
- Object namespace - Named objects are not isolated
Anti-analysis detection
Sophisticated malware may detect Dr.Semu through:- Process name checks (looking for “drrun.exe”)
- DynamoRIO artifact detection (code cache, shadow stack)
- Performance degradation from instrumentation
- Absence of real user activity (mouse, keyboard)
Synchronization issues
From LauncherCLI.cpp:398-405:Comparison with other approaches
| Approach | Isolation strength | Performance | Complexity | Limitations |
|---|---|---|---|---|
| Dr.Semu | Strong | Moderate (2-10x overhead) | Low (user-mode only) | Windows 10 1809 only |
| Kernel drivers | Very strong | Low overhead | High (kernel dev) | Requires signed driver |
| Hypervisor | Strongest | High overhead | Very high | Resource intensive |
| Cuckoo Sandbox | Moderate | Low overhead | Moderate | Hooks detectable |
See also
Virtual filesystem
Deep dive into ProjFS implementation
Registry redirection
Registry virtualization internals
Monitoring
System call interception
Limitations
Known limitations and issues