Skip to content

Commit 92d2678

Browse files
committed
added new method, renamed heavens gate to wow64peb
1 parent 2c939ad commit 92d2678

File tree

5 files changed

+40
-5
lines changed

5 files changed

+40
-5
lines changed

.vs/anti-debugging/v16/.suo

7 KB
Binary file not shown.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#pragma once
2+
3+
#include <windows.h>
4+
#include <iostream>
5+
6+
THREADINFOCLASS ThreadHideFromDebugger = (THREADINFOCLASS)0x11;
7+
bool hasNtSetInformationThreadRun = false;
8+
9+
typedef NTSTATUS(WINAPI* NtSetInformationThread_t)(HANDLE, THREADINFOCLASS, PVOID, ULONG);
10+
typedef NTSTATUS (WINAPI *NtQueryInformationThread_t)(HANDLE, THREADINFOCLASS, PVOID, ULONG, PULONG);
11+
12+
NtSetInformationThread_t fnNtSetInformationThread = NULL;
13+
NtQueryInformationThread_t fnNtQueryInformationThread = NULL;
14+
15+
16+
bool MethodThreadHideFromDebugger() {
17+
18+
HANDLE hThread = GetCurrentThread();
19+
fnNtSetInformationThread = (NtSetInformationThread_t)GetProcAddress(GetModuleHandle(TEXT("ntdll.dll")), "NtSetInformationThread");
20+
fnNtQueryInformationThread = (NtQueryInformationThread_t)GetProcAddress(GetModuleHandle(TEXT("ntdll.dll")), "NtQueryInformationThread");
21+
22+
if (hasNtSetInformationThreadRun == false)
23+
{
24+
NTSTATUS errorCode = fnNtSetInformationThread(hThread, ThreadHideFromDebugger, NULL, NULL);
25+
hasNtSetInformationThreadRun = true;
26+
}
27+
28+
unsigned char lHideThreadQuery = false;
29+
ULONG lRet = 0;
30+
31+
NTSTATUS errorCode = fnNtQueryInformationThread(hThread, ThreadHideFromDebugger, &lHideThreadQuery, sizeof(lHideThreadQuery), &lRet);
32+
CloseHandle(hThread);
33+
34+
return false; //it will crash if its detected anyway
35+
}

Methods/MethodUnhandledException.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
bool hasADbgAttached = true;
88

99
LONG WINAPI GetExecutedOnUnhandledException(EXCEPTION_POINTERS * pExceptionInfo) {
10-
std::cout << "DJaskldjsLKdjasKDLj skaLDjsakldj saKLd a";
1110
hasADbgAttached = false;
1211

1312
// thx @mambda for this tip!

Methods/HeavensGateStuff.hpp renamed to Methods/MethodWow64PEB.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
extern "C" bool check_x64_peb( );
66

7-
bool MethodHeavensGate( )
7+
bool MethodWow64PEB( )
88
{
99
//auto peb32 = (char*)__readfsdword( 0x30 );
1010
//*( peb32 + 2 ) = 0;

anti-debugging.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "Methods/MethodPEBBeingDebugged.h"
1313
#include "Methods/MethodNtGlobalFlag.h"
1414
#include "Methods/MethodGetParentProcess.h"
15-
#include "Methods/HeavensGateStuff.hpp"
16-
15+
#include "Methods/MethodWow64PEB.hpp"
16+
#include "Methods/MethodThreadHideFromDebugger.h"
1717

1818
LRESULT CALLBACK WindowProcedure( HWND, UINT, WPARAM, LPARAM );
1919

@@ -151,7 +151,8 @@ void AddControls( HWND hWnd ) {
151151
AddMethod( MethodCheckRemoteDebuggerPresent, "CheckRemoteDebuggerPresent()" );
152152
AddMethod( MethodGetParentProcess, "Check Parent Process (CreateToolhelp32Snapshot)" );
153153
AddMethod( MethodUnhandledException, "UnhandledExceptionFilter" );
154-
AddMethod( MethodHeavensGate, "Heaven's Gate" );
154+
AddMethod( MethodWow64PEB, "WoW64 PEB->BeingDebugged" );
155+
AddMethod( MethodThreadHideFromDebugger, "ThreadHideFromDebugger (will crash if debugged)" );
155156

156157
hLogo = CreateWindowA( "static", NULL, WS_VISIBLE | WS_CHILD | SS_BITMAP, -10, 0, 100, 100, hWnd, NULL, NULL, NULL );
157158
SendMessageA( hLogo, STM_SETIMAGE, IMAGE_BITMAP, ( LPARAM )hLogoImage );

0 commit comments

Comments
 (0)