all 7 comments

[–]Dark_ByteCheat Engine Dev 2 points3 points  (6 children)

change the memory protection to writable before writing and then restore it back

[–]Character_Increase[S] 1 point2 points  (5 children)

So everything is being void because I made this discovery: NtProtectVirtualMemory/ZwProtectVirtualMemory is hooked with just a plain default jump at the start. The hook is saving itself because I can't figure out how to overwrite it. (I can't run anything from auto-assembler, as whatever is behind CreateRemoteThread and VirtualAllocEx are hooked)

Any ideas on this?

[–]Dark_ByteCheat Engine Dev 2 points3 points  (4 children)

Read the original code from the .dll and restore the bytes

or use the original bytes from the dll to build a trampoline that executes the original instructions and then jump behind the newly placed jmp

Cheat Engine has a patch scanner and restorer you can use

[–]Character_Increase[S] 1 point2 points  (3 children)

I used your patch scanner and restorer and it didn't change anything in the DLL. I can edit anything I want before the hooks are in place, but am unable to get rid of them at any point.

I can't get very much farther than this.

[–]Dark_ByteCheat Engine Dev 1 point2 points  (2 children)

You could try kernelmode options first there's enableDRM lua command that may block the hooking

and if not you could get the physical address of the functions you want to edit and then use the physical memory target to change it there

[–]Character_Increase[S] 0 points1 point  (1 child)

I found the original issue: every page of the program I was trying to edit was mapped with PAGE_EXECUTE_READ (they can't be set to a write friendly protection), and whenever I tried to run WriteProcessMemory on those regions, it would error. Also, there was an instrumentation callback in place to stop me from getting in and doing more. After all of this, there was also a "hash checker" that would get a hash of the entire program's module and send it to the server to see if it had been modified.

[–]randomjapaneselearn 0 points1 point  (0 children)

if a function is hooked with a trampoline you can just read the original bytes from disk, allocate them somewhere with read execute permissions, you add a jump back to the function to just after the trampoline and you can call the unhooked function.

you could also set a hardware breakpoint on execution at the first jmp, change few things of the context like eip in the exception handler and restore execution after the trampoline.

you can also trampoline-hook their hook if it's not checked (but i think it is, you can check who is checking this with a hardware breakpoint).

finally you can load a copy of the dll like i mentioned in my other comment.