View previous topic :: View next topic |
Author |
Message |
fuguipingan Newbie cheater
Reputation: 0
Joined: 13 May 2019 Posts: 11
|
Posted: Sat May 25, 2019 10:40 pm Post subject: Is it possible to cmp register value with memory address? |
|
|
I am doing code injection to lock my character's health.
Here is my idea:
compare the register with the address of my character's healthpointer, if equals, then nop it.
Two problems:
1. When I paste in the address value of healthpointer, the value changes after execute the code injection
beforel: CD94130098
after: FFFFFFFF94130098
2. Is my code valid? (by directly comparing register with address, without dereferencing it):
alloc(newmem,2048,"witcher3.exe"+E3BF93)
label(returnhere)
label(originalcode)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
cmp rax,CD94130098
je exit
originalcode:
movss [rax+rcx*4],xmm6
exit:
jmp returnhere
"witcher3.exe"+E3BF93:
jmp newmem
returnhere:
--
I am seeing crash after the injection.
|
|
Back to top |
|
 |
sbryzl Master Cheater
Reputation: 6
Joined: 25 Jul 2016 Posts: 252
|
Posted: Sun May 26, 2019 5:59 am Post subject: |
|
|
You can't compare 64 bit values. You could make it a 32 bit compare.
cmp eax,94130098
|
|
Back to top |
|
 |
TheyCallMeTim13 Wiki Contributor
Reputation: 51
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sun May 26, 2019 7:03 am Post subject: |
|
|
You can also just store the value in a registry and then compare that.
Code: | push rbx
mov rbx,CD94130098
cmp rax,rbx
pop rbx
je exit |
_________________
|
|
Back to top |
|
 |
fuguipingan Newbie cheater
Reputation: 0
Joined: 13 May 2019 Posts: 11
|
Posted: Sun May 26, 2019 7:31 pm Post subject: |
|
|
Thanks. This seems to work and I can get the cmp passing. But I encounters crashing after that. Wierd
sbryzl wrote: | You can't compare 64 bit values. You could make it a 32 bit compare.
cmp eax,94130098 |
|
|
Back to top |
|
 |
Karyoplasma How do I cheat?
Reputation: 0
Joined: 12 Jun 2015 Posts: 3
|
Posted: Mon May 27, 2019 5:41 pm Post subject: |
|
|
Push and pop flags to/from the stack before you use a compare or else you can inadvertently screw up a future compare which can lead to crashes:
Code: | push rbx
pushf
mov rbx,CD94130098
cmp rax,rbx
pop rbx
je @f
popf
*code for when it's not equal*
jmp exit
@@:
popf
*code for when it's equal*
jmp exit |
Example when it's 100% needed to push/pop flags is when your injection looks like this:
Code: |
cmp eax, 9
-----you inject here-----
jmp newmem
-----you return here-----
je somewhere <---- this will jump based on the compare in your code and might crash the program
|
|
|
Back to top |
|
 |
fuguipingan Newbie cheater
Reputation: 0
Joined: 13 May 2019 Posts: 11
|
Posted: Thu Jun 06, 2019 10:37 pm Post subject: |
|
|
Thanks everyone. I am able to get this working now. The cause was found to be the jump address returned from CE's auto alloc memory seems too "far". When I finished my own code and jump back, an exception happend.
Now I found some nearby nop space and put my code there, it works as expected without crashing.
|
|
Back to top |
|
 |
|