|
[原创]Win8 32位中SSDT Shadow Hook的实现方法
1.仅仅是判断方法不同就是全新方法? 这个说法你看大家认不认账? 2.请正面回答我提出的那几个问题,什么“自行查看wrk就可以了”这种话谁不会讲? |
|
[原创]Win8 32位中SSDT Shadow Hook的实现方法
两个问题:1.楼主的方法就是从KTHREAD中找ServiceTable,难道只是因为你判断GUI线程的依据不太一样,这就成了一种全新的方法? 2.关于win32k.sys访问的事,我给出了自己的解释,别的同学也给出了实际观察结果,楼主敢不敢正面回应这些问题? |
|
[原创]Win8 32位中SSDT Shadow Hook的实现方法
不急不急,你先回答我提出的那些问题 |
|
[原创]Win8 32位中SSDT Shadow Hook的实现方法
win32k.sys与Session有关是铁打的事实,楼主要是真不想承认就算了。。。 有几个问题楼主可以回答一下: 1、谁加载了win32k.sys ? 2、是用什么方式加载的?(或者说调用哪个函数加载的) 加载时,当前进程是谁? 3、win32k.sys刚被加载完的时候(在上面那个关键的调用结束之后),加载者进程(记为进程A)是否可以访问win32k.sys的地址空间?(注意不能只看有没有加载,加载了也不代表你就能访问) 4、csrss.exe是在win32k.sys加载前启动的还是加载后启动的? 5、csrss.exe第一次运行时,在该进程中能否访问win32k.sys的地址空间? 此时A进程是否可以访问win32k.sys的地址空间? 6、winlogon.exe何时被启动? 此时进程A能否访问win32k.sys的地址空间? 7、经最终观察,在系统启动完成后(桌面加载完毕),进程A却无法访问win32k.sys的地址空间,是什么时候造成了这种变化? 楼主观察系统启动的时候,获取那些信息是在什么时候? 这个要非常精确才行,不然按你的分析,我完全都可以认为是System进程加载了win32k.sys呢! |
|
[原创]Win8 32位中SSDT Shadow Hook的实现方法
DebugMan现在没落了,很可惜,所以原帖估计是找不到了,不过楼主可以看看下面这篇文章 http://bbs.pediy.com/showthread.php?t=56955 好好看看第3种方法是什么? 然后再瞪大眼睛看一看这篇文章是什么时间发表的? 我说四年前还是保守了说的。。。 你没看到就等于不存在? 这是什么逻辑? |
|
[注意]GetFileVersionInfoSize的返回值请验证下
lz的担心太多余了,想让某个程序崩掉,到处都可以XX,就像2楼所说的~ |
|
[原创]Win8 32位中SSDT Shadow Hook的实现方法
发现几篇不错的文章,关于Session Space的 http://www.cnblogs.com/kkindof/archive/2012/07/01/2571538.html http://www.cnblogs.com/kkindof/archive/2012/07/01/2571782.html http://www.cnblogs.com/kkindof/archive/2012/07/01/2571799.html http://www.blogbus.com/debug-sai-logs/109178332.html 初始情况下,smss不属于任何session,然后它自己创建了一个Session,然后创建csrss和winlogon继承了该Session,之后加载win32k.sys,最后又调用NtSetSystemInformation从Session中Detach了,而win32k.sys加载的位置是在MmSessionSpace范围内的(32位系统的SessionSpace范围是bc000000到c0000000,这就是为什么win32k.sys的默认基址是bf800000),所以从Session中脱离之后就访问不到SessionSpace范围内的内存了~~ 由于SmpStartCsr是在SmpApiLoop中被调用的,所以从理论上分析,smss继续创建一个新的Session的时候(比如另一个用户登录到系统),依然会重复“创建Session”->"启动csrss、winlogon和加载win32k.sys"->“从Session中脱离”这个动作,只不过win32k.sys也是有加载记数的,后面再加载和卸载的时候只会改变记数(这是MmLoadSystemImage内部处理的),从Session中脱离的时候就会把SessionSpace对应的PTE清零,所以访问不到win32k了~ 以下是xp的smss.exe中的部分代码: int __stdcall SmpStartCsr(int a1, int a2, int a3) { signed int v3; // ebx@1 int v4; // esi@1 int v5; // ecx@1 int v6; // eax@1 int v8; // eax@3 int v9; // edi@3 __int16 *v10; // eax@5 int v11; // eax@7 CHAR *v12; // [sp-Ch] [bp-34h]@4 int v13; // [sp-8h] [bp-30h]@4 char v14; // [sp+8h] [bp-20h]@3 __int16 v15; // [sp+10h] [bp-18h]@1 __int16 v16; // [sp+12h] [bp-16h]@1 int v17; // [sp+14h] [bp-14h]@1 int v18; // [sp+18h] [bp-10h]@12 int v19; // [sp+1Ch] [bp-Ch]@3 int v20; // [sp+20h] [bp-8h]@7 int v21; // [sp+24h] [bp-4h]@7 v4 = a1; v5 = *(_DWORD *)(a1 + 32); v3 = 0; v15 = *(_WORD *)(a1 + 36); v16 = v15; v6 = a1 + 40; a1 = v5; v17 = v6; if ( !v5 ) { *(_DWORD *)(v4 + 300) = SmpWindowsSubSysProcessId; *(_DWORD *)(v4 + 296) = SmpInitialCommandProcessId; return 0; } v19 = 0; //下面这个函数启动csrss等进程和加载win32k.sys [COLOR="Red"]v8 = SmpLoadSubSystemsForMuSession(&a1, (int)&v19, (int)&v14);[/COLOR] v9 = v8; if ( v8 ) { v13 = v8; v12 = "SMSS: SmpStartCsr, SmpLoadSubSystemsForMuSession Failed. Status=%x\n"; } else { v10 = (__int16 *)&v14; if ( v15 ) v10 = &v15; v11 = SmpExecuteInitialCommand(a1, v10, &v21, &v20); v9 = v11; if ( v11 >= 0 ) { NtClose(v21); *(_DWORD *)(v4 + 296) = v20; *(_DWORD *)(v4 + 300) = v19; *(_DWORD *)(v4 + 32) = a1; goto LABEL_11; } v13 = v11; v3 = 1; v12 = "SMSS: SmpStartCsr, SmpExecuteInitialCommand Failed. Status=%x\n"; } DbgPrint(v12, v13); LABEL_11: if ( AttachedSessionId != -1 ) { [COLOR="red"]if ( SmpAcquirePrivilege(10, &v18) >= 0 ) { if ( NtSetSystemInformation(48, &AttachedSessionId, 4) >= 0 ) AttachedSessionId = -1; SmpReleasePrivilege(v18); }[/COLOR] } if ( v3 == 1 ) SmpTerminateCSR(a1); return v9; } |
|
[原创]Win8 32位中SSDT Shadow Hook的实现方法
刚又看了下KiFastCallEntry的代码,证实了我刚才的说法~ 一、系统创建线程时,默认Thread->ServiceTable填充的都是KeServiceDescriptorTable,具体可参考KeInitThread函数 二、在KeFastCallEntry中,系统根本不是在判断这个线程是不是GUI线程,它只是判断这个服务的Index是不是超出了SSDT表的范围而已,因为SSDT Shadow的服务项数比SSDT多,所以如果发现服务的Index超出了SSDT表的范围,就认为这是一个SSDT Shadow的调用,然后调用PsConvertToGuiThread把Thread->ServiceTable切换为KeServiceDescriptorTableShadow,另外就是切换一下内核栈,使线程可以使用更大的内核栈空间,就这两个动作~ 所以,理论上来讲,如果系统创建线程的时候就把Thread->ServiceTable填充为KeServiceDescriptorTableShadow并且使用更大的内核栈,完全不会有问题,因为GUI线程和非GUI线程需要的条件都满足了~ 只不过这样做会消耗更大的内核空间,所以才做了GUI线程和非GUI线程的区分,只给GUI线程以必要的资源,但是对于访问win32k.sys这个,GUI和非GUI并没有不同~~ 所以,你首先确认下win32k.sys的访问问题,到底是除smss和System外的所有进程都可以访问,还是只有GUI进程可以访问,这个不难吧? |
|
[原创]Win8 32位中SSDT Shadow Hook的实现方法
另外你说的系统取服务表的过程,跟GUI不GUI的只不过是巧合而已吧,因为System和smss这两个Session之外的进程根本不会调用Shadow表里的服务,而其它进程的线程才区分这两种情况,但是那都是在Session内的进程~ 另外,我觉得系统完全可以不必要在KTHREAD里区分SSDT和SSDT Shadow,统一换成SSDT Shadow就可以了,反正调用的时候有索引可以判断来使用哪张表~ |
|
[原创]Win8 32位中SSDT Shadow Hook的实现方法
这个我早就验证过了,不然不会随便说这些~ 你确定你切换进程之前不是在System进程里? 要不你切换到csrss看看? 切换到lsass看看? 或者随便哪个你认为没有GUI的看看? 看到底能不能访问? |
|
[原创]Win8 32位中SSDT Shadow Hook的实现方法
从线程KTHREAD里找服务表的方法早就有了啊,只不过大家一般都用别的方法了,这种用得少而已,XP里也是这么干的,真不是什么新方法。。。。至少四年前在DebugMan就看过了 还有win32k.sys访问的问题,与GUI无关,是Session的原因,只要不是smss.exe或System,其它进程都可以访问的 |
|
sfilter的问题
楼主连字符串操作都没玩明白? 知道wcsrchr吗? 你要拦截访问,只要拦截打开操作就可以了,打不开自然就访问不了,Irp不往下发就行了,直接用一个表示失败的status来Complete掉~ |
|
[求助]WIN7系统下运行OD
x64也可以用,加个Stealth64插件就可以了~ |
|
[求助]IATHOOK DLL注入DEBUG成功并出现效果。Realse钩成功但是没出效果。
就算是Release版为了优化事先把API的地址放在了寄存器里,这个API的地址也是从IAT从取到的啊,所以IAT HOOK应该还是能钩住的才对 00401013 . 8B3D AC204000 mov edi,dword ptr ds:[<&USER32.MessageBo>; USER32.MessageBoxA |
|
[原创]启用PAE后虚拟地址到物理地址的转换
非常好的文章~~ |
|
winpe 启动系统后,如何判断操作系统的名称?
加载hiv好慢的,直接判断文件版本就可以了 |
|
[求助]怎么调用EXE/DLL资源运行
http://bbs.pediy.com/showthread.php?t=149749 |
|
[求助]FSCTL_LOCK_VOLUME如何使用
Locks a volume if it is not in use. A locked volume can be accessed only through handles to the file object (*hDevice) that locks the volume. For more information, see the Remarks section. |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值