This commit is contained in:
watrabi
2025-12-18 16:59:29 -05:00
parent c93494f795
commit ff95483b22
54 changed files with 60469 additions and 509 deletions
+69 -69
View File
@@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "functionHooks.h"
#include "robloxHooks.h"
#include "v8datamodel/HackDefines.h"
@@ -12,88 +12,88 @@
namespace
{
size_t moduleStart = 0;
size_t moduleSize = 0xFFFFFFFF;
size_t moduleStart = 0;
size_t moduleSize = 0xFFFFFFFF;
typedef HWND (WINAPI *FindWindowSplice)(LPCTSTR, LPCSTR);
typedef HWND(WINAPI* FindWindowSplice)(LPCTSTR, LPCSTR);
// Can call this function.
FindWindowSplice resumeFindWindow = 0;
// Can call this function.
FindWindowSplice resumeFindWindow = 0;
// asm stub to run when findWindowA is called.
HWND WINAPI findWindowHook(LPCTSTR className, LPCSTR windowName)
{
size_t returnAddress;
size_t argDiff;
static const size_t kHalf = 1 << 23;
static const size_t kFull = 1 << 24;
VMProtectBeginMutation("35");
returnAddress = reinterpret_cast<size_t>(_ReturnAddress());
argDiff = (reinterpret_cast<size_t>(windowName) - returnAddress);
// This is an attempt at a very conservative check for the window. It looks for
// DLLs that called out ROBLOX by name inside their code and not from some scan.
if (windowName // user passed a windowName
&& ((returnAddress - moduleStart) > moduleSize) // but not us
&& ((argDiff+kHalf) < kFull) // Argument is +-8MB from call location, probably .rdata.
&& (_strnicmp(windowName, "ROBLOX", 6) == 0)) // with roblox as argument
// asm stub to run when findWindowA is called.
HWND WINAPI findWindowHook(LPCTSTR className, LPCSTR windowName)
{
RBX::hotpatchUnhook(resumeFindWindow);
RBX::Tokens::simpleToken |= HATE_DLL_INJECTION;
}
VMProtectEnd();
return resumeFindWindow(className,windowName);
}
size_t returnAddress;
size_t argDiff;
static const size_t kHalf = 1 << 23;
static const size_t kFull = 1 << 24;
VMProtectBeginMutation("35");
returnAddress = reinterpret_cast<size_t>(_ReturnAddress());
argDiff = (reinterpret_cast<size_t>(windowName) - returnAddress);
// This will request a kick if a possible access violation hook is found. This will set
// a flag and allow normal exception handling to occur. If the user was not hacking,
// there will be a crash.
void RtlDispatchExceptionCheck(PEXCEPTION_RECORD exRec, PCONTEXT ctx)
{
const DWORD code = exRec->ExceptionCode;
const DWORD codeStart = RBX::Security::rbxTextBase;
const DWORD codeSize = RBX::Security::rbxTextSize;
if( code == EXCEPTION_ACCESS_VIOLATION)
{
const DWORD avAddr = exRec->ExceptionInformation[1];
if ((avAddr - codeStart) <= codeSize)
// This is an attempt at a very conservative check for the window. It looks for
// DLLs that called out ROBLOX by name inside their code and not from some scan.
if (windowName // user passed a windowName
&& ((returnAddress - moduleStart) > moduleSize) // but not us
&& ((argDiff + kHalf) < kFull) // Argument is +-8MB from call location, probably .rdata.
&& (_strnicmp(windowName, "ROBLOX", 6) == 0)) // with roblox as argument
{
RBX::Security::setHackFlagVs<LINE_RAND1>(RBX::Security::hackFlag6, HATE_VEH_HOOK);
RBX::Tokens::sendStatsToken.addFlagFast(HATE_VEH_HOOK);
RBX::hotpatchUnhook(resumeFindWindow);
RBX::Tokens::simpleToken |= HATE_DLL_INJECTION;
}
VMProtectEnd();
return resumeFindWindow(className, windowName);
}
// This will request a kick if a possible access violation hook is found. This will set
// a flag and allow normal exception handling to occur. If the user was not hacking,
// there will be a crash.
void RtlDispatchExceptionCheck(PEXCEPTION_RECORD exRec, PCONTEXT ctx)
{
const DWORD code = exRec->ExceptionCode;
const DWORD codeStart = RBX::Security::rbxTextBase;
const DWORD codeSize = RBX::Security::rbxTextSize;
if (code == EXCEPTION_ACCESS_VIOLATION)
{
const DWORD avAddr = exRec->ExceptionInformation[1];
if ((avAddr - codeStart) <= codeSize)
{
RBX::Security::setHackFlagVs<LINE_RAND1>(RBX::Security::hackFlag6, HATE_VEH_HOOK);
RBX::Tokens::sendStatsToken.addFlagFast(HATE_VEH_HOOK);
}
}
else if ((code == EXCEPTION_BREAKPOINT) ||
(code == EXCEPTION_SINGLE_STEP) ||
(code == EXCEPTION_ILLEGAL_INSTRUCTION) ||
(code == EXCEPTION_PRIV_INSTRUCTION))
{
const DWORD addr = reinterpret_cast<DWORD>(exRec->ExceptionAddress);
if ((addr - codeStart) <= codeSize)
{
RBX::Security::setHackFlagVs<LINE_RAND1>(RBX::Security::hackFlag6, HATE_VEH_HOOK);
RBX::Tokens::sendStatsToken.addFlagFast(HATE_VEH_HOOK);
}
}
}
else if ((code == EXCEPTION_BREAKPOINT) ||
(code == EXCEPTION_SINGLE_STEP) ||
(code == EXCEPTION_ILLEGAL_INSTRUCTION) ||
(code == EXCEPTION_PRIV_INSTRUCTION))
bool cmpKiUserExceptionDispatcher(const char* inString)
{
const DWORD addr = reinterpret_cast<DWORD>(exRec->ExceptionAddress);
if ((addr - codeStart) <= codeSize)
const unsigned char cmpString[26] = { 129, 254, 37, 162, 27, 133, 129, 157, 225, 138, 46, 157, 191, 244, 244, 153, 75, 12, 70, 220, 152, 104, 186, 244, 94, 43 };
if (!inString) return false;
for (int i = 0; i < 26; ++i)
{
RBX::Security::setHackFlagVs<LINE_RAND1>(RBX::Security::hackFlag6, HATE_VEH_HOOK);
RBX::Tokens::sendStatsToken.addFlagFast(HATE_VEH_HOOK);
}
if ((unsigned char)((inString[i] + i) * 227) != cmpString[i]) return false;
if (!inString[i]) return (i == 25);
};
return false;
}
}
bool cmpKiUserExceptionDispatcher(const char* inString)
{
const unsigned char cmpString[26] = {129, 254, 37, 162, 27, 133, 129, 157, 225, 138, 46, 157, 191, 244, 244, 153, 75, 12, 70, 220, 152, 104, 186, 244, 94, 43};
if (!inString) return false;
for (int i = 0; i < 26; ++i)
{
if ((unsigned char)((inString[i]+i)*227) != cmpString[i]) return false;
if (!inString[i]) return (i == 25);
};
return false;
}
const unsigned char kiUserExceptionDispatcherProlog[10] =
{0x8B, 0x4C, 0x24, 0x04, // mov ecx,dword ptr [esp+4]
const unsigned char kiUserExceptionDispatcherProlog[10] =
{ 0x8B, 0x4C, 0x24, 0x04, // mov ecx,dword ptr [esp+4]
0x8B, 0x1C, 0x24, // mov ebx,dword ptr [esp]
0x51, // push ecx
0x53, // push ebx
0xE8 /* XX XX XX XX */}; // call ntdll!RtlDisapatchException
0xE8 /* XX XX XX XX */ }; // call ntdll!RtlDisapatchException
}
@@ -187,7 +187,7 @@ namespace RBX
moduleStart = reinterpret_cast<size_t>(info.lpBaseOfDll);
moduleSize = info.SizeOfImage;
}
resumeFindWindow = reinterpret_cast<FindWindowSplice>(hotpatchHook(&FindWindowA,findWindowHook));
resumeFindWindow = reinterpret_cast<FindWindowSplice>(hotpatchHook(&FindWindowA, findWindowHook));
hookPreVeh();
}