
Windows 10/11용 Zydis 기반 동적 패턴 검색을 지원하는 커널 모드 시스템 콜 래퍼
Windows 10/11 호환성을 위한 Zydis 기반 동적 패턴 검색 기능을 갖춘 btbd/access의 업데이트된 포크
핸들을 요구하지 않고 권한 있는 프로세스 작업을 가능하게 하는 커널 모드 syscall 래퍼입니다. 커널-유저모드 통신을 위해 xKdEnumerateDebuggingDevices 포인터 후킹을 사용합니다.
PROCESS_ALL_ACCESS 작업 수행.data 섹션 후킹이 포크는 원본 드라이버를 다음과 같이 현대화합니다:
[singular-access] 접두사가 포함된 정보성 디버그 출력드라이버는 Zydis를 사용하여 커널 함수를 디스어셈블하고 다음을 추출합니다:
User Mode (DLL)
↓ syscall with SYSCALL_UNIQUE
Kernel Hook (xKdEnumerateDebuggingDevices pointer)
↓ validates & dispatches
Kernel Syscall Handler
↓ performs privileged operation
Return to User Mode
cd Driver
msbuild Driver.vcxproj /p:Configuration=Release /p:Platform=x64
link_driver.bat
출력: Driver\x64\Release\Driver.sys
옵션 1: kdmapper(테스트에 권장)
kdmapper.exe Driver.sys
옵션 2: 서비스
sc create singular_access type= kernel binPath= C:\path\to\Driver.sys
sc start singular_access
[singular-access] Initializing driver...
[singular-access] Windows build: 26200
[singular-access] ntoskrnl.exe base: FFFFF80000000000
[singular-access] [*] Searching for PsResumeThread in PsRegisterPicoProvider...
[singular-access] [+] Found PsResumeThread at FFFFF803AAE331C0
[singular-access] [*] Searching for PsSuspendThread in PsRegisterPicoProvider...
[singular-access] [+] Found PsSuspendThread at FFFFF803AADFA1A0
[singular-access] [+] Found PreviousMode offset: 0x232
[singular-access] Searching for xKdEnumerateDebuggingDevices pointer...
[singular-access] xKdEnumerateDebuggingDevices pointer: FFFFF803AB200B68
[singular-access] Installing hook...
[singular-access] Driver initialized successfully
드라이버는 다음을 가로채서 처리합니다:
프로세스 작업
NtOpenProcessNtSuspendProcess / NtResumeProcessNtQueryInformationProcess / NtSetInformationProcessNtQuerySystemInformationExNtFlushInstructionCache메모리 작업
NtAllocateVirtualMemory / NtFreeVirtualMemoryNtReadVirtualMemory / NtWriteVirtualMemoryNtProtectVirtualMemoryNtQueryVirtualMemoryNtLockVirtualMemory / NtUnlockVirtualMemoryNtFlushVirtualMemory스레드 작업
NtOpenThreadNtSuspendThread / NtResumeThreadNtGetContextThread / NtSetContextThreadNtQueryInformationThread / NtSetInformationThread동기화
NtWaitForSingleObject테스트 및 동작 확인 완료:
PsResumeThread 찾기:
lea rcx, PsResumeThread ; Load function address
mov [rdx+40h], rcx ; Store in PICO provider table
xKdEnumerateDebuggingDevices 찾기(Win11 24H2):
mov rax, cs:off_140E00B68 ; Pattern: 48 8B 05 ? ? ? ? 74 ? E8
; Resolve RIP-relative pointer
PreviousMode 오프셋 추출:
mov rax, gs:188h ; Get KTHREAD
movzx eax, byte ptr [rax+232h] ; Extract PreviousMode
ret
Driver/
├── main.c # Entry point, initialization, hook installation
├── core.c # Syscall handlers
├── util.c # Pattern scanning, memory utilities
├── zydis_util.c # Zydis-based pattern finders
├── zydis_util.h # Zydis function declarations
├── syscall.h # Syscall definitions
├── stdafx.h # Precompiled header
└── Zydis/ # Zydis disassembler library
드라이버 로드 실패:
bcdedit /set testsigning on패턴 미발견:
링커 오류:
ZYDIS_STATIC_BUILD 및 ZYCORE_STATIC_BUILD가 정의되어 있는지 확인link_driver.bat이 올바른 WDK 라이브러리 경로를 사용하는지 확인syscall.h에 syscall 열거형 추가core.c에 HANDLE_SYSCALL 매크로를 사용하여 핸들러 추가xKdEnumerateDebuggingDevices 포인터 패턴 찾기main.c의 find_kd_enum_debug_devices_ptr()에 패턴 추가이 프로젝트는 원본 btbd/access 저장소와 동일한 라이선스를 유지합니다.
이 소프트웨어는 교육 및 연구 목적으로만 제공됩니다. 책임감 있게 사용하고, 소유한 시스템이나 명시적 테스트 허가를 받은 시스템에서만 사용하세요.
| 대상 | 방법 | 오프셋/주소 |
|---|
| KTHREAD.PreviousMode | ExGetPreviousMode 디스어셈블 | 0x232(모든 버전) |
| PsResumeThread | PsRegisterPicoProvider 디스어셈블 | +0x40의 RIP-상대 LEA |
| PsSuspendThread | PsRegisterPicoProvider 디스어셈블 | +0x50의 RIP-상대 LEA |
| xKdEnumerateDebuggingDevices | .text 섹션 패턴 스캔 | 버전별 패턴 |
| OS 버전 | 빌드 | 상태 |
|---|
| Windows 10 1607 | 14393 | ✅ |
| Windows 10 1709 | 16299 | ✅ |
| Windows 10 1809 | 17763 | ✅ |
| Windows 10 2004 | 19041 | ✅ |
| Windows 11 21H2 | 22000 | ✅ |
| Windows 11 22H2 | 22621 | ✅ |
| Windows 11 24H2 | 26100-26200 | ✅ |