From b8a7feabea6456f7fa5e8403c8d9bd2630401045 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:48:05 +0200 Subject: More exploit fixes by KIttenPopo (#126) * Quick fix for a bug I caused * Typo * Update kitten-fixes branch to my repo (#122) * Added string hash macro * Added convenient vtfunc macro * Made lil ConCommand creation macro * Fixed multiple NET_SetConVar exploits * Quick fixerino * Fix convar struct (and other things) * Revive clang-format (but good, i think) * Update .clang-format * Reformatted code to meet .clang-format requirements * Minor formatting fixes * Fixed Northstar "crashing" when console is closed * Update .clang-format * Quick fix for a bug I caused * Typo * NSMem Update * ExplotFixes: Only block excessive convar counts if server * Update ExploitFixes.cpp * Update ExploitFixes.cpp * Updated bytepatch format * reformatted all code for clang-format * Updated my clang-format to v13.0.0 * 3 fixes in 1 - ANTITAMPER fixed - NSMem simplification update - Fixed bad byte string in serverauthentication.cpp * Improved ExploitFixes logging and NET_SetConVar patch * clang-format unironically sabotaged my code * Made ns_exploitfixes_log on by default * Fixed IsMemoryReadable (oops) Co-authored-by: KittenPopo --- NorthstarDedicatedTest/dedicated.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'NorthstarDedicatedTest/dedicated.cpp') diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp index e0206d1f..c97ac91d 100644 --- a/NorthstarDedicatedTest/dedicated.cpp +++ b/NorthstarDedicatedTest/dedicated.cpp @@ -7,8 +7,8 @@ bool IsDedicated() { - // return CommandLine()->CheckParm("-dedicated"); - return strstr(GetCommandLineA(), "-dedicated"); + static bool result = strstr(GetCommandLineA(), "-dedicated"); + return result; } // CDedidcatedExports defs @@ -136,10 +136,10 @@ void InitialiseDedicated(HMODULE engineAddress) auto ptr = ea + 0x1C4EBD; // cmp => mov - NSMem::BytePatch(ptr + 1, {0xC6, 0x87}); + NSMem::BytePatch(ptr + 1, "C6 87"); // 00 => 01 - NSMem::BytePatch(ptr + 7, {0x01}); + NSMem::BytePatch(ptr + 7, "01"); } { @@ -160,7 +160,7 @@ void InitialiseDedicated(HMODULE engineAddress) // previously patched these, took me a couple weeks to figure out they were the issue // removing these will mess up register state when this function is over, so we'll write HS_RUN to the wrong address // so uhh, don't do that - //NSMem::NOP(ea + 0x156B4C + 7, 8); + // NSMem::NOP(ea + 0x156B4C + 7, 8); NSMem::NOP(ea + 0x156B4C + 15, 9); } @@ -188,7 +188,7 @@ void InitialiseDedicated(HMODULE engineAddress) { // Host_Init // change the number of rpaks to load from 6 to 1, so we only load common.rpak - NSMem::BytePatch(ea + 0x15653B + 1, {0x01}); + NSMem::BytePatch(ea + 0x15653B + 1, "01"); } { @@ -212,10 +212,11 @@ void InitialiseDedicated(HMODULE engineAddress) { // func that checks if origin is inited // always return 1 - NSMem::BytePatch(ea + 0x183B70, { - 0xB0, 0x01, // mov al,01 - 0xC3 // ret - }); + NSMem::BytePatch( + ea + 0x183B70, { + 0xB0, 0x01, // mov al,01 + 0xC3 // ret + }); } { @@ -301,9 +302,10 @@ void InitialiseDedicatedOrigin(HMODULE baseAddress) // for any big ea lawyers, this can't be used to play the game without origin, game will throw a fit if you try to do anything without // an origin id as a client for dedi it's fine though, game doesn't care if origin is disabled as long as there's only a server - NSMem::BytePatch((uintptr_t)GetProcAddress(GetModuleHandleA("tier0.dll"), "Tier0_InitOrigin"), { - 0xC3 // ret - }); + NSMem::BytePatch( + (uintptr_t)GetProcAddress(GetModuleHandleA("tier0.dll"), "Tier0_InitOrigin"), { + 0xC3 // ret + }); } typedef void (*PrintFatalSquirrelErrorType)(void* sqvm); -- cgit v1.2.3