Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[HELP] Trampolining in r0

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
kittonkicker
I post too much
Reputation: 1

Joined: 19 Apr 2006
Posts: 2171

PostPosted: Mon Sep 17, 2007 10:48 am    Post subject: [HELP] Trampolining in r0 Reply with quote

Thanks to an idea from x0r I've written a driver with trampolined functions, which I was hoping would get round GameGuard.

I'm trampolining or "jumping over" GameGuard's hooks to bypass NtRead/WriteVirtualMemory and NtOpenProcess.

The redefined functions in my driver:

Code:
_declspec(naked) NTSTATUS ReadVirtualMemory(IN HANDLE ProcessHandle,IN PVOID BaseAddress,OUT PVOID Buffer,IN ULONG NumberOfBytesToRead,OUT PULONG NumberOfBytesReaded OPTIONAL)
{
   __asm
   {
      push 0x1c
      push 0x804d94c0
      jmp [AddressOfReadVirtualMemory]
   }
}

_declspec(naked) NTSTATUS WriteVirtualMemory(IN HANDLE ProcessHandle,IN PVOID BaseAddress,IN PVOID Buffer,IN ULONG NumberOfBytesToWrite,OUT PULONG NumberOfBytesWritten OPTIONAL)
{
   __asm
   {
      push 0x1c
      push 0x804d94d8
      jmp [AddressOfWriteVirtualMemory]
   }
}

_declspec(naked) NTSTATUS OpenProcess(OUT PHANDLE ProcessHandle,IN ACCESS_MASK DesiredAccess,IN POBJECT_ATTRIBUTES ObjectAttributes,IN PCLIENT_ID ClientId OPTIONAL)
{
   __asm
   {
      push 0x00c4
      jmp [AddressOfOpenProcess]
   }
}


From there I've added these new functions as entrys to the SSDT which I call in my redefined AltZwR/WVM and AltZwOP, which get called by my redefined AltR/WPM and AltOP functions.

I beleive the process goes like this:

User calls redefined API AltReadProcessMemory->AltReadProcessMemory calls AltZwReadVirtualMemory->New serviceid gets pushed and enters r0 using SYSENTER->serviceid is located to corresponding function in the SSDT and calls my unhooked function.

I can read any processes memory, so I know it definately works AND I know it's not getting unhooked because it still works while GameGuard is running...just not on GameGuard's protected process or GameMon.des, etc.

Does this have something to do with KeAttachProcess, etc or am I missing something crucial?

Thanks.

PS Not sure if this should be here or in the Anti Cheat Bypassing section...o_O.

_________________
All gone Sad
Back to top
View user's profile Send private message
Uligor
Grandmaster Cheater
Reputation: 0

Joined: 21 Jan 2006
Posts: 956

PostPosted: Mon Sep 17, 2007 3:47 pm    Post subject: Reply with quote

I don't know if ObOpenObjectByPointer is hooked, try unhooking that.
_________________
Back to top
View user's profile Send private message
kittonkicker
I post too much
Reputation: 1

Joined: 19 Apr 2006
Posts: 2171

PostPosted: Mon Sep 17, 2007 4:22 pm    Post subject: Reply with quote

Thanks I'll take a look!

EDIT: It's not...

_________________
All gone Sad
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25821
Location: The netherlands

PostPosted: Mon Sep 17, 2007 4:37 pm    Post subject: Reply with quote

yes, it has to do with KeAttachProcess and KiattachProcess and KiMoveApcState, those 3 api's are hooked and used by readvirtualmemory

you have to trampoline a bit further into the code

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping


Last edited by Dark Byte on Mon Sep 17, 2007 4:47 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
kittonkicker
I post too much
Reputation: 1

Joined: 19 Apr 2006
Posts: 2171

PostPosted: Mon Sep 17, 2007 4:45 pm    Post subject: Reply with quote

Awesome, I'll begin delving into the code.

Just out of curiosity DB, rather than using IOCTL's is it possible to add the functions you made to the SSDT and then code the appropriate Zw api to communicate with it?

I'm thinking about the best way to get around GameGuard, and it seems a little silly to not take advantage of an already awesome API you coded..!

_________________
All gone Sad
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25821
Location: The netherlands

PostPosted: Mon Sep 17, 2007 4:48 pm    Post subject: Reply with quote

yes, you can expand the sdt, you can even add a 3th or even 4th entry to it. I think a beta driver has that as a test.
You could even replace it with a read/write method, where you write to the driver and then read the result back out

also, how about making a complete copy of the kernel file and change all base relocations to point to the original base? (so processlists and static addresses stay the same, but relative stuff like calls and jmps get the unedited copy. Of course, to get into the unedited copy you'd have to place a jmp in the original code...)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
linden
Master Cheater
Reputation: 0

Joined: 10 Mar 2006
Posts: 319

PostPosted: Tue Sep 18, 2007 5:12 am    Post subject: Reply with quote

Dark Byte wrote:
yes, you can expand the sdt, you can even add a 3th or even 4th entry to it. I think a beta driver has that as a test.
You could even replace it with a read/write method, where you write to the driver and then read the result back out


Preparing another copy of the kernel with faked base relocation would be better. Messing with SDT won't do much good...expanding SDT needs a relocation, GG will just detect it with a range check; and adding 3rd or 4th entry won't work on Vista because it only recognize 2 entries... Sad

But another method, is to do the same thing as GG does. Have anyone noticed that GG makes an unhooked copy of the SDT for itself, and then for some of the critical threads (must be GUI thread though), it modifies the ServiceTable member inside the ETHREAD object to point to its own copy of SDT instead of the original ShadowServiceTable in order to evade any SDT hooks? We can do the same thing Very Happy
Back to top
View user's profile Send private message
Seyren
Master Cheater
Reputation: 0

Joined: 17 Aug 2007
Posts: 456
Location: Yeah i have one,why?

PostPosted: Tue Sep 18, 2007 6:18 pm    Post subject: Reply with quote

R0?
Back to top
View user's profile Send private message
kittonkicker
I post too much
Reputation: 1

Joined: 19 Apr 2006
Posts: 2171

PostPosted: Tue Sep 18, 2007 6:59 pm    Post subject: Reply with quote

If you have to ask, this topic isn't for you.

Thanks for all the ideas guys, I'm working on something now ^^.

_________________
All gone Sad
Back to top
View user's profile Send private message
the_undead
Expert Cheater
Reputation: 1

Joined: 12 Nov 2006
Posts: 235
Location: Johannesburg, South Africa

PostPosted: Wed Sep 19, 2007 3:19 am    Post subject: Reply with quote

Crimsonzero747 wrote:
R0?

Ring 0.

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Wed Sep 19, 2007 8:09 am    Post subject: Reply with quote

the_undead wrote:
Crimsonzero747 wrote:
R0?

Ring 0.

Rules 3 and 0 Mad
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites