2016-04-01 109 views
1

我試圖通過內核 模式驅動程序讀出另一個進程的內存。它正在工作,我正在將驅動程序注入 另一個驅動程序的空間中,以使其工作(或者可以啓用測試模式)。內核模式Win10驅動藍屏死機,如何捕捉C++?

但是,它運行良好,但是當給出錯誤的地址時,我導致了一個 BSOD。

這裏是一個例子BSOD信息:

SYSTEM_SERVICE_EXCEPTION (3b) 
An exception happened while executing a system service routine. 
Arguments: 
Arg1: 00000000c0000005, Exception code that caused the bugcheck 
Arg2: ffffe000d509c720, Address of the instruction which caused the bugcheck 
Arg3: ffffd00026053db0, Address of the context record for the exception that 
caused the bugcheck 
Arg4: 0000000000000000, zero. 

正如我所噴射的驅動器成其他驅動器,符號等不能 解決。有一些額外的信息:

ADDITIONAL_DEBUG_TEXT: 
You can run '.symfix; .reload' to try to fix the symbol path and load symbols. 

MODULE_NAME: nt 

FAULTING_MODULE: fffff80043604000 nt 

DEBUG_FLR_IMAGE_TIMESTAMP: 56cd4410 

EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced 
memory at 0x%p. The memory could not be %s. 

FAULTING_IP: 
+8c0 
ffffe000`d509c720 8a440aff  mov  al,byte ptr [rdx+rcx-1] 

CONTEXT: ffffd00026053db0 -- (.cxr 0xffffd00026053db0;r) 
rax=00000000df000008 rbx=00000000df000004 rcx=ffffe000d509e004 
rdx=0000200009f62004 rsi=ffffe000d391c2a0 rdi=ffffe000d818f000 
rip=ffffe000d509c720 rsp=ffffd000260547d8 rbp=ffffd00026054b80 
r8=0000000000000004 r9=0000000000000000 r10=ffffe000d69eb8d8 
r11=ffffe000d509e000 r12=00000000c0000900 r13=0000000000000000 
r14=ffffe000d391c1d0 r15=0000000000000000 
iopl=0   nv up ei pl nz na pe nc 
cs=0010 ss=0018 ds=002b es=002b fs=0053 gs=002b    efl=00010202 
ffffe000`d509c720 8a440aff  mov  al,byte ptr [rdx+rcx-1] 
ds:002b:00000000`df000007=?? 
Last set context: 
rax=00000000df000008 rbx=00000000df000004 rcx=ffffe000d509e004 
rdx=0000200009f62004 rsi=ffffe000d391c2a0 rdi=ffffe000d818f000 
rip=ffffe000d509c720 rsp=ffffd000260547d8 rbp=ffffd00026054b80 
r8=0000000000000004 r9=0000000000000000 r10=ffffe000d69eb8d8 
r11=ffffe000d509e000 r12=00000000c0000900 r13=0000000000000000 
r14=ffffe000d391c1d0 r15=0000000000000000 
iopl=0   nv up ei pl nz na pe nc 
cs=0010 ss=0018 ds=002b es=002b fs=0053 gs=002b    efl=00010202 
ffffe000`d509c720 8a440aff  mov  al,byte ptr [rdx+rcx-1] 
ds:002b:00000000`df000007=?? 
Resetting default scope 

DEFAULT_BUCKET_ID: WIN8_DRIVER_FAULT 

BUGCHECK_STR: 0x3B 

CURRENT_IRQL: 0 

ANALYSIS_VERSION: 6.3.9600.17237 (debuggers(dbg).140716-0327) amd64fre 

LAST_CONTROL_TRANSFER: from ffffe000d509c233 to ffffe000d509c720 

STACK_TEXT: 
ffffd000`260547d8 ffffe000`d509c233 : ffffe000`d2b32700 00000000`df000004 
ffffe000`d818f000 fffff800`43a167f5 : 0xffffe000`d509c720 
ffffd000`260547e0 ffffe000`d2b32700 : 00000000`df000004 ffffe000`d818f000 
fffff800`43a167f5 00000000`00000001 : 0xffffe000`d509c233 
ffffd000`260547e8 00000000`df000004 : ffffe000`d818f000 fffff800`43a167f5 
00000000`00000001 df000004`00000000 : 0xffffe000`d2b32700 
ffffd000`260547f0 ffffe000`d818f000 : fffff800`43a167f5 00000000`00000001 
df000004`00000000 ffffe000`d818f000 : 0xdf000004 
ffffd000`260547f8 fffff800`43a167f5 : 00000000`00000001 df000004`00000000 
ffffe000`d818f000 ffffe000`d818f000 : 0xffffe000`d818f000 
ffffd000`26054800 fffff800`43a0eac2 : ffffe000`d2b327e0 ffffd000`26054b80 
00000000`00000001 ffffe000`d65c0080 : nt!ObReferenceObjectByHandle+0x25 
ffffd000`26054850 fffff800`43a0d956 : fffff800`21ef4020 00000000`00000000 
00000000`00000000 00000000`00000000 : nt!NtDeviceIoControlFile+0x11c2 
ffffd000`26054a20 fffff800`43750fa3 : ffffe000`d69eb840 00000000`00000000 
00000000`00000000 00000000`00000000 : nt!NtDeviceIoControlFile+0x56 
ffffd000`26054a90 00000000`587221bc : 00000000`00000000 00000000`00000000 
00000000`00000000 00000000`00000000 : nt!setjmpex+0x3963 
00000000`00bbf0f8 00000000`00000000 : 00000000`00000000 00000000`00000000 
00000000`00000000 00000000`00000000 : 0x587221bc 


FOLLOWUP_IP: 
nt!NtDeviceIoControlFile+11c2 
fffff800`43a0eac2 448be0   mov  r12d,eax 

SYMBOL_STACK_INDEX: 6 

SYMBOL_NAME: nt!NtDeviceIoControlFile+11c2 

FOLLOWUP_NAME: MachineOwner 

IMAGE_NAME: ntkrnlmp.exe 

STACK_COMMAND: .cxr 0xffffd00026053db0 ; kb 

BUCKET_ID: WRONG_SYMBOLS 

FAILURE_BUCKET_ID: WRONG_SYMBOLS 

ANALYSIS_SOURCE: KM 

FAILURE_ID_HASH_STRING: km:wrong_symbols 

FAILURE_ID_HASH: {70b057e8-2462-896f-28e7-ac72d4d365f8} 

我們我在做什麼:我給司機4個值,並有一個全球性的緩衝區 寫讀出值:

焦炭BUF [5000]; NTSTATUS DevioctlDispatch( 結構_DEVICE_OBJECT *設備對象, INOUT結構_IRP *的Irp ) 的一切,我的司機做的是在多個__try __catch/__除/ __ finally塊,我希望我能隨便抓錯了讀 出局...... 我收到進程句柄,然後將它傳遞(ProbeForRead之後) RtlCopyMemory:

__try 
{ 
    KeAttachProcess(myprocess); 
    ProbeForRead((void*)address, len, 1); 
    RtlCopyMemory((void*)buf, (void*)address, len); 
    KeDetachProcess(); 
} 
__except(EXCEPTION_EXECUTE_HANDLER) 
{ 
    DbgPrint("Exception.\n"); 
    status = STATUS_INVALID_PARAMETER; 
    KeDetachProcess(); 
    return status; 
} 

我經常這樣做,但我確信我在取下NY的情況。

我應該使用KeStackAttachProcess嗎? BSOD從哪裏來? 我抓錯誤嗎?謝謝!是的,我正在閱讀用戶空間應用程序。

+0

也許有某種方法來檢查地址是否在用戶空間應用程序中?謝謝! – mutilis

回答

0

由於我還沒有有效的證書,我正在使用vboxdrv中的漏洞來加載我的驅動程序(爲了不在測試系統上)。但我剛發現,它不支持SEH。因此,我的嘗試/除了沒有任何正確的...只需等待我的證書或使用測試模式。