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 


Getting the PEB for remote process

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Nov 27, 2012 10:50 pm    Post subject: Getting the PEB for remote process Reply with quote

Does any of you know an alternative way to get the PEB address for a remote process than NtQueryInformationProcess?

for some reason it's not reliable way it's give me a different address every time i call it for the same process :S
and i don't want to get too lower (i also created a driver to get the PEB from the EPROCESS Structure, which is more reliable way)
I want to use it in user mode.

_________________
Stylo


Last edited by Stylo on Thu Nov 29, 2012 7:48 am; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Wed Nov 28, 2012 1:13 am    Post subject: Reply with quote

Get the segment base address of FS of any thread ( GetThreadSelectorEntry or Wow64GetThreadSelectorEntry if you're in 64-bit) and go to offset 0x30 to get the address of the PEB
Another method i noticed is finding the first entry in the stack of the main thread.. So far all programs i've seen have as first entry the peb pointer

_________________
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
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Wed Nov 28, 2012 1:26 pm    Post subject: Reply with quote

yea i'v noticed too that the first entry on every process has PEB pointer in ebx register.
but how would i get there through other process?

and for GetThreadSelectorEntry, how'd i get the thread handle for a remote thread?

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

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

PostPosted: Wed Nov 28, 2012 1:51 pm    Post subject: Reply with quote

Enumerate the threads, then OpenThread with at least query access
_________________
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
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sat Dec 01, 2012 9:21 am    Post subject: Reply with quote

So it's basically possible from any thread that i choose... !?
_________________
Stylo
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sat Dec 01, 2012 9:43 am    Post subject: Reply with quote

As long as it is a thread that belongs to to game, yes. Even your own created threads using createremotethread
_________________
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
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Dec 01, 2012 8:39 pm    Post subject: Reply with quote

Here's an example using CE:

Code:


alloc(chunk,4096)
CREATETHREAD(chunk)
label(peb)
registersymbol(peb)

chunk:
    push eax
    mov eax, FS:[0x30]
    mov [peb], eax
    pop eax
    ret

peb:
dd 0


Add the address 'peb' to your table afterward and it'll be the PEB of the process.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
n0 m3rcY
Cheater
Reputation: 0

Joined: 18 Jun 2012
Posts: 42

PostPosted: Sun Dec 02, 2012 1:51 am    Post subject: Reply with quote

NtQueryInformationProcess will provide you with the PROCESS_BASIC_INFORMATION struct of an external process, then just access the *PebBaseAddress member to get the PEB.

A Wow64 process will have two PEBs though, a 32 bit and a 64 bit one. The 32 bit one mirrors the 64 bit one on creation however the system uses the 64 bit one.
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