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 


Asm help:

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Tue Aug 11, 2009 2:22 pm    Post subject: Asm help: Reply with quote

Question:

I'm trying to make a cave that always catches when the ESI is a certain value, why is this crashing? Am I doing something wrong?

I know it's a sloppy method, but I'm still learning Very Happy

01000F21: mov eax,[ebx+10] // Original opcode right before 1e23adf3
01000F24: cmp esi,138f83d0 // Check if ESI's value is 138F83D0 (is this correct?)
01000F2A: jne 01000f31
01000F2C: jmp 1e23adf3 // Jump back to original code if not equal
01000F31: mov [00401365],eax // If equal, move the value of EAX into that static address (just looked for an unused static addy)
01000F37: jmp 1e23adf3 // Jump back to original code.


The addresses are arbitrary, but when I do this to the game it crashes. Any ideas?

(I've already tried multiple times for the static pointer, it goes in loops and is way too much trouble than it's worth)

Basically, the instruction that writes to it, also writes to a lot of other addresses, but i've noticed that ESI is set to a specific hex that doesn't seem to relate to any other address or instruction so If i can only store what EAX is when the ESI is that certain hex, i've got the address i'm looking for.

Thanks
Back to top
View user's profile Send private message
Polynomial
Grandmaster Cheater
Reputation: 5

Joined: 17 Feb 2008
Posts: 524
Location: Inside the Intel CET shadow stack

PostPosted: Tue Aug 11, 2009 2:27 pm    Post subject: Reply with quote

I'm still learning ASM myself, but doesn't the jne 01000f31 mean "If the cmp returned 'not equal', jump to 01000f31"? If so, your comment for 01000F31 line seems to suggest you're going wrong somewhere.
_________________
It's not fun unless every exploit mitigation is enabled.
Please do not reply to my posts with LLM-generated slop; I consider it to be an insult to my time.
Back to top
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Tue Aug 11, 2009 2:28 pm    Post subject: Reply with quote

Hm, ah. Good eye. But it still should execute and not crash the game, right? And give me all of the addresses I 'dont' want.

So:


01000F21: mov eax,[ebx+10] // Original opcode right before 1e23adf3
01000F24: cmp esi,138f83d0 // Check if ESI's value is 138F83D0 (is this correct?)
01000F2A: je 01000f31
01000F2C: jmp 1e23adf3 // Jump back to original code if not equal
01000F31: mov [00401365],eax // If equal, move the value of EAX into that static address (just looked for an unused static addy)
01000F37: jmp 1e23adf3 // Jump back to original code.

Is what we're working with. Which still crashes. :[

Possibly it's setting the ZF different than the original code expected?
Back to top
View user's profile Send private message
Polynomial
Grandmaster Cheater
Reputation: 5

Joined: 17 Feb 2008
Posts: 524
Location: Inside the Intel CET shadow stack

PostPosted: Tue Aug 11, 2009 2:33 pm    Post subject: Reply with quote

Not sure, I'm not an expert in this Razz

Try breakpointing 01000F21 in OllyDbg and stepping through it until you hit the exception.

_________________
It's not fun unless every exploit mitigation is enabled.
Please do not reply to my posts with LLM-generated slop; I consider it to be an insult to my time.
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Tue Aug 11, 2009 2:42 pm    Post subject: Reply with quote

Do you want to compare the address of ESI, or the value inside it?

Try [esi].
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Tue Aug 11, 2009 2:44 pm    Post subject: Reply with quote

There are 16 and 32 bit jumps. 16 bit is a relative jump, 32 bit is a absolute jump. You need to be using 16 bit jumps (I think).

Also, is this AA or inline ASM?
Back to top
View user's profile Send private message
mStorm
Expert Cheater
Reputation: 0

Joined: 21 Feb 2009
Posts: 107

PostPosted: Tue Aug 11, 2009 3:15 pm    Post subject: Reply with quote

smartz993 wrote:
Do you want to compare the address of ESI, or the value inside it?

Try [esi].


I want to compare ESI not what it points to.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Aug 11, 2009 3:30 pm    Post subject: Reply with quote

i reckon it is crashing here :
Code:
01000F31: mov [00401365],eax


a lot of apps have image base as 00400000. then .text/code section starts 1000 from there so i bet your problem is that you are writing to a code section which is non-writable hence you get an access violation >> crash
Back to top
View user's profile Send private message
Polynomial
Grandmaster Cheater
Reputation: 5

Joined: 17 Feb 2008
Posts: 524
Location: Inside the Intel CET shadow stack

PostPosted: Tue Aug 11, 2009 3:35 pm    Post subject: Reply with quote

Slug - Would that the an issue if he actually found an unused static pointer?
_________________
It's not fun unless every exploit mitigation is enabled.
Please do not reply to my posts with LLM-generated slop; I consider it to be an insult to my time.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Aug 11, 2009 3:39 pm    Post subject: Reply with quote

he found an unused static address << what he means is buffer. if it has a pointer to it from somewhere else then it's not 'unused' if he is looking for codecaves he should not be looking in .text though, probably in places like .data section instead

if he wants to find a codecave dynamically then a good idea would be to virtualquery memory first to check its writability but if you're going to make it that complex then you're most likely injecting a dll in which case you could just allocate your own memory or declare it as a variable. in fact even in his codecaved code there, he could do 2 things :
1 ) allocate memory
2 ) make the memory that he is attempting to write to writable

with both, it would be a good idea to push/pop eax, ecx + edx to preserve them else you'll most likely crash the program or mess it up bad ( STDCall trashes those registers )

ps. section header names might differ depending on compiler/packed ( doesn't seem like that proggie is packed though if my assumption about its imagebase being 0x00400000 is correct )


Last edited by Slugsnack on Tue Aug 11, 2009 3:41 pm; edited 1 time in total
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Tue Aug 11, 2009 3:40 pm    Post subject: Reply with quote

Burningmace wrote:
Slug - Would that the an issue if he actually found an unused static pointer?


Depends on the access he has.
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