Enum and Remove Hook in Windows Kernel
设计目标:
- 别的ARK工具没有的,或者很少有的,或者不开源的。
- 自己喜欢的,常用的,避免自己繁琐的windbg操作。
- procexp.exe和processhacker及SystemInformer.exe有的,这里一律不添加。
- 应用层能实现的一般不添加,除非我喜欢,或者特别的嘎咕奇特。
- 不支持32位。
- 不支持GUI。
- 多使用符号文件,尽量减少硬编码。
已经实现的功能:
- 枚举和移除进程回调。
PsSetCreateProcessNotifyRoutine + PsSetCreateProcessNotifyRoutineEx + PsSetCreateProcessNotifyRoutineEx2 - 枚举和移除线程回调。
PsSetCreateThreadNotifyRoutine + PsSetCreateThreadNotifyRoutineEx + PsRemoveCreateThreadNotifyRoutine - 枚举和移除IMAGE回调。
PsSetLoadImageNotifyRoutine + PsSetLoadImageNotifyRoutineEx + PsRemoveLoadImageNotifyRoutine
暂时不支持:SeRegisterImageVerificationCallback + SeUnregisterImageVerificationCallback - 枚举和移除注册表回调。
CmRegisterCallback + CmRegisterCallbackEx + CmUnRegisterCallback - 枚举和移除对象(进程,线程,桌面)回调。
ObRegisterCallbacks + ObUnRegisterCallbacks - 枚举和移除MiniFilter。
FltRegisterFilter + FltUnregisterFilter(有待测试) - 枚举WFP。
FwpsCalloutRegister + FwpsCalloutUnregisterById(有待测试) - 枚举网络协议驱动。
NdisRegisterProtocolDriver + NdisRegisterProtocol - 枚举网络过滤驱动。
特指通过NdisFRegisterFilterDriver注册的。 - 枚举小端口网卡驱动。注意:不是网卡个数。
NdisMRegisterMiniportDriver - 枚举和删除DPC定时器。有待完善。
以Zw/Nt开头的定时器也属于这个。
KeCancelTimer。 - 枚举和停止IO定时器。
IoInitializeTimer + IoStopTimer - 枚举EX定时器。有待分析。
ExAllocateTimer - 枚举SSDT
- 枚举SSSDT
- 枚举GDT
- 枚举IDT
- 枚举过滤设备。如:TDI,NPFS,MSFS,NSI等。
之所以说是设备而不是驱动,是因为
其一:IoAttachDevice(ByPointer) + IoAttachDeviceToDeviceStack(Safe)
其二:TDI的设备名不变,但是它所在的驱动在变。
其三:常规流程下,驱动的派遣函数只有基于设备的IRP才会被调用。 - 枚举和移除关机回调。
注册包括:IoRegisterShutdownNotification,IoRegisterLastChanceShutdownNotification,
反注册用:IoUnregisterShutdownNotification(Shutdown + LastChanceShutdown)。 - 枚举和移除蓝屏回调。
注册支持:KeRegisterBugCheckCallback, KeRegisterBugCheckReasonCallback。
反注册支持:KeDeregisterBugCheckCallback,KeDeregisterBugCheckReasonCallback - 枚举类型对象。
即:对象目录\ObjectTypes下的成员及信息。
驱动可创建,也可修改(系统有保护)。 - 枚举驱动对象。主要显示一些函数信息。
- 枚举和反注册Ex回调。ExRegisterCallback + ExUnregisterCallback。(对象目录:\Callback)
- 枚举和反注册会话回调(IoRegisterContainerNotification,非SeRegisterLogonSessionTerminatedRoutine/Ex.)
- Dump HalDispatchTable
- 枚举已经卸载的驱动
- 给进程赋予System的Token权限,相当于NT AUTHORITY\SYSTEM。
有待验证是否会触发系统的保护机制(PG/KPP). - 设置进程的ProcessProtectionLevel。
有待验证是否会触发系统的保护机制(PG/KPP). - 修改进程的句柄的权限。
如:0x1fffff,这个可以和ObRegisterCallbacks对抗,逃避监控。
验证:先切换到目标进程(.process /r /p 0xXXXXXX),然后运行!handle 0xxx。
危险:谨慎使用,弄不好会卡系统。
有待验证是否会触发系统的保护机制(PG/KPP). - 待补。
考虑添加的功能:
- 工作线程. 尽管生命周期很短。
- 反汇编引擎,如:zydis。
- 硬件虚拟化相关的。
- 读写内核内存。
- 本地内核调试。
- EtwRegister EtwUnregister
- IoRegisterPlugPlayNotification
- KseRegisterShim KseRegisterShimEx KseUnregisterShim
- PcwRegister PcwUnregister
- NmrpRegisterModule == NmrRegisterClient + NmrRegisterProvider + WskRegister。
- PsRegisterSiloMonitor
- PsRegisterPicoProvider
- 系统热键
确定不添加的功能:
- 进程
- 文件
- 注册表
- MBR 已经过时了。
- 端口 因为有netstat和tcpview.exe。
- LSP
- 系统线程 因为有procexp.exe。
- 句柄 因为有procexp.exe。
- 启动项 因为有Autoruns.exe。
2024-01-13