|
[求助]r3下如何防止WriteProcessMemory对软件写入
我以前是在R0下做的,HOOK的ntoskrnl.exe/ntkrnlpa.exe中的:nt!NtWriteVirtualMemory,防止非法进程通过WriteProcessMemory来写受保护的进程。 如果R3的话,可以考虑: 全局HOOK ntdll.dll中的: ntdll!NtWriteVirtualMemory实现类似的功能。 |
|
[原创]Windows内存放血篇,突破物理内存的CopyOnWrite
FaEry 可以试试手动map虚拟内存对应的物理内存,不使用api[em_19]别见笑!这对于才接触windows内存管理这块的我而言太深奥了!个人感觉位于大页中的处理是个难点,目前知识不够,我后续抽空把相关知识串起了再尝试! |
|
|
|
[原创]Windows内存放血篇,突破物理内存的CopyOnWrite
pte->Write=1 // UP version,突破COW,理论上大小页都有用
最后于 2021-2-8 10:25
被低调putchar编辑
,原因:
|
|
[求助]Win10 PTE Base 无效,该如何处理?
!vtop 这个命令超好用。可以把VA直接转换为PA PFN Specifies the page frame number (PFN) of the directory base for the process
最后于 2021-2-8 10:13
被低调putchar编辑
,原因:
|
|
[求助]Win10 PTE Base 无效,该如何处理?
不对 感谢回复,但是可能你误会我提问了,我一开始认为PTE_BASE既然是PTE_BASE了,它就应该有效,不过经过后续的搜索和实验,发现它只是一个计算变量,至于它这个数值指向的地址有没有效,那就要看它在C ... 还好!刚接触这块!感兴趣,所以学习下!
最后于 2021-2-5 22:27
被低调putchar编辑
,原因:
|
|
[原创]Win10 DiSPATCH_LEVEL下读取物理内存
hhkqqs 代码有漏洞,在配置高容量内存条的机子上,MmAllocateContinguousMemory申请的页可能处于2M大分页或1G大分页中,此时的PTE要么清零要么根本不存在,楼上说的概率蓝屏应该指的就是 ... 的确!有处于大分页中的页PTE清0的情况。
最后于 2021-2-5 13:06
被低调putchar编辑
,原因:
|
|
[原创]Win10 DiSPATCH_LEVEL下读取物理内存
hhkqqs 代码有漏洞,在配置高容量内存条的机子上,MmAllocateContinguousMemory申请的页可能处于2M大分页或1G大分页中,此时的PTE要么清零要么根本不存在,楼上说的概率蓝屏应该指的就是 ... 是否可以这样理解:
最后于 2021-2-5 18:13
被低调putchar编辑
,原因:
|
|
[求助]Win10 PTE Base 无效,该如何处理?
我再练习另外一个1709的WIN10系统.加深印象: 1: kd> uf nt!MmGetVirtualForPhysical nt!MmGetVirtualForPhysical: fffff803`be81be60 488bc1 mov rax,rcx fffff803`be81be63 48c1e80c shr rax,0Ch fffff803`be81be67 488d1440 lea rdx,[rax+rax*2] fffff803`be81be6b 4803d2 add rdx,rdx fffff803`be81be6e 48b8080000008097ffff mov rax,0FFFF978000000008h fffff803`be81be78 488b04d0 mov rax,qword ptr [rax+rdx*8] fffff803`be81be7c 48c1e019 shl rax,19h fffff803`be81be80 48ba0000000000edffff mov rdx,0FFFFED0000000000h ;PTE_BASE fffff803`be81be8a 48c1e219 shl rdx,19h fffff803`be81be8e 81e1ff0f0000 and ecx,0FFFh fffff803`be81be94 482bc2 sub rax,rdx fffff803`be81be97 48c1f810 sar rax,10h fffff803`be81be9b 4803c1 add rax,rcx fffff803`be81be9e c3 ret PTE_BASE所在的VA处无效: 1: kd> db FFFFED0000000000 ffffed00`00000000 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000010 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000020 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000030 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000040 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000050 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000060 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000070 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? 观察PTE_BASE(第1个PTE)信息: 描述的是NULL地址处的PTE,PDE,PPE, PXE信息 1: kd> !pte FFFFED0000000000 VA 0000000000000000 PXE at FFFFED76BB5DA000 PPE at FFFFED76BB400000 PDE at FFFFED7680000000 PTE at FFFFED0000000000 contains 0A0000000E974867 contains 0000000000000000 pfn e974 ---DA--UWEV contains 0000000000000000 not valid PTE=(((VA&0x0000FFFFFFFFFFFF)>>12)<<3)+PTE_BASE 当VA=0时: PTE=(((0&0x0000FFFFFFFFFFFF)>>12)<<3)+PTE_BASE =PTE_BASE 所以VA为NULL处的1页的PTE(就是PTE_BASE的第1项,也就是PTE_BASE)是无效的。 1: kd> db FFFFED0000000000 ffffed00`00000000 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000010 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000020 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000030 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000040 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000050 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000060 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed00`00000070 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? (1)描述PTE_BASE的PTE(PDE_BASE) PTE_BASE为FFFFED0000000000 PDE_BASE=(((PTE_BASE&0x0000FFFFFFFFFFFF)>>12)<<3)+PTE_BASE =(((FFFFED0000000000&0x0000FFFFFFFFFFFF)>>12)<<3)+0xFFFFED0000000000 =0xFFFFED7680000000 PDE_BASE是无效的: 1: kd> db FFFFED7680000000 ffffed76`80000000 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000010 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000020 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000030 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000040 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000050 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000060 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000070 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? (2)描述PDE_BASE的PTE(PPE_BASE) PPE_BASE=(((PDE_BASE&0x0000FFFFFFFFFFFF)>>12)<<3)+PTE_BASE =(((FFFFED7680000000&0x0000FFFFFFFFFFFF)>>12)<<3)+0xFFFFED0000000000 =0xFFFFED76BB400000 观察PPE_BASE: 1: kd> db FFFFED76BB400000 ffffed76`bb400000 00 00 00 00 00 00 00 00-67 58 27 65 00 00 00 0a ........gX'e.... ffffed76`bb400010 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400040 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400050 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400060 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 描述PDE_BASE的PTE(PPE_BASE)所在的内存是可读取的,其内容为: *PPE_BASE=0x0000000000000000 通过用PPE_BASE及PDE_BASE计算得到到的PDE_BASE物理地址: =(0x0000000000000000&0x0000FFFFFFFFF000)+(FFFFED7680000000&0000000000000FFF) =0 观察通过PPE_BASE及PDE_BASE计算到的PDE_BASE物理地址内容(验证PPE_BASE描述有效性): 1: kd> !db 0 # 0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # 10 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # 20 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # 30 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # 40 07 00 00 c0 00 00 00 00-00 00 00 00 00 00 00 00 ................ # 50 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # 60 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # 70 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 与 PDE_BASE本身所在VA处 1: kd> db FFFFED7680000000 ;PDE_BASE VA ffffed76`80000000 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000010 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000020 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000030 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000040 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000050 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000060 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? ffffed76`80000070 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ???????????????? 并不吻合,说明: PPE_BASE(描述PDE_BASE的PTE)所描述的PTE信息实际上是不正确的,只是PPE_BASE所在内存本身可读而已, 从前面也可以看出: PDE_BASE本身所在的页是无效的。 (3)描述PPE_BASE的PTE(PXE_BASE) PXE_BASE=(((PPE_BASE&0x0000FFFFFFFFFFFF)>>12)<<3)+PTE_BASE =(((FFFFED76BB400000&0x0000FFFFFFFFFFFF)>>12)<<3)+0xFFFFED0000000000 =0xFFFFED76BB5DA000 观察PXE_BASE 1: kd> db FFFFED76BB5DA000 ffffed76`bb5da000 67 48 97 0e 00 00 00 0a-00 00 00 00 00 00 00 00 gH.............. ffffed76`bb5da010 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb5da020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb5da030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb5da040 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb5da050 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb5da060 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb5da070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ PXE_BASE所在的内存是可读的,其内容为: *PXE_BASE=0x0a0000000e974867 采用PXE_BASE及PPE_BASE计算到的PPE_BASE的物理地址为: PHY_ADDR=((*PXE_BASE)&0x0000FFFFFFFFF000)+(PPE_BASE&0x0000000000000FFF) =(0x0a0000000e974867&0x0000FFFFFFFFF000)+(0xFFFFED76BB400000&0x0000000000000FFF) =0x00000e974000 观察通过PXE_BASE及PPE_BASE计算到的PPE_BASE物理地址内容(验证PXE_BASE描述有效性): 1: kd> !db 00000e974000 # e974000 00 00 00 00 00 00 00 00-67 58 27 65 00 00 00 0a ........gX'e.... # e974010 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # e974020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # e974030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # e974040 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # e974050 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # e974060 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ # e974070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 与 1: kd> db FFFFED76BB400000 ;PPE_BASE VA ffffed76`bb400000 00 00 00 00 00 00 00 00-67 58 27 65 00 00 00 0a ........gX'e.... ffffed76`bb400010 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400040 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400050 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400060 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ffffed76`bb400070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 相吻合 PXE_BASE(描述PPE_BASE的PTE)所描述的PTE信息是有效的,描述的就是PPE_BASE,从前面也可以看出: PPE_BASE本身所在的内存页也是可读的。 (4)综上所述: 系统启动后, 对于VA为NULL的1页对应的PTE(PTE_BASE的第1项==PTE_BASE)是无效的 PXE_BASE(描述PPE_BASE的PTE)->PPE_BASE(描述PDE_BASE的PTE)->PDE_BASE(描述PTE_BASE的PTE)->PTE_BASE(页表基址) PDE_BASE,PPE_BASE,PXE_BASE本质上都是PTE 如果PTE描述的目标内存页无效,则原PTE就无效,要么是PTE本身就不可读取, 要么是PTE本身可读取但描述信息不正确。 太麻烦了,假如再多几级页表,脑袋都要搅晕了。 感谢楼主的提问!让我自学到了一些有关页表方面的知识!获益匪浅!
最后于 2021-2-4 12:35
被低调putchar编辑
,原因:
|
|
[求助]Win10 PTE Base 无效,该如何处理?
(1)如果VA=0, =(((0&0x0000FFFFFFFFFFFF)>>12)<<3)+PTE_BASE =PTE_BASE 即: 系统启动后,对于首地址VA==NULL的这1页:PTE==PTE_BASE
最后于 2021-2-3 23:01
被低调putchar编辑
,原因:
|
|
[求助]Win10 PTE Base 无效,该如何处理?
nt!MmGetVirtualForPhysical: 大致了解下,.64位(页表级: 9-9-9-9-12): PTE=(((VA&0x0000FFFFFFFFFFFF)>>12)<<3)+PTE_BASE 即: 系统启动后,对于首地址VA==NULL的这1页:PTE==PTE_BASE 对应的PTE是无效的,NULL地址处的1页大小内存很显然不是有效的。
最后于 2021-2-5 12:49
被低调putchar编辑
,原因:
|
|
[求助]Win10 PTE Base 无效,该如何处理?
1.通过实际调试动手观察: 系统启动阶段发现PTE_BASE有效, PTE,PDE,PPE,PXE也有效: 2.系统启动后, 再次break断下,发现了楼主所说的情况: PTE_BASE无效,PTE无效, 而PDE,PPE,PXE有效: 3. 顺便分析了下MmGetVirtualForPhysical的实现中: 物理地址到虚拟地址的换算: PVOID NTAPI MmGetVirtualForPhysical( IN PHYSICAL_ADDRESS PhysicalAddress ) { PVOID *UnknownBase=0xFFFF958000000008, /*PTEBase=0xFFFFF40000000000,*/ VirtualAddress; VirtualAddress= (PVOID)(((LONGLONG)(((ULONG_PTR)UnknownBase[((ULONGLONG)PhysicalAddress.QuadPart>>0xc)*6]<<0x19)-((ULONG_PTR)PTE_BASE<<0x19)))>>0x10)+(PhysicalAddress.QuadPart&0x0fff)); //改一处,WIN10上发现PTE_BASE随每次系统的启动是随机化的,这个随机化的常量计为PTE_BASE return VirtualAddress; } 以后有空学习研究了这一块的相关知识再回过头来理解是怎么回事。
最后于 2021-2-3 15:19
被低调putchar编辑
,原因: PTE_BASE随机化
|
|
|
|
[求助]lea与mov汇编命令的用法
应该是: lea eax,[ebp+8] 与 mov eax,[ebp + 8] lea eax,[eax] 不同吧!没有: mov reg, reg+imm这个写法。 前者是让eax保存ebp+8,后者是让eax,保存ebp+8所指向地址处的4字节值 |
|
|
|
[求助]incaseformat样本爆发时间的问题
原始样本确实是在2009年以后,月份大于3的1,10,21,29号执行C:盘以外的文件删除。 查了下,有人修改并发布了变种的incaseformat,对Delphi自带的DateTimeToTimeStamp库函数的运行做了手脚,导致执行函数DecodeDate时,与当前的系统时间不一致。我们分析的都是原始样本。
最后于 2021-1-26 23:39
被低调putchar编辑
,原因:
|
|
[求助]infinityhook驱动启动不成功
懒的时间 ZwTraceControl改为NtTraceControl驱动就可以加载 但是蓝屏请自己分配Properties->ProviderName.Buffer缓冲区!WIN7上必须保证该缓冲区是可写的。 而且WmiLoggerContex->GetCpuClock,kThread->SystemCallNumber的偏移量与WIN10也有所不同. libinfinityhook拿到WIN7上不能直接用。需要调试分析后自己改。 |
|
[求助]infinityhook驱动启动不成功
请自己分配Properties->ProviderName.Buffer缓冲区!WIN7上必须保证该缓冲区是可写的。 而且WmiLoggerContex->GetCpuClock,kThread->SystemCallNumber的偏移量与WIN10也有所不同. libinfinityhook拿到WIN7上不能直接用。需要调试分析后自己改。 |