feat image load

This commit is contained in:
2026-06-01 09:20:02 +08:00
parent 4bf9a42170
commit 93417ef728
6 changed files with 64 additions and 4 deletions
@@ -147,6 +147,7 @@
<ClCompile Include="io_ctl.cpp" /> <ClCompile Include="io_ctl.cpp" />
<ClCompile Include="kernel_api.cpp" /> <ClCompile Include="kernel_api.cpp" />
<ClCompile Include="kernel_function.cpp" /> <ClCompile Include="kernel_function.cpp" />
<ClCompile Include="load_Image_callback.cpp" />
<ClCompile Include="ob_reg_callback.cpp" /> <ClCompile Include="ob_reg_callback.cpp" />
<ClCompile Include="utils.cpp" /> <ClCompile Include="utils.cpp" />
</ItemGroup> </ItemGroup>
@@ -157,6 +158,7 @@
<ClInclude Include="io_ctl.h" /> <ClInclude Include="io_ctl.h" />
<ClInclude Include="kernel_api.h" /> <ClInclude Include="kernel_api.h" />
<ClInclude Include="kernel_function.h" /> <ClInclude Include="kernel_function.h" />
<ClInclude Include="load_Image_callback.h" />
<ClInclude Include="ob_reg_callback.h" /> <ClInclude Include="ob_reg_callback.h" />
<ClInclude Include="utils.h" /> <ClInclude Include="utils.h" />
</ItemGroup> </ItemGroup>
@@ -61,6 +61,9 @@
<ClCompile Include="create_thread_callback.cpp"> <ClCompile Include="create_thread_callback.cpp">
<Filter>kernel_callback</Filter> <Filter>kernel_callback</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="load_Image_callback.cpp">
<Filter>kernel_callback</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Base.h"> <ClInclude Include="Base.h">
@@ -87,5 +90,8 @@
<ClInclude Include="create_thread_callback.h"> <ClInclude Include="create_thread_callback.h">
<Filter>kernel_callback</Filter> <Filter>kernel_callback</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="load_Image_callback.h">
<Filter>kernel_callback</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>
+10 -4
View File
@@ -7,7 +7,7 @@
namespace thread_notify_routine namespace thread_notify_routine
{ {
//保护的进程ID //保护的进程ID
auto protect_id = ULongToHandle(3460); auto protect_id = ULongToHandle(8976);
void thread_notify_routine(HANDLE ProcessId, HANDLE ThreadId, BOOLEAN Create) void thread_notify_routine(HANDLE ProcessId, HANDLE ThreadId, BOOLEAN Create)
@@ -28,12 +28,18 @@ namespace thread_notify_routine
goto end; goto end;
auto cutor_process_id = PsGetCurrentProcessId(); auto cutor_process_id = PsGetCurrentProcessId();
if (HandleToLong(cutor_process_id) == 4)
goto end;
if (ProcessId != cutor_process_id) if (ProcessId != cutor_process_id)
{ {
DbgPrintEx(77, 0, "[!] 恶意远程线程检测!\n"); DbgPrintEx(77, 0, "[!] 恶意远程线程检测!\n");
DbgPrintEx(77, 0, "[!] 目标进程: %d\n", ProcessId);
DbgPrintEx(77, 0, "[!] 被创建线程: %d\n", ThreadId); DbgPrintEx(77, 0, "[!] 目标进程ID: %d\n", ProcessId);
DbgPrintEx(77, 0, "[!] 创建者进程: %d\n", cutor_process_id);
DbgPrintEx(77, 0, "[!] 创建者进程ID: %d\n", cutor_process_id);
DbgPrintEx(77, 0, "[!] 被创建线程ID: %d\n", ThreadId);
} }
+5
View File
@@ -1,6 +1,7 @@
#include "ob_reg_callback.h" #include "ob_reg_callback.h"
#include "anit_screen_grap.h" #include "anit_screen_grap.h"
#include "create_thread_callback.h" #include "create_thread_callback.h"
#include "load_Image_callback.h"
EXTERN_C NTSTATUS DriverEntry(PDRIVER_OBJECT drv_obj, PUNICODE_STRING) EXTERN_C NTSTATUS DriverEntry(PDRIVER_OBJECT drv_obj, PUNICODE_STRING)
{ {
@@ -8,11 +9,15 @@ EXTERN_C NTSTATUS DriverEntry(PDRIVER_OBJECT drv_obj, PUNICODE_STRING)
{ {
ob_call_back::uninstall_ob_callback(); ob_call_back::uninstall_ob_callback();
thread_notify_routine::unload_thread_routine(); thread_notify_routine::unload_thread_routine();
load_image_notify_routine::remove_image_load_notify_routine();
}; };
kernel_api::kernel_api_init(); kernel_api::kernel_api_init();
thread_notify_routine::create_thread_routine(); thread_notify_routine::create_thread_routine();
ob_call_back::register_ob_reg_callback(); ob_call_back::register_ob_reg_callback();
load_image_notify_routine::create_image_load_notify_routine();
return STATUS_SUCCESS; return STATUS_SUCCESS;
+30
View File
@@ -0,0 +1,30 @@
#include "load_Image_callback.h"
namespace load_image_notify_routine
{
VOID load_image_notify_routine(
PUNICODE_STRING FullImageName,
HANDLE ProcessId,
PIMAGE_INFO ImageInfo
)
{
UNREFERENCED_PARAMETER(ProcessId);
UNREFERENCED_PARAMETER(ImageInfo);
if(FullImageName->Buffer)
DbgPrintEx(77, 0, "[+] %ws\n", FullImageName->Buffer);
}
auto create_image_load_notify_routine() -> NTSTATUS
{
return PsSetLoadImageNotifyRoutine(load_image_notify_routine);
}
auto remove_image_load_notify_routine() -> NTSTATUS
{
return PsRemoveLoadImageNotifyRoutine(load_image_notify_routine);
}
}
+11
View File
@@ -0,0 +1,11 @@
#pragma once
#include "Base.h"
namespace load_image_notify_routine
{
auto create_image_load_notify_routine() -> NTSTATUS;
auto remove_image_load_notify_routine() -> NTSTATUS;
}