반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- hacking
- Network Byte Order
- ucrtbase.dll
- pwnable
- 시스템해킹
- 네트워크 바이트 오더
- Msvcrt.dll
- pcap packet
- 해킹
- packet capture
- 윈도우 커널
- C언어 패킷캡쳐
- 윈도우 커널 드라이버
- 바이트 오더
- windows kernel debugging
- pcap packet capture
- arudino
- 윈도우 커널 디버깅
- 개발 환경 준비
- 포너블
- HackCTF
- Windows
- IAT Hooking
- apphelp.dll
- vcruntime.dll
- Windows Kernel
- Windows Kernel Driver
- vcruntime140.dll
- Windows Kernel Debug
- 개발하기
Archives
- Today
- Total
미친해커
[Windows] Instrumentation Callback 등록하기 본문
반응형
Instrumentation Callback's Strcture
Instrumentation Callback을 등록하기 위해서는 특정한 구조체를 사용해야 한다.
typedef struct _PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION
{
ULONG Version; // x64 -> 0 | x86 -> 1
ULONG Reserved; // Always 0
PVOID Callback; // VOID (CALLBACK *InstrumentationCallback)();
} PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION, *PPROCESS_INSTRUMENTATION_CALLBACK_INFORMATION;
How to Reigster Instrumentation Callback?
Instrumentation Callback을 등록하기 위해서는 NtSetInforamationProcess 함수를 사용해야 한다.
VOID CALLBACK InstrumentationCallback()
{
printf("Instrumentation Callback\n");
}
PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION nirvana;
nirvana.Version = 0;
nirvana.Reserved = 0;
nirvana.Callback = InstrumentationCallback;
NtSetInformationProcess(hProcess, PROCESS_INFO_CLASS_INSTRUMENTATION, &nirvana, sizeof(PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION));
Example
#include <stdio.h>
#include <windows.h>
#define PROCESS_INFO_CLASS_INSTRUMENTATION 40
NTSYSAPI NTSTATUS NTAPI NtSetInformationProcess(HANDLE ProcessHandle, PROCESS_INFORMATION_CLASS ProcessInformationClass, PVOID ProcessInformation, ULONG ProcessInformationLength);
typedef struct _PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION
{
ULONG Version;
ULONG Reserved;
PVOID Callback;
} PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION, *PPROCESS_INSTRUMENTATION_CALLBACK_INFORMATION;
VOID CALLBACK InstrumentationCallback()
{
printf("Instrumentation Callback\n");
}
int main(int argc, char *argv[])
{
PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION nirvana;
nirvana.Version = 0;
nirvana.Reserved = 0;
nirvana.Callback = InstrumentationCallback;
NtSetInformationProcess(GetCurrentProcess(), PROCESS_INFO_CLASS_INSTRUMENTATION, &nirvana, sizeof(PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION));
OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());
return 0;
}
반응형
'Windows > Instrumentation Callback' 카테고리의 다른 글
[Windows] Instrumentation Callback 응용하기 - syscall detect (0) | 2022.08.15 |
---|---|
[Windows] Instrumentation Callback 응용하기 - syscall tracking (0) | 2022.08.02 |
[Windows] Instrumentation Callback이란? (0) | 2022.08.01 |
Comments