显然,这一堆的Procedure中,只有DeleteProcedure和SecurityProcedure为非零值,显然系统不会在内核去call 0x00000000。难道系统对于这些Procedure还有特殊的处理方式? 到这里,似乎得去翻WRK源码查找这些成员的所有引用了。但这似乎工作量不小,在这我们采取比较偷懒的方式:下断点。这里只选取了两个:OpenProcedure和SecurityProcedure。它们一个为NULL一个为非NULL指,并且从命名上来看一个是在打开对象时执行的,一个是在安全检查时执行的。 0: kd> ba r4 0x8af7cd30 0: kd> ba r4 0x8af7cd40
3: kd> bl 0 e 8af7cd30 r 4 0001 (0001) 1 e 8af7cd40 r 4 0001 (0001)似乎系统在登录后会调用NtOpenProcess()遍历一遍进程,随后我们静静地等待断点命中…… 很快: Breakpoint 1 hit nt!ObGetObjectSecurity+0x22: 80924f0a 7518 jne nt!ObGetObjectSecurity+0x3c (80924f24)对应的源码: if (ObpCentralizedSecurity(ObjectType)) {
// // Declare a global table of object types. //看起来没啥意思,只是做了一下检查就返回成功了。 本来想直接GO掉继续等待,但是接着往下看代码会发现:
// // The security method will return an absolute format // security descriptor that just happens to be in a self // contained buffer (not to be confused with a self-relative // security descriptor). //
// // Leave the object type mutex when call the OpenProcedure. If an exception // while OpenProcedure the HoldObjectTypeMutex disable leaving the mutex // on finally block //