使用如下命令管理驱动
sc create helloworld binPath=helloworld.sys type=kernel start=auto rem start=demand为手动 type=kernel为驱动程序,share为共享服务,own以自身进程运行,filesys为文件系统驱动程序,rec为文件系统识别驱动程序,adapt为适配器驱动程序,interact可以与桌面交互
sc start helloworld
sc stop helloworld
sc delete helloworld
一般病毒没有驱动符号,在IopLoadDriver
下断点
uf nt!IopLoadDriver
之后只需要查找
64位:call qword ptr [rbx+58h]
32位:call dword ptr [edi+2ch]
直接bp地址即可
进程回调PsSetCreateProcessNotifyRoutine
NTSTATUS PsSetCreateProcessNotifyRoutine(
[in] PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine,
[in] BOOLEAN Remove
);
第一个参数代表回调历程,第二个参数为TRUE时移除回调例程,为FALSE安装回调例程。打开浏览器是病毒可以注册进程回调从而修改参数劫持浏览器主页,也可以以此方式摘除杀软进程保护自身。
注册表回调CmRegisterCallback
NTSTATUS CmRegisterCallback(
_In_ PEX_CALLBACK_FUNCTION Function, // RegistryCallback例程指针,就是回调函数的地址
_In_opt_ PVOID Context, // 驱动定义的值,配置管理器传递这个值作为CallbackContext的参数,到RegistryCallback例程
_Out_ PLARGE_INTEGER Cookie // 指向LARGE_INTEGER变量的指针,该变量接收标识回调例程的值。 当您注销回调例程时,将此值作为Cookie参数传递给CmUnRegisterCallback。
);
回调函数的函数签名为
EX_CALLBACK_FUNCTION RegistryCallback;
NTSTATUS RegistryCallback(
_In_ PVOID CallbackContext, // 驱动程序
_In_opt_ PVOID Argument1, // REG_NOTIFY_CLASS类型,标识正在执行的注册表操作类型
_In_opt_ PVOID Argument2 // 取决于Argument1的值,
)
所有的回调函数构成了一个链表,使用CmUnRegisterCallback
摘除回调
关机回调IoRegisterShutdownNotification
NTSTATUS IoRegisterShutdownNotification(
IN PDEVICE_OBJECT DeviceObject
)